class BioDSL::Fastq
Class for parsing FASTQ entries from an ios and return as Seq
objects.
Public Class Methods
new(io)
click to toggle source
# File lib/BioDSL/fastq.rb, line 49 def initialize(io) @io = io end
open(*args) { |new(ios)| ... }
click to toggle source
# File lib/BioDSL/fastq.rb, line 35 def self.open(*args) ios = IO.open(*args) if block_given? begin yield new(ios) ensure ios.close end else return new(ios) end end
Public Instance Methods
each() { |entry| ... }
click to toggle source
# File lib/BioDSL/fastq.rb, line 53 def each while (entry = next_entry) yield entry end end
next_entry()
click to toggle source
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.
# 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