BioPerl
view release on metacpan or search on metacpan
t/SeqIO/genbank.t view on Meta::CPAN
my $seq = $seqio->next_seq;
my @kw = $seq->get_keywords;
is(scalar @kw, 118, $seq->accession_number);
is($kw[-1], 'yabO');
my @sec_acc = $seq->get_secondary_accessions;
is(scalar @sec_acc,14);
is($sec_acc[-1], 'X56742');
# bug #1487
my $str = Bio::SeqIO->new(-verbose => $verbose,
-file => test_input_file('D12555.gbk'));
eval {
$seq = $str->next_seq;
};
ok(! $@, 'bug 1487');
# bug 1647 rpt_unit sub-feature with multiple parens
$str = Bio::SeqIO->new(-format => 'genbank',
-verbose => $verbose,
-file => test_input_file('mini-AE001405.gb'));
ok($seq = $str->next_seq);
my @rpts = grep { $_->primary_tag eq 'repeat_region' }
$seq->get_SeqFeatures;
is $#rpts, 2, 'bug 1647';
my @rpt_units = grep {$_->has_tag('rpt_unit')} @rpts;
is $#rpt_units, 0;
is(($rpt_units[0]->get_tag_values('rpt_unit'))[0],'(TG)10;A;(TG)7');
# test bug #1673 , RDB-II genbank files
$str = Bio::SeqIO->new(-format => 'genbank',
-verbose => $verbose,
-file => test_input_file('Mcjanrna_rdbII.gbk')
);
ok($seq = $str->next_seq, 'bug 1673');
my @refs = $seq->annotation->get_Annotations('reference');
is(@refs, 1);
is($seq->display_id,'Mc.janrrnA');
is($seq->molecule ,'RNA');
is $as->division, 'PLN';
is join(',',$as->get_dates), '23-MAY-2005';
$str = Bio::SeqIO->new(-format => 'genbank',
-file => test_input_file('AF165282.gb'),
-verbose => $verbose);
$seq = $str->next_seq;
my @features = $seq->all_SeqFeatures;
is(@features, 5, $seq->accession_number);
is($features[0]->start, 1);
is($features[0]->end, 226);
my $location = $features[1]->location;
ok($location->isa('Bio::Location::SplitLocationI'));
my @sublocs = $location->sub_Location;
is(@sublocs, 29);
# version and primary ID - believe it or not, this wasn't working
is ($seq->version, 1);
is ($seq->seq_version, 1);
is ($seq->primary_id, "5734104");
# streaming and Bio::RichSeq creation
my $stream = Bio::SeqIO->new(-file => test_input_file('test.genbank'),
-verbose => $verbose,
-format => 'genbank');
$stream->verbose($verbose);
my $seqnum = 0;
my $species;
my @cl;
my $lasts;
my @ids = qw(DDU63596 DDU63595 HUMBDNF);
my @tids = (44689, 44689, 9606);
my @tnames = ("Dictyostelium discoideum",
"Dictyostelium discoideum",
"Homo sapiens");
while($seq = $stream->next_seq) {
if($seqnum < 3) {
is $seq->display_id, $ids[$seqnum];
$species = $seq->species;
@cl = $species->classification;
is( $species->binomial, $tnames[$seqnum],
'species parsing incorrect for genbank');
is( $cl[3] ne $species->genus, 1,
'genus duplicated in genbank parsing');
is( $species->ncbi_taxid, $tids[$seqnum] );
}
$seqnum++;
$lasts = $seq;
}
is($seqnum, 5,'streaming');
is $lasts->display_id, "HUMBETGLOA";
my ($ref) = $lasts->annotation->get_Annotations('reference');
is($ref->medline, 94173918);
$stream->close;
$stream = Bio::SeqIO->new(-file => test_input_file('test.genbank.noseq'),
-verbose => $verbose,
-format => 'genbank' );
$seqnum = 0;
while($seq = $stream->next_seq) {
if($seqnum < 3) {
is $seq->display_id, $ids[$seqnum];
}
elsif( $seq->display_id eq 'M37762') {
is( ($seq->get_keywords)[0], 'neurotrophic factor');
}
$seqnum++;
}
is $seqnum, 5, "Total number of sequences in test file";
# fuzzy
$seq = Bio::SeqIO->new( -file => test_input_file('testfuzzy.genbank'),
-format => 'genbank',
-verbose => $verbose );
ok(defined($as = $seq->next_seq));
@features = $as->all_SeqFeatures;
is(@features,21,'Fuzzy in');
my $lastfeature = pop @features;
# this is a split location; the root doesn't have strand
is($lastfeature->strand, undef);
$location = $lastfeature->location;
#$location->verbose(-1); # silence the warning of undef seq_id()
# see above; splitlocs roots do not have a strand really
is($location->strand, undef);
is($location->start, 83202);
is($location->end, 84996);
@sublocs = $location->sub_Location;
is(@sublocs, 2);
my $loc = shift @sublocs;
is($loc->start, 83202);
is($loc->end, 83329);
is($loc->strand, -1);
$loc = shift @sublocs;
is($loc->start, 84248);
is($loc->end, 84996);
is($loc->strand,1);
$seq = Bio::SeqIO->new(-format => 'genbank',
-verbose => $verbose,
-file => ">" .test_output_file);
$seq->verbose($verbose);
ok($seq->write_seq($as),'Fuzzy out');
## now genbank ##
$str = Bio::SeqIO->new(-format => 'genbank',
-verbose => $verbose,
( run in 0.950 second using v1.01-cache-2.11-cpan-ceb78f64989 )