#!/usr/bin/perl -w use strict; use warnings; use Bio::SeqIO; use Bio::Tools::Run::RemoteBlast; use Bio::Seq; use IO::String; use Bio::SearchIO; my $prog = 'blastp'; my $db = 'swissprot'; my $e_val = '20000'; my $matrix = 'PAM30'; #my $outfile = 'Output'; my @data; my $line_dataArray; my $rid; my $count = 1; my @params = ( '-prog' => $prog, '-data' => $db, '-expect' => $e_val, '-matrix' => $matrix ); my $seqio_obj = Bio::SeqIO->new( -file => "Perm.txt", -format => "raw", ); print "entering blast...."; my $factory = Bio::Tools::Run::RemoteBlast->new(@params); print "Blast entered successfully \n"; while ( my $query = $seqio_obj->next_seq ) { print "submit Sequence...just do it....\n"; my $r = $factory->submit_blast($query); print $query->seq; print "\n"; # Wait for the reply and save the output file print "entering while loop for saving Output.... \n"; while ( my @rids = $factory->each_rid ) { foreach my $rid (@rids) { my $rc = $factory->retrieve_blast($rid); if ( !ref($rc) ) { print '$rc is not a ref!', "\n"; if ( $rc < 0 ) { print "Remove rid ...\n"; $factory->remove_rid($rid); } # sleep 5; } else { print "retrieved Results successfully \n"; print $rid; print "\n"; my $filename = "$count.out"; #my $checkname = "check$count.out"; $factory->save_output($filename); print "File saved successfully \n"; my $checkinput = $factory->file; open(my $fh,"<$checkinput") or die $!; while(<$fh>){ print; } close $fh; $count++; $factory->remove_rid($rid); } } print "\n"; print "\n"; } }