Class: Bix::Fastq

Inherits:
Object
  • Object
show all
Defined in:
lib/bix/fastq.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(header = "", seq = "", qual = "") ⇒ Fastq

Returns a new instance of Fastq.



5
6
7
8
9
# File 'lib/bix/fastq.rb', line 5

def initialize(header="", seq="", qual="")
  @header = header
  @seq = seq
  @qual = qual
end

Instance Attribute Details

#headerObject

Returns the value of attribute header.



3
4
5
# File 'lib/bix/fastq.rb', line 3

def header
  @header
end

#invalidObject

Returns the value of attribute invalid.



3
4
5
# File 'lib/bix/fastq.rb', line 3

def invalid
  @invalid
end

#qualObject

Returns the value of attribute qual.



3
4
5
# File 'lib/bix/fastq.rb', line 3

def qual
  @qual
end

#seqObject

Returns the value of attribute seq.



3
4
5
# File 'lib/bix/fastq.rb', line 3

def seq
  @seq
end

Class Method Details

.from_io(io) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/bix/fastq.rb', line 26

def self.from_io(io)
  fq = Fastq.new
  if fq.from_io(io)
    return fq
  else
    return nil
  end
end

Instance Method Details

#from_io(io) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bix/fastq.rb', line 11

def from_io(io)
  @header = io.gets
  @seq = io.gets
  io.gets # Throw away + line
  @qual = io.gets

  return false if @header == nil || @seq == nil || @qual == nil

  @header.chomp!
  @seq.chomp!
  @qual.chomp!

  return true
end

#qual_val(i) ⇒ Object



35
36
37
# File 'lib/bix/fastq.rb', line 35

def qual_val(i)
  return @qual[i].ord
end

#to_linesObject



39
40
41
# File 'lib/bix/fastq.rb', line 39

def to_lines
  return "#{@header}\n#{@seq}\n+\n#{@qual}"
end