Perform an NCBI BLAST sequence similarity search using NCBI's QBLAST service (see http://www.ncbi.nlm.nih.gov/BLAST/Doc/urlapi.html). The query sequence, database to search and BLAST program to use are inputs, the other parameters for the search are allowed to default.
Submit the QBLAST job.
Submit a job to NCBI QBLAST (see http://www.ncbi.nlm.nih.gov/BLAST/Doc/node2.html).
Submit the job.
org.embl.ebi.escience.scuflworkers.java.WebPageFetcher
Build QBLAST put URL.
//
// Construct a QBLAST Put URL
//
put_url = "http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?CMD=Put";
put_url += "&QUERY=" + query_sequence;
put_url += "&DATABASE=" + database;
put_url += "&PROGRAM=" + program;
program
database
query_sequence
put_url
Extract the QBLAST job identifer from the response.
import java.util.StringTokenizer;
StringTokenizer tok1 = new StringTokenizer(qblast_output, "\n");
while(tok1.hasMoreElements()) {
line = tok1.nextElement();
if(line.startsWith(" RID = ")) {
StringTokenizer tok2 = new StringTokenizer(line);
while(tok2.hasMoreElements()) {
job_id = tok2.nextElement();
}
}
}
qblast_output
job_id
NCBI QBLAST program to use (see http://www.ncbi.nlm.nih.gov/BLAST/Doc/node43.html#labelPROGRAM).
Database to search (see http://www.ncbi.nlm.nih.gov/BLAST/Doc/node15.html#labelDATABASE).
Query sequence (as single string) or NCBI GI.
text/html
NCBI QBLAST job identifer.
Check if the QBLAST job has finished, and get results.
NCBI QBLAST Get command (see http://www.ncbi.nlm.nih.gov/BLAST/Doc/node2.html):
A. Get status of a QBLAST job.
B. Get job result in "Text" format.
Extract the job status from the QBLAST output.
import java.util.StringTokenizer;
StringTokenizer tok1 = new StringTokenizer(qblast_output, "\n");
qblast_status = "UNKNOWN";
while(tok1.hasMoreElements()) {
line = tok1.nextElement();
if(line.startsWith(" Status=")) {
StringTokenizer tok2 = new StringTokenizer(line, " \n\t=");
while(tok2.hasMoreElements()) {
qblast_status = tok2.nextElement();
}
}
}
qblast_output
qblast_status
Map the job status into true/false.
if(job_status.startsWith("READY")) {
is_done = "true";
} else {
is_done = "false";
}
job_status
is_done
Fail is job not completed.
org.embl.ebi.escience.scuflworkers.java.FailIfFalse
Get the status/result from QBLAST.
org.embl.ebi.escience.scuflworkers.java.WebPageFetcher
Build the URL to get the job status/results
get_url = "http://www.ncbi.nlm.nih.gov/blast/Blast.cgi?";
get_url += "RID=" + job_id;
get_url += "&CMD=Get&FORMAT_TYPE=Text";
job_id
get_url
NCBI QBLAST job identifer.
NCBI QBLAST result in "Text" format. The output is similar to normal NCBI BLAST output but contains some HTML elements.
NCBI QBLAST job status.
Input sequence. Either the actual sequence or an NCBI GI identifer (e.g. 75251068 or 1531757).
Database to search (e.g. nr or nt).
NCBI BLAST "program" to use for the search (e.g. blastp or blastn).
NCBI QBLAST job identifer.
NCBI BLAST result from QBLAST. This is similar to the normal NCBI BLAST output but contains some HTML/XML tags.