public class NCBIQBlastService extends 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 and Description |
---|---|
static long |
WAIT_INCREMENT
Number of milliseconds by which expected job execution time is incremented if it is not finished yet.
|
Constructor and Description |
---|
NCBIQBlastService()
Constructs 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).
|
Modifier and Type | Method and Description |
---|---|
InputStream |
getAlignmentResults(String id,
RemotePairwiseAlignmentOutputProperties outputProperties)
Extracts the actual Blast report for given request id according to options provided in
outputProperties
argument. |
String |
getEmail()
Get the email for QBlast.
|
String |
getRemoteBlastInfo()
A simple method to check the availability of the QBlast service.
|
String |
getTool()
Get the tool identifier for QBlast.
|
boolean |
isReady(String id)
Wrapper method for
isReady(String, long) , omitting unnecessary present property. |
boolean |
isReady(String id,
long present)
Checks for completion of request.
|
String |
sendAlignmentRequest(int gid,
RemotePairwiseAlignmentProperties rpa)
Converts given GenBank GID to String and calls
sendAlignmentRequest(String, RemotePairwiseAlignmentProperties) |
String |
sendAlignmentRequest(Sequence<Compound> seq,
RemotePairwiseAlignmentProperties rpa)
Converts given sequence to String and calls
sendAlignmentRequest(String, RemotePairwiseAlignmentProperties) |
String |
sendAlignmentRequest(String query,
RemotePairwiseAlignmentProperties alignmentProperties)
Sends the Blast request via the Put command of the CGI-BIN interface.
|
void |
sendDeleteRequest(String id)
Sends a delete request for given request id.
|
void |
setEmail(String email)
Set the email for QBlast.
|
void |
setTool(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(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 String getRemoteBlastInfo() throws Exception
Info
command to QBlastException
- if unable to connect to the NCBI QBlast servicepublic String sendAlignmentRequest(Sequence<Compound> seq, RemotePairwiseAlignmentProperties rpa) throws Exception
sendAlignmentRequest(String, RemotePairwiseAlignmentProperties)
sendAlignmentRequest
in interface RemotePairwiseAlignmentService
Exception
public String sendAlignmentRequest(int gid, RemotePairwiseAlignmentProperties rpa) throws Exception
sendAlignmentRequest(String, RemotePairwiseAlignmentProperties)
Exception
public String sendAlignmentRequest(String query, RemotePairwiseAlignmentProperties alignmentProperties) throws 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 propertiesException
- if unable to connect to the NCBI QBlast service or if no sequence or required parameters
PROGRAM and DATABASE are not setpublic boolean isReady(String id) throws Exception
isReady(String, long)
, omitting unnecessary present
property.Exception
isReady(String, long)
public boolean isReady(String id, long present) throws Exception
isReady
in interface RemotePairwiseAlignmentService
id
- : request id, which was returned by sendAlignmentRequest
methodpresent
- : is not used, can be any valueException
- if the ID does not exist.public InputStream getAlignmentResults(String id, RemotePairwiseAlignmentOutputProperties outputProperties) throws 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 resultsException
- if it is not possible to recover the resultspublic void sendDeleteRequest(String id)
id
- request id, as returned by sendAlignmentRequest
methodpublic void setTool(String tool)
tool
- the new identifierpublic String getTool()
public void setEmail(String email)
email
- the new emailpublic String getEmail()
Copyright © 2000–2016 BioJava. All rights reserved.