1 # -*-Perl-*- Test Harness script for Bioperl
8 test_begin(-tests => 301);
9 use_ok('Bio::SeqIO::genbank');
12 my $verbose = test_debug;
14 my $ast = Bio::SeqIO->new(-format => 'genbank' ,
16 -file => test_input_file('roa1.genbank'));
17 isa_ok($ast, 'Bio::SeqIO');
18 $ast->verbose($verbose);
19 my $as = $ast->next_seq;
20 is $as->molecule, 'mRNA',$as->accession_number;
21 is $as->alphabet, 'dna';
22 is $as->division, 'EST';
23 is join(',',$as->get_dates), '27-OCT-1998';
24 is($as->primary_id, 3598416);
25 my @class = $as->species->classification;
26 is $class[$#class],'Eukaryota';
28 $ast = Bio::SeqIO->new(-format => 'genbank',
30 -file => test_input_file('NT_021877.gbk'));
31 $ast->verbose($verbose);
33 is $as->molecule, 'DNA',$as->accession_number;
34 is $as->alphabet, 'dna';
35 is $as->division, 'CON';
36 is join(',',$as->get_dates), '17-OCT-2003';
37 is($as->primary_id, 37539616);
38 is($as->accession_number, 'NT_021877');
40 my ($cds) = grep { $_->primary_tag eq 'CDS' } $as->get_SeqFeatures;
41 is(($cds->get_tag_values('transl_except'))[1],
42 '(pos:complement(4224..4226),aa:OTHER)');
44 # test for a DBSOURCE line
45 $ast = Bio::SeqIO->new(-format => 'genbank',
47 -file => test_input_file('BAB68554.gb'));
48 $ast->verbose($verbose);
50 is $as->molecule, 'PRT',$as->accession_number;
51 is $as->alphabet, 'protein';
52 is $as->division, 'VRT';
53 is join(',',$as->get_dates), '11-APR-2002';
54 # Though older GenBank releases indicate SOURCE contains only the common name,
55 # this is no longer true. In general, this line will contain an abbreviated
56 # form of the full organism name (but may contain the full length name),
57 # as well as the optional common name and organelle. There is no get/set
58 # for the abbreviated name but it is accessible via name()
59 ok defined($as->species->name('abbreviated')->[0]);
60 is $as->species->name('abbreviated')->[0], 'Aldabra giant tortoise';
61 is($as->primary_id, 15824047);
62 my $ac = $as->annotation;
64 my @dblinks = $ac->get_Annotations('dblink');
65 is(scalar @dblinks,1);
66 is($dblinks[0]->database, 'GenBank');
67 is($dblinks[0]->primary_id, 'AB072353');
68 is($dblinks[0]->version, '1');
69 is($dblinks[0]->display_text, 'GenBank:AB072353.1','operator overloading in AnnotationI is deprecated');
71 # test for multi-line SOURCE
72 $ast = Bio::SeqIO->new(-format => 'genbank',
74 -file => test_input_file('NC_006346.gb'));
76 is $as->species->binomial('FULL'), 'Bolitoglossa n. sp. RLM-2004',$as->accession_number;;
77 @class = $as->species->classification;
78 is($class[$#class],'Eukaryota');
79 is($as->species->common_name,'mushroomtongue salamander');
81 $ast = Bio::SeqIO->new(-format => 'genbank',
83 -file => test_input_file('U71225.gb'));
85 @class = $as->species->classification;
86 is($class[$#class],'Eukaryota',$as->accession_number);
87 is $as->species->common_name,'black-bellied salamander';
89 # test for unusual common name
90 $ast = Bio::SeqIO->new(-format => 'genbank',
92 -file => test_input_file('AB077698.gb'));
94 # again, this is not a common name but is in name('abbreviated')
95 ok defined($as->species->name('abbreviated')->[0]),$as->accession_number;
96 is $as->species->name('abbreviated')->[0],'Homo sapiens cDNA to mRNA';
98 # test for common name with parentheses
99 $ast = Bio::SeqIO->new(-format => 'genbank',
100 -verbose => $verbose,
101 -file => test_input_file('DQ018368.gb'));
102 $as = $ast->next_seq;
103 is $as->species->scientific_name,'(Populus tomentosa x P. bolleana) x P. tomentosa var. truncata',
104 $as->accession_number;;
106 # test secondary accessions
107 my $seqio = Bio::SeqIO->new(-format => 'genbank',
108 -verbose => $verbose,
109 -file => test_input_file('D10483.gbk'));
110 my $seq = $seqio->next_seq;
111 my @kw = $seq->get_keywords;
112 is(scalar @kw, 118, $seq->accession_number);
114 my @sec_acc = $seq->get_secondary_accessions;
115 is(scalar @sec_acc,14);
116 is($sec_acc[-1], 'X56742');
119 my $str = Bio::SeqIO->new(-verbose => $verbose,
120 -file => test_input_file('D12555.gbk'));
122 $seq = $str->next_seq;
125 ok(! $@, 'bug 1487');
127 # bug 1647 rpt_unit sub-feature with multiple parens
128 $str = Bio::SeqIO->new(-format => 'genbank',
129 -verbose => $verbose,
130 -file => test_input_file('mini-AE001405.gb'));
131 ok($seq = $str->next_seq);
132 my @rpts = grep { $_->primary_tag eq 'repeat_region' }
133 $seq->get_SeqFeatures;
134 is $#rpts, 2, 'bug 1647';
135 my @rpt_units = grep {$_->has_tag('rpt_unit')} @rpts;
137 is(($rpt_units[0]->get_tag_values('rpt_unit'))[0],'(TG)10;A;(TG)7');
139 # test bug #1673 , RDB-II genbank files
140 $str = Bio::SeqIO->new(-format => 'genbank',
141 -verbose => $verbose,
142 -file => test_input_file('Mcjanrna_rdbII.gbk')
144 ok($seq = $str->next_seq, 'bug 1673');
145 my @refs = $seq->annotation->get_Annotations('reference');
147 is($seq->display_id,'Mc.janrrnA');
148 is($seq->molecule ,'RNA');
149 is $as->division, 'PLN';
150 is join(',',$as->get_dates), '23-MAY-2005';
152 $str = Bio::SeqIO->new(-format => 'genbank',
153 -file => test_input_file('AF165282.gb'),
154 -verbose => $verbose);
155 $seq = $str->next_seq;
156 my @features = $seq->all_SeqFeatures;
157 is(@features, 5, $seq->accession_number);
158 is($features[0]->start, 1);
159 is($features[0]->end, 226);
160 my $location = $features[1]->location;
161 ok($location->isa('Bio::Location::SplitLocationI'));
162 my @sublocs = $location->sub_Location;
165 # version and primary ID - believe it or not, this wasn't working
166 is ($seq->version, 1);
167 is ($seq->seq_version, 1);
168 is ($seq->primary_id, "5734104");
170 # streaming and Bio::RichSeq creation
171 my $stream = Bio::SeqIO->new(-file => test_input_file('test.genbank'),
172 -verbose => $verbose,
173 -format => 'genbank');
174 $stream->verbose($verbose);
179 my @ids = qw(DDU63596 DDU63595 HUMBDNF);
180 my @tids = (44689, 44689, 9606);
181 my @tnames = ("Dictyostelium discoideum",
182 "Dictyostelium discoideum",
184 while($seq = $stream->next_seq) {
186 is $seq->display_id, $ids[$seqnum];
187 $species = $seq->species;
188 @cl = $species->classification;
189 is( $species->binomial, $tnames[$seqnum],
190 'species parsing incorrect for genbank');
191 is( $cl[3] ne $species->genus, 1,
192 'genus duplicated in genbank parsing');
193 is( $species->ncbi_taxid, $tids[$seqnum] );
198 is($seqnum, 5,'streaming');
199 is $lasts->display_id, "HUMBETGLOA";
200 my ($ref) = $lasts->annotation->get_Annotations('reference');
201 is($ref->medline, 94173918);
204 $stream = Bio::SeqIO->new(-file => test_input_file('test.genbank.noseq'),
205 -verbose => $verbose,
206 -format => 'genbank' );
208 while($seq = $stream->next_seq) {
210 is $seq->display_id, $ids[$seqnum];
212 elsif( $seq->display_id eq 'M37762') {
213 is( ($seq->get_keywords)[0], 'neurotrophic factor');
217 is $seqnum, 5, "Total number of sequences in test file";
220 $seq = Bio::SeqIO->new( -file => test_input_file('testfuzzy.genbank'),
221 -format => 'genbank',
222 -verbose => $verbose );
223 ok(defined($as = $seq->next_seq));
225 @features = $as->all_SeqFeatures;
226 is(@features,21,'Fuzzy in');
227 my $lastfeature = pop @features;
228 # this is a split location; the root doesn't have strand
229 is($lastfeature->strand, undef);
230 $location = $lastfeature->location;
231 #$location->verbose(-1); # silence the warning of undef seq_id()
232 # see above; splitlocs roots do not have a strand really
233 is($location->strand, undef);
234 is($location->start, 83202);
235 is($location->end, 84996);
237 @sublocs = $location->sub_Location;
240 my $loc = shift @sublocs;
241 is($loc->start, 83202);
242 is($loc->end, 83329);
243 is($loc->strand, -1);
245 $loc = shift @sublocs;
246 is($loc->start, 84248);
247 is($loc->end, 84996);
250 $seq = Bio::SeqIO->new(-format => 'genbank',
251 -verbose => $verbose,
252 -file => ">" .test_output_file);
253 $seq->verbose($verbose);
254 ok($seq->write_seq($as),'Fuzzy out');
257 $str = Bio::SeqIO->new(-format => 'genbank',
258 -verbose => $verbose,
259 -file => test_input_file('BK000016-tpa.gbk'));
260 $seq = $str->next_seq;
261 ok(defined $seq, $seq->accession_number);
262 ok(defined $seq->seq);
263 is($seq->accession_number, 'BK000016',$seq->accession_number);
264 is($seq->alphabet, 'dna');
265 is($seq->display_id, 'BK000016');
266 is($seq->length, 1162);
267 is($seq->division, 'ROD');
268 is($seq->get_dates, 1);
269 is($seq->keywords, 'Third Party Annotation; TPA');
270 is($seq->desc, 'TPA: Mus musculus pantothenate kinase 4 mRNA, partial cds.');
271 is($seq->seq_version, 1);
272 is($seq->feature_count, 2);
273 my $spec_obj = $seq->species;
274 is ($spec_obj->common_name, 'house mouse');
275 is ($spec_obj->species, 'musculus');
276 is ($spec_obj->genus, 'Mus');
277 is ($spec_obj->binomial, 'Mus musculus');
278 $ac = $seq->annotation;
279 my $reference = ($ac->get_Annotations('reference') )[0];
280 is ($reference->pubmed, '11479594');
281 is ($reference->medline, '21372465',$seq->accession_number);
283 # validate that what is written is what is read
284 my $testfile = test_output_file;
285 my $out = Bio::SeqIO->new(-file => ">$testfile",
286 -format => 'genbank');
287 $out->write_seq($seq);
290 $str = Bio::SeqIO->new(-format => 'genbank',
292 $seq = $str->next_seq;
293 ok(defined $seq,'roundtrip');
294 ok(defined $seq->seq);
295 is($seq->accession_number, 'BK000016');
296 is($seq->alphabet, 'dna');
297 is($seq->display_id, 'BK000016');
298 is($seq->length, 1162);
299 is($seq->division, 'ROD');
300 is($seq->get_dates, 1);
301 is($seq->keywords, 'Third Party Annotation; TPA');
302 is($seq->desc, 'TPA: Mus musculus pantothenate kinase 4 mRNA, partial cds.');
303 is($seq->seq_version, 1);
304 is($seq->feature_count, 2);
305 $spec_obj = $seq->species;
306 is ($spec_obj->common_name, 'house mouse');
307 is ($spec_obj->species, 'musculus');
308 is ($spec_obj->genus, 'Mus');
309 is ($spec_obj->binomial, 'Mus musculus');
310 $ac = $seq->annotation;
311 $reference = ($ac->get_Annotations('reference') )[0];
312 is ($reference->pubmed, '11479594');
313 is ($reference->medline, '21372465');
315 # write revcomp split location
316 my $gb = Bio::SeqIO->new(-format => 'genbank',
317 # This sequence has an odd LOCUS line which sets off a warning, setting
319 # The newest Ensembl seq lacks this. Maybe update? cjfields 6-5-07
320 -verbose => $verbose ? $verbose : -1,
321 -file => test_input_file('revcomp_mrna.gb'));
322 $seq = $gb->next_seq;
324 $gb = Bio::SeqIO->new(-format => 'genbank',
325 -file => ">$testfile");
327 $gb->write_seq($seq);
329 ok(! -z $testfile, 'revcomp split location');
331 # bug 1925, continuation of long ORGANISM line ends up in @classification:
332 # ORGANISM Salmonella enterica subsp. enterica serovar Paratyphi A str. ATCC
334 # Bacteria; Proteobacteria; Gammaproteobacteria; Enterobacteriales;
335 # Enterobacteriaceae; Salmonella.
336 $gb = Bio::SeqIO->new(-format => 'genbank',
337 -verbose => $verbose,
338 -file => test_input_file('NC_006511-short.gbk'));
339 $seq = $gb->next_seq;
340 is $seq->species->common_name, undef, "Bug 1925";
341 is $seq->species->scientific_name, "Salmonella enterica subsp. enterica serovar Paratyphi A str. ATCC 9150";
342 @class = $seq->species->classification;
343 is $class[$#class], "Bacteria";
346 $gb = Bio::SeqIO->new(-format => 'genbank',
347 -verbose => $verbose,
348 -file => test_input_file('O_sat.wgs'));
349 $seq = $gb->next_seq;
351 my @tests = ('wgs' => 'AAAA02000001-AAAA02050231',
352 'wgs_scafld' => 'CM000126-CM000137',
353 'wgs_scafld' => 'CH398081-CH401163');
355 my @wgs = map {$seq->annotation->get_Annotations(lc($_))} qw(WGS WGS_SCAFLD);
360 my ($tagname, $value) = (shift @tests, shift @tests);
361 is($wgs->tagname, $tagname, $tagname);
362 is($wgs->value, $value);
368 # make sure we can retrieve a feature with a primary tag of 'misc_difference'
369 $gb = Bio::SeqIO->new(-format => 'genbank',
370 -verbose => $verbose,
371 -file => test_input_file('BC000007.gbk'));
372 $seq = $gb->next_seq;
373 ($cds) = grep { $_->primary_tag eq 'misc_difference' } $seq->get_SeqFeatures;
374 my @vals = $cds->get_tag_values('gene');
375 is $vals[0], 'PX19', $seq->accession_number;
377 # Check that the source,organism section is identical between input and output.
378 # - test an easy one where organism is species, then two different formats of
379 # subspecies, then a species with a format that used to be mistaken for
380 # subspecies, then a bacteria with no genus, and finally a virus with a genus.
382 # These tests are now somewhat out-of-date since we are moving to a Bio::Taxon-
383 # based system for verifying taxonomic information. Right now they just verify
384 # changes so are really useless; I will change them to verify common name,
385 # organelle, scientific name, etc.
387 my $outfile = test_output_file;
389 # output always adds a period (GenBank std), but two of these files do not use them.
391 foreach my $in ('BK000016-tpa.gbk', 'ay116458.gb', 'ay149291.gb', 'NC_006346.gb', 'ay007676.gb', 'dq519393.gb') {
392 my $infile = test_input_file($in);
394 $str = Bio::SeqIO->new(-format => 'genbank',
395 -verbose => $verbose,
397 $seq = $str->next_seq;
399 $out = Bio::SeqIO->new(-file => ">$outfile",
400 -format => 'genbank');
401 $out->write_seq($seq);
404 open my $IN, '<', $infile or die "Could not read file '$infile': $!\n";
408 open my $RESULT, '<', $outfile or die "Could not read file '$outfile': $!\n";
414 while (my $result = <$RESULT>) {
415 if ($result =~ /^KEYWORDS/) {
420 if ($result =~ /^REFERENCE/) {
425 # end periods don't count (not all input files have them)
427 $in[$line] =~ s{\.$}{};
429 if ($result ne $in[$line]) {
443 # NB: there should probably be full testing on all lines to ensure that output
446 # 20061117: problem with *double* colon in some annotation-dblink values
449 foreach my $in ('P35527.gb') {
450 my $infile = test_input_file($in);
451 $str = Bio::SeqIO->new(-format => 'genbank',
452 -verbose => $verbose,
454 $seq = $str->next_seq;
456 my $ac = $seq->annotation; # Bio::AnnotationCollection
457 foreach my $key ($ac->get_all_annotation_keys ) {
458 my @values = $ac->get_Annotations($key);
459 foreach my $ann (@values) {
460 my $value = $ann->display_text;
462 if ($key eq 'dblink') {
463 ok (index($value,'::') < 0); # this should never be true
464 ok ($value, $value); # check value is not empty
466 # print " ann/", sprintf('%12s ',$key), '>>>', $value , '<<<', "\n";
467 # print " index double colon: ",index($value ,'::'), "\n";
470 my @parts = split(/:/,$value);
471 if ( $parts[0] =~ /^(?:
472 # not an exhaustive list of databases;
473 # just the db's referenced in P35527.gb:
474 swissprot | GenBank | GenPept | HSSP | IntAct | Ensembl | KEGG
475 | HGNC | MIM | ArrayExpress | GO | InterPro | Pfam | PRINTS
483 ok ( $parts[1], "$parts[0]" );
493 $str = Bio::SeqIO->new(-format => 'genbank',
494 -verbose => $verbose,
495 -file => test_input_file('AF305198.gb')
498 $species = $str->next_seq->species;
500 is($species->scientific_name, 'Virginia creeper phytoplasma', 'Bug 2195');
501 is(join(', ',$species->classification),
502 'Virginia creeper phytoplasma, 16SrV (Elm yellows group), '
503 . 'Candidatus Phytoplasma, Acholeplasmataceae, Acholeplasmatales, '
504 . 'Mollicutes, Firmicutes, Bacteria',
507 # bug 2569, PROJECT line support, read and write, round-tripping
509 $str = Bio::SeqIO->new(-format => 'genbank',
510 -verbose => $verbose,
511 -file => test_input_file('NC_008536.gb'));
512 $seq = $str->next_seq;
514 my $project = ($seq->annotation->get_Annotations('project'))[0];
515 isa_ok($project, 'Bio::Annotation::SimpleValue');
518 is($project->value, 'GenomeProject:12638');
521 ok(0, "PROJECT not parsed");
524 $outfile = test_output_file;
525 $gb = Bio::SeqIO->new(-format => 'genbank',
526 -verbose => $verbose,
527 -file => ">$outfile");
528 $gb->write_seq($seq);
530 $str = Bio::SeqIO->new(-format => 'genbank',
531 -verbose => $verbose,
533 $seq = $str->next_seq;
535 $project = ($seq->annotation->get_Annotations('project'))[0];
536 isa_ok($project, 'Bio::Annotation::SimpleValue');
539 is($project->value, 'GenomeProject:12638');
542 ok(0, "Roundtrip test failed");
545 # test for swissprot/UniProt/UniProtKB DBSOURCE line (Bug : RT 44536)
546 $ast = Bio::SeqIO->new(-format => 'genbank',
547 -verbose => $verbose,
548 -file => test_input_file('P39765.gb'));
549 $as = $ast->next_seq;
550 is $as->molecule, 'PRT',$as->accession_number;
551 is $as->division, 'BCT',$as->accession_number;
552 is join(',',$as->get_dates), '03-MAR-2009',$as->accession_number;
553 is $as->alphabet, 'protein';
554 # Though older GenBank releases indicate SOURCE contains only the common name,
555 # this is no longer true. In general, this line will contain an abbreviated
556 # form of the full organism name (but may contain the full length name),
557 # as well as the optional common name and organelle. There is no get/set
558 # for the abbreviated name but it is accessible via name()
559 ok defined($as->species->name('abbreviated')->[0]);
560 is $as->species->name('abbreviated')->[0], 'Bacillus subtilis';
561 is($as->primary_id, 20141743);
562 $ac = $as->annotation;
564 @dblinks = $ac->get_Annotations('dblink');
565 is(scalar @dblinks,31);
566 is($dblinks[0]->database, 'UniProtKB');
567 is($dblinks[0]->primary_id, 'PYRR_BACSU');
568 is($dblinks[0]->version, undef);
569 is($dblinks[0]->display_text, 'UniProtKB:PYRR_BACSU','operator overloading in AnnotationI is deprecated');
571 #bug 2982 embl/genbank contig handling
573 $ast = Bio::SeqIO->new( -file => test_input_file('bug2982.gb'),
574 -format => 'genbank' );
575 $seq = $ast->next_seq;
577 ok my @ctg = $seq->annotation->get_Annotations('contig');
578 like $ctg[0]->value, qr/join\(.*?gap.*?complement/;
580 # write_seq() and FTHelper duplicate specific tags, need to check a round-trip
581 $ast = Bio::SeqIO->new(-format => 'genbank' ,
582 -verbose => $verbose,
583 -file => test_input_file('singlescore.gbk'));
584 $as = $ast->next_seq;
585 ($cds) = grep { $_->primary_tag eq 'CDS' } $as->get_SeqFeatures;
586 my @notes = $cds->get_tag_values('note');
587 is(scalar @notes, 2);
588 $testfile = test_output_file;
589 $out = Bio::SeqIO->new(-file => ">$testfile",
590 -format => 'genbank');
591 $out->write_seq($as);
593 $ast = Bio::SeqIO->new(-format => 'genbank' ,
594 -verbose => $verbose,
595 -file => $testfile );
596 $as = $ast->next_seq;
597 ($cds) = grep { $_->primary_tag eq 'CDS' } $as->get_SeqFeatures;
598 @notes = $cds->get_tag_values('note');
599 is(scalar @notes, 2);
603 my $in = Bio::SeqIO->new(-format => 'genbank',
604 -file => test_input_file('NC_002058_multDBLINK_bug3375.gb'));
605 $seq = $in->next_seq; # should not throw a warning now
606 @dblinks = $seq->annotation->get_Annotations('dblink'); # contains 5 dblink references
607 # testing DBLINK BioProject: PRJNA15288
608 is($dblinks[0]->database, 'BioProject', 'bug3375 database is BioProject');
609 is($dblinks[0]->primary_id, 'PRJNA15288', 'bug3375 primary_id is PRJNA15288');
610 # testing DBLINK Project:100,200,300
611 is($dblinks[3]->database, 'Project');
612 is($dblinks[3]->primary_id, '300');
613 # testing DBLINK NC_002058.3
614 is($dblinks[4]->database, 'GenBank');
615 is($dblinks[4]->primary_id, 'NC_002058');
616 is($dblinks[4]->version, '3');
618 # long labels handled
620 # Create sequence with feature with a long label qualifier
621 my $seq=Bio::Seq->new(-seq => 'actg',
623 my $feature=Bio::SeqFeature::Generic->new(-primary=>'CDS', -start=>1, -end=>4);
624 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';
625 $feature->add_tag_value(label => $label);
626 $seq->add_SeqFeature($feature);
630 open my $str_fh, '>', \$string or skip("Could not write string, skipping", 2);
631 my $out = Bio::SeqIO->new(-format => 'genbank',
633 $out->write_seq($seq);
636 my $in = Bio::SeqIO->new(-format => 'genbank',
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');
645 $in = Bio::SeqIO->new(-format => 'genbank',
646 -file => test_input_file('YP_007988852.gp'),
647 -verbose => $verbose);
648 $seq = $in->next_seq; # should not throw a warning now
649 is($seq->length, 205);
651 my @anns = $seq->annotation->get_Annotations('contig');
653 isa_ok($anns[0], 'Bio::Annotation::SimpleValue');
654 is($anns[0]->value, 'join(WP_015639704.1:1..205)');
656 is($seq->seq, 'MENRKFGYIRVSSKDQNEGRQLEAMRKIGITERDIYLDKQSGKNFERANYQLLKRIIRKGDI'
657 . 'LYIHSLDRFGRNKEEILQEWNDLTKNIEADIVVLDMPLLDTTQYKDSMGTFIADLVLQILSWMAEEERERIRK'
658 . 'RQREGIDLALQNGIQFGRSPVVVSDEFKEVYRKWKAKELTAVEAMQEAGVKKTSFYKLVKAHENSIKVNS');
660 # Genbank files with CONTIG and sequence should print the sequence with write_seq()
661 $testfile = test_output_file;
662 $out = Bio::SeqIO->new(-file => ">$testfile",
663 -format => 'genbank');
664 $out->write_seq($seq);
667 $in = Bio::SeqIO->new(-file => $testfile,
668 -format => 'genbank',
669 -verbose => $verbose);
670 $seq = $in->next_seq;
671 is($seq->length, 205);
673 @anns = $seq->annotation->get_Annotations('contig');
675 isa_ok($anns[0], 'Bio::Annotation::SimpleValue');
676 is($anns[0]->value, 'join(WP_015639704.1:1..205)');
678 is($seq->seq, 'MENRKFGYIRVSSKDQNEGRQLEAMRKIGITERDIYLDKQSGKNFERANYQLLKRIIRKGDI'
679 . 'LYIHSLDRFGRNKEEILQEWNDLTKNIEADIVVLDMPLLDTTQYKDSMGTFIADLVLQILSWMAEEERERIRK'
680 . 'RQREGIDLALQNGIQFGRSPVVVSDEFKEVYRKWKAKELTAVEAMQEAGVKKTSFYKLVKAHENSIKVNS');
682 $seq = Bio::SeqIO->new(-format => 'genbank',
683 -file => test_input_file('YP_007988852.gp') )->next_seq;
684 @features = $seq->remove_SeqFeatures;
685 is $#features, 10, 'Got 11 features';
687 $seq = Bio::SeqIO->new(-format => 'genbank',
688 -file => test_input_file('YP_007988852.gp') )->next_seq;
689 @features = $seq->remove_SeqFeatures('CDS');
690 is $#features, 0, 'Got 1 feature';
691 is $features[0]->primary_tag, 'CDS', 'Correct primary tag for feature';
692 @features = $seq->remove_SeqFeatures;
693 is $#features, 9, 'Got 10 features';
695 # Handle Structured Comments in COMMENT section
696 $seq = Bio::SeqIO->new(-format => 'genbank',
697 -file => test_input_file('KF527485.gbk') )->next_seq;
698 my $comment = ($seq->get_Annotations('comment') )[0];
699 is($comment->as_text, "Comment:
700 ##Assembly-Data-START##
701 Assembly Method :: Lasergene v. 10
702 Sequencing Technology :: ABI37XL; Sanger dideoxy sequencing
703 ##Assembly-Data-END##",
704 "Got correct Structured Comment");
706 $seq = Bio::SeqIO->new(-format => 'genbank',
707 -file => test_input_file('HM138502.gbk') )->next_seq;
708 $comment = ($seq->get_Annotations('comment') )[0];
709 ok( $comment->as_text
710 =~ /^Comment: Swine influenza A \(H1N1\) virus isolated during human swine flu outbreak of 2009/,
711 "Got correct Structured Comment"
713 ok( $comment->as_text =~ /^##GISAID_EpiFlu\(TM\)Data-START##/m,
714 "Got correct Structured Comment" );
715 ok( $comment->as_text =~ /^Subtype :: H1N1/m,
716 "Got correct Structured Comment"
718 ok( $comment->as_text =~ /^##GISAID_EpiFlu\(TM\)Data-END##/m,
719 "Got correct Structured Comment" );