Simplify Contact info section
[bioperl-live.git] / t / RemoteDB / EMBL.t
blob7f196f2c20875104a8e80cead5fd5c11b5d52c73
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN { 
7     use lib '.';
8     use Bio::Root::Test;
10     test_begin(-tests => 16,
11                -requires_modules    => [qw(IO::String
12                                            LWP::UserAgent
13                                            HTTP::Request::Common)],
14                -requires_networking => 1);
16     use_ok('Bio::DB::EMBL');
19 my $verbose = test_debug();
21 my ($db,$seq,$seqio);
22 # get a single seq
24 $seq = $seqio = undef;
26 SKIP: { 
27     ok defined($db = Bio::DB::EMBL->new(-verbose=>$verbose)); 
28     ok(defined($seq = $db->get_Seq_by_acc('J00522')));
29     is( $seq->length, 408); 
30     ok defined ($db->request_format('fasta'));
31         
32     eval {ok(defined($seq = $db->get_Seq_by_acc('J02231')))};
33         skip('could not connect to embl',2) if $@;
34     like( $seq->id, qr/J02231/);
35     is( $seq->length, 200); 
36     ok( defined($db = Bio::DB::EMBL->new(-verbose=>$verbose, 
37                                         -retrievaltype => 'tempfile')));
38     eval {ok(defined($seqio = $db->get_Stream_by_id(['AEE33958'])))};
39         skip('could not connect to embl',2) if $@;
40     undef $db; # testing to see if we can remove gb
41     ok( defined($seq = $seqio->next_seq()));
42     cmp_ok( $seq->length, '>=', 1);
45 $seq = $seqio = undef;
47 SKIP: {
48     $db = Bio::DB::EMBL->new(-verbose => $verbose,
49                             -retrievaltype => 'tempfile',
50                             -format => 'fasta'
51                             ); 
52     eval{ok( defined($seqio = $db->get_Stream_by_acc(['J00522 AF303112 J02231'])))};
53         skip('could not connect to embl',3) if $@;
54     my %seqs;
55     # don't assume anything about the order of the sequences
56     while ( my $s = $seqio->next_seq ) {
57                 my ($type,$x,$name) = split(/\|/,$s->display_id);
58                 $seqs{$x} = $s->length;
59     }
60     is($seqs{'J00522'},408);
61     is($seqs{'AF303112'},1611);
62     is($seqs{'J02231'},200);