Class: FastqParser
- Inherits:
-
Object
- Object
- FastqParser
- Defined in:
- lib/parsers/fastq.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(handle) ⇒ FastqParser
constructor
A new instance of FastqParser.
Constructor Details
#initialize(handle) ⇒ FastqParser
Returns a new instance of FastqParser.
3 4 5 |
# File 'lib/parsers/fastq.rb', line 3 def initialize(handle) @handle = handle end |
Instance Method Details
#each ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/parsers/fastq.rb', line 7 def each c = (0..3).cycle params = { :name => nil, :sequence => nil, :quality => nil } @handle.each do |line| n = c.next case n when 0 params[:name] = line.strip[1..-1] when 1 params[:sequence] = line.strip when 2 nil when 3 params[:quality] = line.strip record = Fastq.new params yield record end end end |