NAME
Bio::Tools::Run::RemoteBlast - Object for remote execution of the NCBI Blast via HTTP
SYNOPSIS
#Remote-blast "factory object" creation and blast-parameter initializationuse 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 query parameter$Bio::Tools::Run::RemoteBlast::HEADER{'ENTREZ_QUERY'} = 'Homo sapiens [ORGN]';#change a retrieval parameter$Bio::Tools::Run::RemoteBlast::RETRIEVALHEADER{'DESCRIPTIONS'} = 1000;#remove a parameterdelete $Bio::Tools::Run::RemoteBlast::HEADER{'FILTER'};#$v is just to turn on and off the messagesmy $v = 1;my $str = Bio::SeqIO->new(-file=>'amino.fa' , -format => 'fasta' );#optional: send BLAST request to a cloud service provider instead of NCBI#$factory->set_url_base("http://host.my.cloud.service.provider.com/cgi-bin/blast.cgi");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 outputmy $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'} = 'BLOSUM45';$Bio::Tools::Run::RemoteBlast::HEADER{'GAPCOSTS'} = '15 2';# 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: https://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.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
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 the web:
https://github.com/bioperl/bioperl-live/issues
AUTHOR
Please do NOT contact Jason directly about this module. Please post to the bioperl mailing list (FEEDBACK). If you would like to be the official maintainer of this module, please volunteer on the list and we will make it official in this POD.
First written by Jason Stajich, many others have helped keep it running.
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
retrieve_parameter
Title : retrieve_parameterUsage : my $db = $self->retrieve_parameterFunction: Get/Set the named parameter for the retrieve_blast operation.Returns : stringArgs : $name : name of GET parameter$val : optional value to set the parameter to
submit_parameter
Title : submit_parameterUsage : my $db = $self->submit_parameterFunction: Get/Set the named parameter for the submit_blast operation.Returns : stringArgs : $name : name of PUT parameter$val : optional value to set the parameter to
header
Title : headerUsage : my $header = $self->headerFunction: Get HTTP header for blast queryReturns : stringArgs : none
readmethod
Title : readmethodUsage : my $readmethod = $self->readmethodFunction: Get/Set the method to read the blast reportReturns : stringArgs : string [ blast, blasttable, xml ]
program
Title : programUsage : my $prog = $self->programFunction: Get/Set the program to run. Retained for backwards-compatibility.Returns : stringArgs : string [ blastp, blastn, blastx, tblastn, tblastx ]
database
Title : databaseUsage : my $db = $self->databaseFunction: Get/Set the database to search. Retained for backwards-compatibility.Returns : stringArgs : string [ swissprot, nr, nt, etc... ]
expect
Title : expectUsage : my $expect = $self->expectFunction: Get/Set the E value cutoff. Retained for backwards-compatibility.Returns : stringArgs : string [ '1e-4' ]
ua
Title : uaUsage : my $ua = $self->ua or$self->ua($ua)Function: Get/Set a LWP::UserAgent for useReturns : reference to LWP::UserAgent ObjectArgs : noneComments: Will create a UserAgent if none has been requested before.
proxy
Title : proxyUsage : $httpproxy = $db->proxy('http') or$db->proxy(['http','ftp'], 'http://myproxy' )Function: Get/Set a proxy for use of proxyReturns : a string indicating the proxyArgs : $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_blastUsage : $self->submit_blast([$seq1,$seq2]);Function: Submit blast jobs to ncbi blast queue on sequence(s)Returns : Blast report object as defined by $self->readmethodArgs : input can be:* sequence object* array ref of sequence objects* filename of file containing fasta formatted sequences
retrieve_blast
Title : retrieve_blastUsage : my $blastreport = $blastfactory->retrieve_blast($rid);Function: Attempts to retrieve a blast report from remote blast queueReturns : scalar int (constant) or Bio::SearchIO objectConstants:NOT_FINISHED (= 0) : 'job not finished'code on error:ERR_QBSTATUS (= 1) : return line matches 'Status=ERROR'ERR_NOCONTENT (= 2): HTTP request successful, but no contentreturnedERR_HTTPFAIL (= 4) : HTTP request failedERR_QBNONSPEC (= 8): return line matches 'ERROR' (not status line)Args : Remote Blast ID (RID)
save_output
Title : saveoutputUsage : my $saveoutput = $self->save_output($filename)Function: Method to save the blast reportReturns : 1 (throws error otherwise)Args : string [rid, filename]
set_url_base
Title : set_url_baseUsage : $self->set_url_base($url)Function: Method to override the default URL to access the NCBI BLAST web serviceReturns : NoneArgs : string (URL used for remote BLAST searches)NOTE : This is highly experimental; we cannot maintain support onweb services other than the default NCBI BLAST web service at thistime. Only some URL parameters may be supported by other BLASTweb services.
get_url_base
Title : get_url_baseUsage : my $url = $self->set_url_baseFunction: Get the current URL for BLAST searchingReturns : string (URL used for remote blast searches)Args : None
get_rtoe
Title : get_rtoeUsage : my $url = $self->rtoeFunction: Retrieve the retrieval time (defined after submit_blast())Returns : numberArgs : None