X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=code_ruby%2Flib%2Fmaasha%2Ffastq.rb;h=8789899e50d796406657b10727252c32f5f6479f;hb=eb99c8692714ae906908545a7ff8f59f0d9575e9;hp=c57f4eb9165bb3423fccc22590f89550a8125c69;hpb=f5acf465aca28be318d232ca04c7fa63c4d40a29;p=biopieces.git diff --git a/code_ruby/lib/maasha/fastq.rb b/code_ruby/lib/maasha/fastq.rb index c57f4eb..8789899 100644 --- a/code_ruby/lib/maasha/fastq.rb +++ b/code_ruby/lib/maasha/fastq.rb @@ -33,22 +33,20 @@ class Fastq < Filesys # 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. def get_entry - begin - seq_name = @io.gets.chomp! - seq = @io.gets.chomp! - @io.gets - qual = @io.gets.chomp! - - entry = Seq.new - entry.seq = seq - entry.seq_name = seq_name[1 .. seq_name.length] - entry.qual = qual - entry.type = nil - - entry - rescue - nil - end + seq_name = @io.gets.chomp! + seq = @io.gets.chomp! + @io.gets + qual = @io.gets.chomp! + + entry = Seq.new + entry.seq = seq + entry.seq_name = seq_name[1 .. seq_name.length] + entry.qual = qual + entry.type = nil + + entry + rescue + nil end end @@ -83,7 +81,7 @@ class FastqIndex # Method to read from file a Fastq entry from an indexed position, # and return the entry as a Seq object. def get(seq_name) - raise FastqError, "Sequence name: #{seq_name} not found in index." unless @index.has_key? seq_name + raise FastqError, "Sequence name: #{seq_name} not found in index." unless @index[seq_name] elem = @index[seq_name] @ios.sysseek(elem.offset_seq)