#!/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; use lib qw(/usr/local/bioperl/bioperl-1.5.1); my $prog = 'blastp'; my $db = 'swissprot'; &n bsp; &n bsp; my $e_val = '20000'; my $matrix = 'pam30'; &n bsp; &n bsp; my $wordSize = '2'; my @data; my $line_dataArray; my $rid; my $count = 1; &nbs p; &nbs p; my @params = ( '-prog' => $prog, '-data' => $db, '-expect' => $e_val, '-MATRIX_NAME' => $matrix, '-readmethod' => 'xml', '-WORD_SIZE' => $wordSize, ); my $seqio_obj = Bio::SeqIO->new( -file => "aloneblosum80.txt", -format => "raw", ); print "entering blast...."; my $xmlFactory = Bio::Tools::Run::RemoteBlast->new(@params); $Bio::Tools::Run::RemoteBlast::HEADER{'GAPCOSTS'} = '9 1'; &n bsp; &n bsp; $Bio::Tools::Run::RemoteBlast::HEADER{'DESCRIPTIONS'} = '1000'; $Bio::Tools::Run::RemoteBlast::RETRIEVALHEADER{'ALIGNMENTS'} = '1000'; $Bio::Tools::Run::RemoteBlast::RETRIEVALHEADER{'FORMAT_TYPE'} = 'XML'; print "Blast entered successfully \n"; while ( my $query = $seqio_obj->next_seq ) { print "submit Sequence...just do it....\n"; my $r = $xmlFactory->submit_blast($query); print $query->seq; print "\n"; # sleep 30; # Wait for the reply and save the output file print "entering while loop for saving Output.... \n"; while ( my @rids = $xmlFactory->each_rid ) { foreach my $rid (@rids) { my $rc = $xmlFactory->retrieve_blast($rid); if ( !ref($rc) ) { print '$rc is not a ref!', "\n"; if ( $rc < 0 ) { print "Remove rid ...\n"; $xmlFactory->remove_rid($rid); } # sleep 5; } else { print "retrieved Results successfully \n"; print $rid; print "\n"; my $filename = "$count.xml"; $xmlFactory->save_output($filename); print "File saved successfully \n"; my $checkinput = $xmlFactory->file; open(my $fh,"<$checkinput") or die $!; while(<$fh>){ print; } close $fh; $count++; $xmlFactory->remove_rid($rid); } } print "\n"; print "\n"; } }