NAME
Bio::Tools::Run::RemoteBlast - Object for remote execution of the NCBI Blast via HTTP
SYNOPSIS
#Remote-blast "factory object" creation and blast-parameter initialization
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 $str = Bio::SeqIO->new(-file=>'amino.fa' , '-format' => 'fasta' );
while (my $input = $str->next_seq()){
#Blast a sequence against a database:
#Alternatively, you could pass in a file with many
#sequences rather than loop through sequence one at a time
#Remove the loop starting 'while (my $input = $str->next_seq())'
#and swap the two lines below for an example of that.
my $r = $factory->submit_blast($input);
#my $r = $factory->submit_blast('amino.fa');
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 {
my $result = $rc->next_result();
#save the output
my $filename = $result->query_name()."\.out";
$factory->save_output($filename);
$factory->remove_rid($rid);
print "\nQuery Name: ", $result->query_name(), "\n";
while ( my $hit = $result->next_hit ) {
next unless ( $v > 0);
print "\thit name is ", $hit->name, "\n";
while( my $hsp = $hit->next_hsp ) {
print "\t\tscore is ", $hsp->score, "\n";
}
}
}
}
}
}
# This example shows how to change a CGI parameter:
$Bio::Tools::Run::RemoteBlast::HEADER{'MATRIX_NAME'} = 'BLOSUM25';
# And this is how to delete a CGI parameter:
delete $Bio::Tools::Run::RemoteBlast::HEADER{'FILTER'};
DESCRIPTION
Class for remote execution of the NCBI Blast via HTTP.
For a description of the many CGI parameters see: http://www.ncbi.nlm.nih.gov/BLAST/Doc/urlapi.html
Various additional options and input formats are available.
FEEDBACK
Mailing Lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bio.perl.org/MailList.html - About the mailing lists
Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via email or the web:
bioperl-bugs@bio.perl.org
http://bio.perl.org/bioperl-bugs/
AUTHOR - Jason Stajich
Email jason@bioperl.org
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
header
Title : header
Usage : my $header = $self->header
Function: Get/Set HTTP header for blast query
Returns : string
Args : none
readmethod
Title : readmethod
Usage : my $readmethod = $self->readmethod
Function: Get/Set the method to read the blast report
Returns : string
Args : string [ Blast, BPlite ]
program
Title : program
Usage : my $prog = $self->program
Function: Get/Set the program to run
Returns : string
Args : string [ blastp, blastn, blastx, tblastn, tblastx ]
database
Title : database
Usage : my $db = $self->database
Function: Get/Set the database to search
Returns : string
Args : string [ swissprot, nr, nt, etc... ]
expect
Title : expect
Usage : my $expect = $self->expect
Function: Get/Set the E value cutoff
Returns : string
Args : string [ '1e-4' ]
ua
Title : ua
Usage : my $ua = $self->ua or
$self->ua($ua)
Function: Get/Set a LWP::UserAgent for use
Returns : reference to LWP::UserAgent Object
Args : none
Comments: Will create a UserAgent if none has been requested before.
proxy
Title : proxy
Usage : $httpproxy = $db->proxy('http') or
$db->proxy(['http','ftp'], 'http://myproxy' )
Function: Get/Set a proxy for use of proxy
Returns : a string indicating the proxy
Args : $protocol : an array ref of the protocol(s) to set/get
$proxyurl : url of the proxy to use for the specified protocol
submit_blast
Title : submit_blast
Usage : $self->submit_blast([$seq1,$seq2]);
Function: Submit blast jobs to ncbi blast queue on sequence(s)
Returns : Blast report object as defined by $self->readmethod
Args : input can be:
* sequence object
* array ref of sequence objects
* filename of file containing fasta formatted sequences
retrieve_blast
Title : retrieve_blast
Usage : my $blastreport = $blastfactory->retrieve_blast($rid);
Function: Attempts to retrieve a blast report from remote blast queue
Returns : -1 on error,
0 on 'job not finished',
Bio::Tools::BPlite or Bio::Tools::Blast object
(depending on how object was initialized) on success
Args : Remote Blast ID (RID)
save_output
Title : saveoutput
Usage : my $saveoutput = $self->save_output($filename)
Function: Method to save the blast report
Returns : 1 (throws error otherwise)
Args : string [rid, filename]