Class RemoteQBlastService
- java.lang.Object
-
- org.biojavax.bio.alignment.blast.RemoteQBlastService
-
- All Implemented Interfaces:
RemotePairwiseAlignmentService
public class RemoteQBlastService extends Object implements RemotePairwiseAlignmentService
RemoteQBlastService - A simple way of submitting BLAST request to the QBlast service at NCBI.NCBI provides a Blast server through a CGI-BIN interface. RemoteQBlastService simply encapsulates an access to it by giving users access to get/set methods to fix sequence, program and database as well as advanced options.
The philosophy behind RemoteQBlastService is to disconnect submission of Blast requests from collection of Blast results. This is done so to allow a user to submit multiple Blast requests while allowing recovery of the reports at a later time.
Presently, only blastall programs are accessible. blastpgp and megablast are high-priorities.
- Since:
- 1.8
- Author:
- Sylvain Foisy, Diploide BioIT
-
-
Constructor Summary
Constructors Constructor Description RemoteQBlastService()The constructor for a QBlast service request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamgetAlignmentResults(String id, RemotePairwiseAlignmentOutputProperties rb)This method extracts the actual Blast report for this request ID.StringgetEmail()Get the email for QBlast.StringgetTool()Get the tool identifier for QBlast.booleanisReady(String id, long present)This method is used only for the executeBlastSearch method to check for completion of request using the NCBI specified RTOE variablevoidprintRemoteBlastInfo()A simple method to check the availability of the QBlast serviceStringsendAlignmentRequest(int gid, RemotePairwiseAlignmentProperties rpa)This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a GenBank GID.StringsendAlignmentRequest(String str, RemotePairwiseAlignmentProperties rpa)This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a string representing the sequence.StringsendAlignmentRequest(RichSequence rs, RemotePairwiseAlignmentProperties rpa)This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a RichSequence.voidsetEmail(String email)Set the email for QBlast.voidsetTool(String tool)Set the tool identifier for QBlast.
-
-
-
Constructor Detail
-
RemoteQBlastService
public RemoteQBlastService() throws BioException
The constructor for a QBlast service request.- Throws:
BioException- if the NCBI URL is unresponsive
-
-
Method Detail
-
sendAlignmentRequest
public String sendAlignmentRequest(String str, RemotePairwiseAlignmentProperties rpa) throws BioException
This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a string representing the sequence. It gets the estimated time of completion by capturing the value of the RTOE variable and sets a loop that will check for completion of analysis at intervals specified by RTOE.It also capture the value for the RID variable, necessary for fetching the actual results after completion.
- Specified by:
sendAlignmentRequestin interfaceRemotePairwiseAlignmentService- Parameters:
str- : aStringwith a sequencerpa- : aRemotePairwiseAlignmentPropertiesobject- Returns:
- rid : a
Stringwith the request ID for this sequence - Throws:
BioException- if it is not possible to sent the BLAST command
-
sendAlignmentRequest
public String sendAlignmentRequest(RichSequence rs, RemotePairwiseAlignmentProperties rpa) throws BioException
This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a RichSequence. It gets the estimated time of completion by capturing the value of the RTOE variable and sets a loop that will check for completion of analysis at intervals specified by RTOE.It also capture the value for the RID variable, necessary for fetching the actual results after completion.
- Specified by:
sendAlignmentRequestin interfaceRemotePairwiseAlignmentService- Parameters:
rs- :aRichSequenceobjectrpa- :aRemotePairwiseAlignmentPropertiesobject- Returns:
- rid : a
Stringwith the request ID for this sequence - Throws:
BioException- if it is not possible to sent the BLAST command
-
sendAlignmentRequest
public String sendAlignmentRequest(int gid, RemotePairwiseAlignmentProperties rpa) throws BioException
This method is a wrapper that executes the Blast request via the Put command of the CGI-BIN interface with the specified parameters and a GenBank GID. It gets the estimated time of completion by capturing the value of the RTOE variable and sets a loop that will check for completion of analysis at intervals specified by RTOE.It also capture the value for the RID variable, necessary for fetching the actual results after completion.
- Parameters:
gid- :an integer with a Genbank GIDrpa- :aRemotePairwiseAlignmentPropertiesobject- Returns:
- rid : a String with the request ID for this sequence
- Throws:
BioException- if it is not possible to sent the BLAST command
-
isReady
public boolean isReady(String id, long present) throws BioException
This method is used only for the executeBlastSearch method to check for completion of request using the NCBI specified RTOE variable
- Specified by:
isReadyin interfaceRemotePairwiseAlignmentService- Parameters:
id- : a valid request IDpresent- : a representation of "now" using System.currentTimeMillis().- Returns:
- a boolean value telling if the request has been completed or not.
- Throws:
BioException- if the ID does not exist.
-
getAlignmentResults
public InputStream getAlignmentResults(String id, RemotePairwiseAlignmentOutputProperties rb) throws BioException
This method extracts the actual Blast report for this request ID. It uses an object implementing the RemotePairwiseAlignmentOutputProperties interface which will specify output formatting options.
- Specified by:
getAlignmentResultsin interfaceRemotePairwiseAlignmentService- Parameters:
id- :a valid request IDrb- : aRemotePairwiseAlignmentOutputPropertiesthat will specify specific output formatting commands- Returns:
- an
InputStreamthat can be use any way one might desire - Throws:
BioException- if it is not possible to recover the results.
-
printRemoteBlastInfo
public void printRemoteBlastInfo() throws BioException
A simple method to check the availability of the QBlast service- Throws:
BioException- if unable to connect to the NCBI QBlast service
-
setTool
public void setTool(String tool)
Set the tool identifier for QBlast. Defaults to 'biojavax'.- Parameters:
tool- the new identifier.
-
getTool
public String getTool()
Get the tool identifier for QBlast. Defaults to 'biojavax'.- Returns:
- the identifier.
-
setEmail
public void setEmail(String email)
Set the email for QBlast. Defaults to 'anonymous@biojava.org'.- Parameters:
email- the new email.
-
-