Class NCBIQBlastService
java.lang.Object
org.biojava.nbio.ws.alignment.qblast.NCBIQBlastService
- All Implemented Interfaces:
RemotePairwiseAlignmentService
Provides a simple way of submitting BLAST request to the QBlast service at NCBI.
NCBI provides a Blast server through a CGI-BIN interface. This service 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 this service 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.
- Author:
- Sylvain Foisy, Diploide BioIT, Gediminas Rimsa
-
Field Summary
Modifier and TypeFieldDescriptionstatic final long
Number of milliseconds by which expected job execution time is incremented if it is not finished yet. -
Constructor Summary
ConstructorDescriptionConstructs a service object that targets the public NCBI BLAST network service.NCBIQBlastService
(String svcUrl) Constructs a service object which targets a custom NCBI BLAST network service (e.g.: an instance of BLAST in the cloud). -
Method Summary
Modifier and TypeMethodDescriptiongetAlignmentResults
(String id, RemotePairwiseAlignmentOutputProperties outputProperties) Extracts the actual Blast report for given request id according to options provided inoutputProperties
argument.getEmail()
Get the email for QBlast.A simple method to check the availability of the QBlast service.getTool()
Get the tool identifier for QBlast.boolean
Wrapper method forisReady(String, long)
, omitting unnecessarypresent
property.boolean
Checks for completion of request.sendAlignmentRequest
(int gid, RemotePairwiseAlignmentProperties rpa) Converts given GenBank GID to String and callssendAlignmentRequest(String, RemotePairwiseAlignmentProperties)
sendAlignmentRequest
(String query, RemotePairwiseAlignmentProperties alignmentProperties) Sends the Blast request via the Put command of the CGI-BIN interface.Converts given sequence to String and callssendAlignmentRequest(String, RemotePairwiseAlignmentProperties)
void
Sends a delete request for given request id.void
Set the email for QBlast.void
Set the tool identifier for QBlast.
-
Field Details
-
WAIT_INCREMENT
public static final long WAIT_INCREMENTNumber of milliseconds by which expected job execution time is incremented if it is not finished yet. Subsequent calls toisReady(String, long)
method will return false until at least this much time passes.- See Also:
-
-
Constructor Details
-
NCBIQBlastService
public NCBIQBlastService()Constructs a service object that targets the public NCBI BLAST network service. -
NCBIQBlastService
Constructs a service object which targets a custom NCBI BLAST network service (e.g.: an instance of BLAST in the cloud).- Parameters:
svcUrl
- : aString
containing the base URL to send requests to, e.g.: http://host.my.cloud.service.provider.com/cgi-bin/blast.cgi- See Also:
-
-
Method Details
-
getRemoteBlastInfo
A simple method to check the availability of the QBlast service. SendsInfo
command to QBlast- Returns:
- QBlast info output concatenated to String
- Throws:
Exception
- if unable to connect to the NCBI QBlast service
-
sendAlignmentRequest
public String sendAlignmentRequest(Sequence<Compound> seq, RemotePairwiseAlignmentProperties rpa) throws Exception Converts given sequence to String and callssendAlignmentRequest(String, RemotePairwiseAlignmentProperties)
- Specified by:
sendAlignmentRequest
in interfaceRemotePairwiseAlignmentService
- Throws:
Exception
-
sendAlignmentRequest
Converts given GenBank GID to String and callssendAlignmentRequest(String, RemotePairwiseAlignmentProperties)
- Throws:
Exception
-
sendAlignmentRequest
public String sendAlignmentRequest(String query, RemotePairwiseAlignmentProperties alignmentProperties) throws Exception Sends the Blast request via the Put command of the CGI-BIN interface. Uses all of the parameters specified inalignmentProperties
(parameters PROGRAM and DATABASE are required).- Specified by:
sendAlignmentRequest
in interfaceRemotePairwiseAlignmentService
- Parameters:
query
- : aString
representing a sequence or Genbank IDalignmentProperties
- : aRemotePairwiseAlignmentProperties
object representing alignment properties- Returns:
- the request id for this sequence, necessary to fetch results after completion
- Throws:
Exception
- if unable to connect to the NCBI QBlast service or if no sequence or required parameters PROGRAM and DATABASE are not set
-
isReady
Wrapper method forisReady(String, long)
, omitting unnecessarypresent
property.- Throws:
Exception
- See Also:
-
isReady
Checks for completion of request. If expected execution time (RTOE) is available for request, this method will always return false until that time passes. This is done to prevent sending unnecessary requests to the server.- Specified by:
isReady
in interfaceRemotePairwiseAlignmentService
- Parameters:
id
- : request id, which was returned bysendAlignmentRequest
methodpresent
- : is not used, can be any value- Returns:
- a boolean value telling if the request has been completed
- Throws:
Exception
- if the ID does not exist.
-
getAlignmentResults
public InputStream getAlignmentResults(String id, RemotePairwiseAlignmentOutputProperties outputProperties) throws Exception Extracts the actual Blast report for given request id according to options provided inoutputProperties
argument. If the results are not ready yet, sleeps until they are available. If sleeping is not desired, call this method afterisReady
returns true- Specified by:
getAlignmentResults
in interfaceRemotePairwiseAlignmentService
- Parameters:
id
- : request id, which was returned bysendAlignmentRequest
methodoutputProperties
- : an object specifying output formatting options- Returns:
- an
InputStream
of results - Throws:
Exception
- if it is not possible to recover the results
-
sendDeleteRequest
Sends a delete request for given request id. Optional operation, ignores IOExceptions.
Can be used after results of given search are no longer needed to be kept on Blast server- Parameters:
id
- request id, as returned bysendAlignmentRequest
method
-
setTool
Set the tool identifier for QBlast. Defaults to "biojava5"- Parameters:
tool
- the new identifier
-
getTool
Get the tool identifier for QBlast. Defaults to "biojava5"- Returns:
- the identifier
-
setEmail
Set the email for QBlast. Defaults to "anonymous@biojava.org"- Parameters:
email
- the new email
-
getEmail
Get the email for QBlast. Defaults to "anonymous@biojava.org".- Returns:
- the email
-