1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 23,
11 -requires_modules => [qw(IO::String
13 HTTP::Request::Common)],
14 -requires_networking => 1);
16 use_ok('Bio::DB::SwissProt');
19 ok my $gb = Bio::DB::SwissProt->new(-retrievaltype => 'pipeline',
22 my %expected_lengths = (
35 eval {$seq = $gb->get_Seq_by_id('YNB3_YEAST');};
36 skip "Couldn't connect to SwissProt with Bio::DB::SwissProt.pm. Skipping those tests", 14 if $@;
37 is $seq->length, $expected_lengths{$seq->display_id}, $seq->display_id;
38 is $seq->division, 'YEAST';
40 eval {$seq = $gb->get_Seq_by_acc('P43780');};
41 skip "Couldn't connect to SwissProt with Bio::DB::SwissProt.pm. Skipping those tests", 12 if $@;
42 is $seq->length, $expected_lengths{$seq->display_id}, $seq->display_id;
43 eval {$seq = $gb->get_Seq_by_acc('O39869');};
44 skip "Couldn't connect to SwissProt with Bio::DB::SwissProt.pm. Skipping those tests", 11 if $@;
45 is $seq->length, $expected_lengths{$seq->accession_number}, $seq->accession_number;
46 is $seq->accession_number, 'O39869';
47 is $seq->division, '9PICO';
50 eval {$seq = $gb->get_Seq_by_id('P18584');};
51 skip "Couldn't connect to SwissProt with Bio::DB::SwissProt.pm. Skipping those tests", 8 if $@;
52 ok exists $expected_lengths{$seq->display_id}, 'P18584';
53 is $seq->length, $expected_lengths{$seq->display_id}, $seq->display_id;
54 is $seq->division, 'CHLTR';
56 ok $gb = Bio::DB::SwissProt->new('-retrievaltype' => 'tempfile', '-delay' => 0);
57 eval {$seqio = $gb->get_Stream_by_id(['NDP_MOUSE', 'NDP_HUMAN']);};
58 skip "Couldn't connect to SwissProt with Bio::DB::SwissProt.pm. Skipping those tests", 4 if $@;
59 undef $gb; # testing to see if we can remove gb
60 ok $seq = $seqio->next_seq();
61 is $seq->length, $expected_lengths{$seq->display_id}, $seq->display_id;
62 ok $seq = $seqio->next_seq();
63 is $seq->length, $expected_lengths{$seq->display_id}, $seq->display_id;
66 # test idtracker() method
67 ok $gb = Bio::DB::SwissProt->new(-retrievaltype => 'pipeline',
74 eval {$map = $gb->id_mapper(-from => 'ACC+ID',
76 -ids => [qw(MYOD1_PIG PYRC_YEAST)]
78 skip("Problem with idtracker(), skipping these tests: $@", 6) if $@;
80 cmp_ok(@{$map->{MYOD1_PIG}}, '>=', 1);
81 is($map->{MYOD1_PIG}[0], 'P49811');
82 cmp_ok(@{$map->{PYRC_YEAST}}, '>=', 1);
83 is($map->{PYRC_YEAST}[0], 'P20051');
85 eval {$map = $gb->id_mapper(-from => 'ACC+ID',
87 -ids => [qw(PYRC_YEAST)]
89 skip("Problem with idtracker(), skipping these tests: $@", 2) if $@;
91 cmp_ok(@{$map->{PYRC_YEAST}}, '>=', 2);
92 like($map->{PYRC_YEAST}[0], qr/^[A-Z0-9]/);