Permalink
Browse files

genbank.pm: Fix for issue #70, removed the line at write_seq()

that made files with CONTIG lines to skip printing the sequence
(which came from the times where both were mutually exclusive).
Now both CONTIG lines and sequence prints correctly. Added tests.
  • Loading branch information...
fjossandon committed Aug 4, 2014
1 parent 409a7a5 commit 8fe9c612c83d2de6ee8adf7113f7534f024dac33
Showing with 22 additions and 2 deletions.
  1. +0 −1 Bio/SeqIO/genbank.pm
  2. +22 −1 t/SeqIO/genbank.t
View
@@ -1179,7 +1179,6 @@ sub write_seq {
$self->_print($cline);
$ct++;
}
- $self->_show_dna(0);
}
if ( $seq->length == 0 ) {
$self->_show_dna(0);
View
@@ -6,7 +6,7 @@ use strict;
BEGIN {
use lib '.';
use Bio::Root::Test;
- test_begin(-tests => 287);
+ test_begin(-tests => 292);
use_ok('Bio::SeqIO::genbank');
}
@@ -658,3 +658,24 @@ is($seq->seq, 'MENRKFGYIRVSSKDQNEGRQLEAMRKIGITERDIYLDKQSGKNFERANYQLLKRIIRKGDI'
. 'LYIHSLDRFGRNKEEILQEWNDLTKNIEADIVVLDMPLLDTTQYKDSMGTFIADLVLQILSWMAEEERERIRK'
. 'RQREGIDLALQNGIQFGRSPVVVSDEFKEVYRKWKAKELTAVEAMQEAGVKKTSFYKLVKAHENSIKVNS');
+# Genbank files with CONTIG and sequence should print the sequence with write_seq()
+$testfile = test_output_file;
+$out = Bio::SeqIO->new(-file => ">$testfile",
+ -format => 'genbank');
+$out->write_seq($seq);
+$out->close;
+
+$in = Bio::SeqIO->new(-file => $testfile,
+ -format => 'genbank',
+ -verbose => $verbose);
+$seq = $in->next_seq;
+is($seq->length, 205);
+
+@anns = $seq->annotation->get_Annotations('contig');
+is(@anns, 1);
+isa_ok($anns[0], 'Bio::Annotation::SimpleValue');
+is($anns[0]->value, 'join(WP_015639704.1:1..205)');
+
+is($seq->seq, 'MENRKFGYIRVSSKDQNEGRQLEAMRKIGITERDIYLDKQSGKNFERANYQLLKRIIRKGDI'
+ . 'LYIHSLDRFGRNKEEILQEWNDLTKNIEADIVVLDMPLLDTTQYKDSMGTFIADLVLQILSWMAEEERERIRK'
+ . 'RQREGIDLALQNGIQFGRSPVVVSDEFKEVYRKWKAKELTAVEAMQEAGVKKTSFYKLVKAHENSIKVNS');

0 comments on commit 8fe9c61

Please sign in to comment.