1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 21,
11 -requires_modules => [qw(IO::String
13 HTTP::Request::Common)],
14 -requires_networking => 1);
16 use_ok('Bio::DB::GenPept');
19 my %expected_lengths = (
26 my ($gb, $seq, $seqio);
31 ok $gb = Bio::DB::GenPept->new();
33 eval {$seqio = $gb->get_seq_stream(-uids => [2981015, 1621261, 195055], -mode => 'batch');};
34 skip "Couldn't connect to complete GenPept tests. Skipping those tests", 8 if $@;
35 my %result = ('AAC06201' => 353, 'CAB02640' => 193, 'AAD15290' => 136);
37 while ($seq = $seqio->next_seq) {
39 my $acc = $seq->accession;
40 ok exists $result{ $acc };
41 is $seq->length, $result{ $acc };
44 skip('No seqs returned', 8) if !$ct;
49 $seq = $seqio = undef;
51 ok $gb = Bio::DB::GenPept->new('-delay' => 0);
53 eval {$seq = $gb->get_Seq_by_id('195055');};
54 skip "Couldn't connect to Genbank with Bio::DB::GenPept.pm. Skipping those tests", 10 if $@;
55 is $seq->length, $expected_lengths{$seq->display_id}, $seq->display_id;
56 eval {$seq = $gb->get_Seq_by_acc('AAC06201');};
57 skip "Couldn't connect to Genbank with Bio::DB::GenPept.pm. Skipping those tests", 9 if $@;
58 is $seq->length, $expected_lengths{$seq->display_id}, $seq->display_id;
59 eval {$seqio = $gb->get_Stream_by_id([qw(AAC06201 195055)]);};
60 skip "Couldn't connect to Genbank with Bio::DB::GenPept.pm. Skipping those tests", 8 if $@;
62 while( my $s = $seqio->next_seq ) {
63 is $s->length, $expected_lengths{$s->display_id}, $s->display_id;
66 skip('No seqs returned', 8) if !$done;
68 # swissprot genpept parsing
69 eval {$seq = $gb->get_Seq_by_acc('P31383');};
70 skip "Couldn't connect to Genbank with Bio::DB::GenPept.pm. Skipping those tests", 5 if $@;
71 is $seq->length, $expected_lengths{$seq->display_id}, $seq->display_id;
74 # small chance this might change but hopefully not
75 my @annot = $seq->annotation->get_Annotations('dblink');
76 cmp_ok(scalar(@annot), '>', 31);
77 is $annot[0]->database, 'UniProtKB';
78 is $annot[0]->primary_id, '2AAA_YEAST';
79 is (($seq->annotation->get_Annotations('swissprot_dates'))[0]->value, 'Jul 1, 1993');