Class: BioDSL::Fastq
Overview
Class for parsing FASTQ entries from an ios and return as Seq objects.
Defined Under Namespace
Classes: IO
Instance Attribute Summary
Attributes inherited from Filesys
Class Method Summary collapse
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(io) ⇒ Fastq
constructor
A new instance of Fastq.
-
#next_entry ⇒ Object
Method to get the next FASTQ entry from an ios and return this as a Seq object.
Methods inherited from Filesys
#close, #eof?, #gets, #puts, #read, tmpfile, which, #write
Constructor Details
#initialize(io) ⇒ Fastq
Returns a new instance of Fastq.
49 50 51 |
# File 'lib/BioDSL/fastq.rb', line 49 def initialize(io) @io = io end |
Class Method Details
Instance Method Details
#each ⇒ Object
53 54 55 56 57 |
# File 'lib/BioDSL/fastq.rb', line 53 def each while (entry = next_entry) yield entry end end |
#next_entry ⇒ Object
Method to get the next FASTQ entry from an ios and return this as a Seq object. If no entry is found or eof then nil is returned.
61 62 63 64 65 66 67 68 69 |
# File 'lib/BioDSL/fastq.rb', line 61 def next_entry return nil if @io.eof? seq_name = @io.gets[1..-2] seq = @io.gets.chomp @io.gets qual = @io.gets.chomp Seq.new(seq_name: seq_name, seq: seq, qual: qual) end |