RemotePairwiseAlignmentService
public class NCBIQBlastService extends java.lang.Object implements RemotePairwiseAlignmentService
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.
Modifier and Type | Field | Description |
---|---|---|
static long |
WAIT_INCREMENT |
Number of milliseconds by which expected job execution time is incremented if it is not finished yet.
|
Constructor | Description |
---|---|
NCBIQBlastService() |
Constructs a service object that targets the public NCBI BLAST network
service.
|
NCBIQBlastService(java.lang.String svcUrl) |
Constructs a service object which targets a custom NCBI BLAST network
service (e.g.: an instance of BLAST in the cloud).
|
Modifier and Type | Method | Description |
---|---|---|
java.io.InputStream |
getAlignmentResults(java.lang.String id,
RemotePairwiseAlignmentOutputProperties outputProperties) |
Extracts the actual Blast report for given request id according to options provided in
outputProperties
argument. |
java.lang.String |
getEmail() |
Get the email for QBlast.
|
java.lang.String |
getRemoteBlastInfo() |
A simple method to check the availability of the QBlast service.
|
java.lang.String |
getTool() |
Get the tool identifier for QBlast.
|
boolean |
isReady(java.lang.String id) |
Wrapper method for
isReady(String, long) , omitting unnecessary present property. |
boolean |
isReady(java.lang.String id,
long present) |
Checks for completion of request.
|
java.lang.String |
sendAlignmentRequest(int gid,
RemotePairwiseAlignmentProperties rpa) |
Converts given GenBank GID to String and calls
sendAlignmentRequest(String, RemotePairwiseAlignmentProperties) |
java.lang.String |
sendAlignmentRequest(java.lang.String query,
RemotePairwiseAlignmentProperties alignmentProperties) |
Sends the Blast request via the Put command of the CGI-BIN interface.
|
java.lang.String |
sendAlignmentRequest(Sequence<Compound> seq,
RemotePairwiseAlignmentProperties rpa) |
Converts given sequence to String and calls
sendAlignmentRequest(String, RemotePairwiseAlignmentProperties) |
void |
sendDeleteRequest(java.lang.String id) |
Sends a delete request for given request id.
|
void |
setEmail(java.lang.String email) |
Set the email for QBlast.
|
void |
setTool(java.lang.String tool) |
Set the tool identifier for QBlast.
|
public static final long WAIT_INCREMENT
isReady(String, long)
method will return false until at least this much time passes.public NCBIQBlastService()
public NCBIQBlastService(java.lang.String svcUrl)
svcUrl
- : a String
containing the base URL to send requests to,
e.g.: http://host.my.cloud.service.provider.com/cgi-bin/blast.cgipublic java.lang.String getRemoteBlastInfo() throws java.lang.Exception
Info
command to QBlastjava.lang.Exception
- if unable to connect to the NCBI QBlast servicepublic java.lang.String sendAlignmentRequest(Sequence<Compound> seq, RemotePairwiseAlignmentProperties rpa) throws java.lang.Exception
sendAlignmentRequest(String, RemotePairwiseAlignmentProperties)
sendAlignmentRequest
in interface RemotePairwiseAlignmentService
java.lang.Exception
public java.lang.String sendAlignmentRequest(int gid, RemotePairwiseAlignmentProperties rpa) throws java.lang.Exception
sendAlignmentRequest(String, RemotePairwiseAlignmentProperties)
java.lang.Exception
public java.lang.String sendAlignmentRequest(java.lang.String query, RemotePairwiseAlignmentProperties alignmentProperties) throws java.lang.Exception
alignmentProperties
(parameters PROGRAM and DATABASE are required).sendAlignmentRequest
in interface RemotePairwiseAlignmentService
query
- : a String
representing a sequence or Genbank IDalignmentProperties
- : a RemotePairwiseAlignmentProperties
object representing alignment propertiesjava.lang.Exception
- if unable to connect to the NCBI QBlast service or if no sequence or required parameters
PROGRAM and DATABASE are not setpublic boolean isReady(java.lang.String id) throws java.lang.Exception
isReady(String, long)
, omitting unnecessary present
property.java.lang.Exception
isReady(String, long)
public boolean isReady(java.lang.String id, long present) throws java.lang.Exception
isReady
in interface RemotePairwiseAlignmentService
id
- : request id, which was returned by sendAlignmentRequest
methodpresent
- : is not used, can be any valuejava.lang.Exception
- if the ID does not exist.public java.io.InputStream getAlignmentResults(java.lang.String id, RemotePairwiseAlignmentOutputProperties outputProperties) throws java.lang.Exception
outputProperties
argument.
If the results are not ready yet, sleeps until they are available. If sleeping is not desired, call this method
after isReady
returns truegetAlignmentResults
in interface RemotePairwiseAlignmentService
id
- : request id, which was returned by sendAlignmentRequest
methodoutputProperties
- : an object specifying output formatting optionsInputStream
of resultsjava.lang.Exception
- if it is not possible to recover the resultspublic void sendDeleteRequest(java.lang.String id)
id
- request id, as returned by sendAlignmentRequest
methodpublic void setTool(java.lang.String tool)
tool
- the new identifierpublic java.lang.String getTool()
public void setEmail(java.lang.String email)
email
- the new emailpublic java.lang.String getEmail()