[Bioperl-l] Trouble using RemoteBlast.pm
Hubert Prielinger
hubert.prielinger at gmx.at
Mon Jan 16 16:54:03 EST 2006
Nagesh Chakka wrote:
>Hi All,
>I was trying to setup a system to perform a remote blast on regular basis. I
>thought this could be best achieved by using BioPerl module and came across
>RemoteBlast.pm
>I had modified the sample script "bp_remote_blast.pl" which takes a file
>containing single FASTA sequence as an input. Also I wanted the blast report
>to be saved in a file for latter use and
>modified the code as follows
>I am using the latest version of Bioperl (1.5) on a Fedora platform.
>#######################################################################
>print "$Bio::Root::Version::VERSION\n";
>use Bio::Tools::Run::RemoteBlast;
>use strict;
>my $prog = 'blastp';
>my $db = 'swissprot';
>my $e_val= '1e-10';
>
>my @params = ( '-prog' => $prog,
> '-data' => $db,
> '-expect' => $e_val,
> '-readmethod' => 'SearchIO' );
>
>my $factory = Bio::Tools::Run::RemoteBlast->new(@params);
>
>#change a paramter
>$Bio::Tools::Run::RemoteBlast::HEADER{'ENTREZ_QUERY'} = 'Homo sapiens
>[ORGN]';
>
>#remove a parameter
>delete $Bio::Tools::Run::RemoteBlast::HEADER{'FILTER'};
>
>my $v = 1;
>#$v is just to turn on and off the messages
>
>my $r = $factory->submit_blast('blastInput.txt');
>
>print STDERR "waiting..." if( $v > 0 );
>while ( my @rids = $factory->each_rid )
>{
> foreach my $rid ( @rids )
> {
> my $rc = $factory->retrieve_blast($rid);
> if( !ref($rc) )
> {
> if( $rc < 0 )
> {
> $factory->remove_rid($rid);
> }
> print STDERR "." if ( $v > 0 );
> sleep 5;
> }
> else
> {
> print "RID $rid\n";
> $factory->save_output('temp.out');
> $factory->remove_rid($rid);
> }
> }
>}
>
>#################################################################################
>
>This script prints the RID and terminates immediately. Obviously the
>output file created is empty as the program did not wait for getting the
>blast results from the RID.
>Is there something I am doing wrong and what can I do for the program to wait
>until the results are ready to be printed to the output file. I could not get
>much information from the documentation and have no prior experience with
>Bioperl.
>Thanks very much for your attention.
>Regards
>Nageshbi
>_______________________________________________
>Bioperl-l mailing list
>Bioperl-l at portal.open-bio.org
>http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
>
>
hi nagesh,
try this, should work, I had the same problem:
.......................
.......................
else
{
print "RID $rid\n";
$factory->save_output('temp.out');
my $checkinput = $factory->file;
open(my $fh,"<$checkinput") or die $!;
while(<$fh>){
print;
}
close $fh;
$factory->remove_rid($rid);
}
}
}
regards
Hubert
PS: are you using the composition based statistics parameter with your
blast search?
if yes, is it working?
More information about the Bioperl-l
mailing list