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