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);
99 while (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";
115 test_skip(-tests => 5, -requires_module => 'Bio::SearchIO::blastxml');
117 my $remote_blastxml = Bio::Tools::Run::RemoteBlast->new('-prog' => $prog,
119 '-readmethod' => 'xml',
122 $remote_blastxml->submit_parameter('ENTREZ_QUERY',
123 'Escherichia coli[ORGN]');
125 $remote_blastxml->retrieve_parameter('FORMAT_TYPE', 'XML');
126 $inputfilename = test_input_file('ecolitst.fa');
130 $r = $remote_blastxml->submit_blast($inputfilename);
132 print STDERR "waiting..." if( $v > 0 );
133 while ( my @rids = $remote_blastxml->each_rid ) {
134 foreach my $rid ( @rids ) {
135 my $rc = $remote_blastxml->retrieve_blast($rid);
138 $remote_blastxml->remove_rid($rid);
139 # need a better solution for when 'Server failed to return any data'
141 print STDERR "." if ( $v > 0 );
145 $remote_blastxml->remove_rid($rid);
146 my $result = $rc->next_result;
147 like($result->database_name, qr/swissprot/i);
149 while( my $hit = $result->next_hit ) {
151 next unless ( $v > 0);
152 print "sbjct name is ", $hit->name, "\n";
153 while( my $hsp = $hit->next_hsp ) {
154 print "score is ", $hsp->score, "\n";