393
391
foreach my $in ('BK000016-tpa.gbk', 'ay116458.gb', 'ay149291.gb', 'NC_006346.gb', 'ay007676.gb', 'dq519393.gb') {
394
392
my $infile = test_input_file($in);
396
394
$str = Bio::SeqIO->new(-format =>'genbank',
397
395
-verbose => $verbose,
398
396
-file => $infile);
399
397
$seq = $str->next_seq;
401
399
$out = Bio::SeqIO->new(-file => ">$outfile", -format => 'genbank');
402
400
$out->write_seq($seq);
405
403
open (IN, $infile);
581
579
ok my @ctg = $seq->annotation->get_Annotations('contig');
582
580
like $ctg[0]->value, qr/join\(.*?gap.*?complement/;
582
# write_seq() and FTHelper duplicate specific tags, need to check a round-trip
583
$ast = Bio::SeqIO->new(-format => 'genbank' ,
584
-verbose => $verbose,
585
-file => test_input_file('singlescore.gbk'));
586
$as = $ast->next_seq();
587
($cds) = grep { $_->primary_tag eq 'CDS' } $as->get_SeqFeatures();
588
my @notes = $cds->get_tag_values('note');
589
is(scalar @notes, 2);
590
$testfile = test_output_file();
591
$out = Bio::SeqIO->new(-file => ">$testfile",
592
-format => 'genbank');
593
$out->write_seq($as);
595
$ast = Bio::SeqIO->new(-format => 'genbank' ,
596
-verbose => $verbose,
597
-file => $testfile );
598
$as = $ast->next_seq;
599
($cds) = grep { $_->primary_tag eq 'CDS' } $as->get_SeqFeatures();
600
@notes = $cds->get_tag_values('note');
601
is(scalar @notes, 2);
605
my $in = Bio::SeqIO->new(-format => 'genbank',
606
-file => test_input_file('NC_002058_multDBLINK_bug3375.gb'));
607
$seq = $in->next_seq(); # should not throw a warning now
608
@dblinks = $seq->annotation->get_Annotations('dblink'); # contains 5 dblink references
609
# testing DBLINK BioProject: PRJNA15288
610
is($dblinks[0]->database, 'BioProject', 'bug3375 database is BioProject');
611
is($dblinks[0]->primary_id, 'PRJNA15288', 'bug3375 primary_id is PRJNA15288');
612
# testing DBLINK Project:100,200,300
613
is($dblinks[3]->database, 'Project');
614
is($dblinks[3]->primary_id, '300');
615
# testing DBLINK NC_002058.3
616
is($dblinks[4]->database, 'GenBank');
617
is($dblinks[4]->primary_id, 'NC_002058');
618
is($dblinks[4]->version, '3');
620
# long labels handled
622
# Create sequence with feature with a long label qualifier
623
my $seq=Bio::Seq->new(-seq => 'actg',
625
my $feature=Bio::SeqFeature::Generic->new(-primary=>'CDS', -start=>1, -end=>4);
626
my $label='1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r';
627
$feature->add_tag_value(label=>$label);
628
$seq->add_SeqFeature($feature);
632
open(my $str_fh, '>', \$string) || skip("Can't open string, skipping", 2);
633
my $out=Bio::SeqIO->new(-format=>'genbank', -fh => $str_fh);
634
$out->write_seq($seq);
637
my $in=Bio::SeqIO->new(-format=>'genbank', -string => $string);
638
my $genbank=$in->next_seq;
639
my ($read_feature)=$genbank->get_SeqFeatures;
640
my ($read_label)=$read_feature->get_tag_values('label');
641
is($read_label, $label, 'Label is the same');