1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 16,
11 -requires_modules => [qw(IO::String LWP LWP::UserAgent)],
12 -requires_networking => 1);
14 use_ok('Bio::Tools::Run::RemoteBlast');
21 my $remote_blast = Bio::Tools::Run::RemoteBlast->new('-verbose' => $v,
26 $remote_blast->submit_parameter('ENTREZ_QUERY',
27 'Escherichia coli[ORGN]');
28 my $inputfilename = test_input_file('ecolitst.fa');
29 ok( -e $inputfilename);
33 my $r = $remote_blast->submit_blast($inputfilename);
35 print STDERR "waiting..." if( $v > 0 );
36 while ( my @rids = $remote_blast->each_rid ) {
37 foreach my $rid ( @rids ) {
38 my $rc = $remote_blast->retrieve_blast($rid);
41 $remote_blast->remove_rid($rid);
42 # need a better solution for when 'Server failed to return any data'
44 print STDERR "." if ( $v > 0 );
48 $remote_blast->remove_rid($rid);
49 my $result = $rc->next_result;
50 like($result->database_name, qr/swissprot/i);
52 while( my $hit = $result->next_hit ) {
54 next unless ( $v > 0);
55 print "sbjct name is ", $hit->name, "\n";
56 while( my $hsp = $hit->next_hsp ) {
57 print "score is ", $hsp->score, "\n";
67 ok(1, 'Tabular BLAST');
69 my $remote_blast2 = Bio::Tools::Run::RemoteBlast->new
73 '-readmethod' => 'blasttable',
76 $remote_blast2->submit_parameter('ENTREZ_QUERY', 'Escherichia coli[ORGN]');
78 $remote_blast2->retrieve_parameter('ALIGNMENT_VIEW', 'Tabular');
80 $inputfilename = test_input_file('ecolitst.fa');
82 $r = $remote_blast2->submit_blast($inputfilename);
84 print STDERR "waiting..." if( $v > 0 );
85 while ( my @rids = $remote_blast2->each_rid ) {
86 foreach my $rid ( @rids ) {
87 my $rc = $remote_blast2->retrieve_blast($rid);
90 $remote_blast2->remove_rid($rid);
91 # need a better solution for when 'Server failed to return any data'
93 print STDERR "." if ( $v > 0 );
97 $remote_blast2->remove_rid($rid);
98 my $result = $rc->next_result;
100 while( my $hit = $result->next_hit ) {
102 next unless ( $v > 0);
103 print "sbjct name is ", $hit->name, "\n";
104 while( my $hsp = $hit->next_hsp ) {
105 print "score is ", $hsp->score, "\n";
114 test_skip(-tests => 5, -requires_module => 'Bio::SearchIO::blastxml');
116 my $remote_blastxml = Bio::Tools::Run::RemoteBlast->new('-prog' => $prog,
118 '-readmethod' => 'xml',
121 $remote_blast->submit_parameter('ENTREZ_QUERY',
122 'Escherichia coli[ORGN]');
124 $remote_blastxml->retrieve_parameter('FORMAT_TYPE', 'XML');
125 $inputfilename = test_input_file('ecolitst.fa');
129 $r = $remote_blastxml->submit_blast($inputfilename);
131 print STDERR "waiting..." if( $v > 0 );
132 while ( my @rids = $remote_blastxml->each_rid ) {
133 foreach my $rid ( @rids ) {
134 my $rc = $remote_blastxml->retrieve_blast($rid);
137 $remote_blastxml->remove_rid($rid);
138 # need a better solution for when 'Server failed to return any data'
140 print STDERR "." if ( $v > 0 );
144 $remote_blastxml->remove_rid($rid);
145 my $result = $rc->next_result;
146 like($result->database_name, qr/swissprot/i);
148 while( my $hit = $result->next_hit ) {
150 next unless ( $v > 0);
151 print "sbjct name is ", $hit->name, "\n";
152 while( my $hsp = $hit->next_hsp ) {
153 print "score is ", $hsp->score, "\n";