# Method to get the next FASTA entry form an ios and return this
# as a Seq object. If no entry is found or eof then nil is returned.
def get_entry
- block = @io.gets($/ + '>')
+ block = nil
+
+ while block = @io.gets($/ + '>') and block.chomp($/ + '>').empty?
+ end
+
return nil if block.nil?
block.chomp!($/ + '>')
seq.chomp!
end
- ">" + seq_name + $/ + seq + $/
+ ">" + seq_name.to_s + $/ + seq + $/
end
# Method that given a Seq entry returns a FASTQ entry (a string).
assert_raise(FastaError) { fasta.get_entry }
end
- test "#get_entry with leading newline raises" do
- fasta = Fasta.new(StringIO.new("\n>test\nATCG\n"))
- assert_raise(FastaError) { fasta.get_entry }
- end
-
# FIXME
# test "#get_entry raises on missing > in seq_name" do
# fasta = Fasta.new(StringIO.new("test\nATCG\n"))