This document describes how to access SequenceServer functionality programmatically using the command line.
The documentation is based on version 2.0.0.rc4
Example invocations use curl
and jq
.
$BASEURL
in the examples is the URL of your SequenceServer instance. E.g. http://localhost:4567 if you are running on default localhost URL.
The accompanying script blastnAllDbs.sh is a working shell script to submit a BLAST job and get results.
GET: /searchdata.json
In order to submit a Blast job, you have to know the IDs of the Blast databases. This endpoint retrieves information about the databases in JSON format.
curl $BASEURL/searchdata.json | jq --raw-output '.database[].id'
The above command gets the IDs of the databases
POST: /
method
. The name of the blast search to use (blastn, blastp, tblastn etc)sequence
The query sequencedatabases[]
One or more Ids of Blast databases to searchadvanced
Additional options, e.g evalue, gapopen, gapextend etcSuccessful submission results in a 303 HTTP status code.
Location
header is a link to the submitted job IDTo query a single database using blastn:
curl -v -X POST -Fsequence=ATGTTACCACCAACTATTAGAATTTCAG -Fmethod=blastn -Fdatabases[]=3c0a5bc06f2596698f62c7ce87aeb62a $BASEURL
To query multiple databases, add extra -Fdatabases[] arguments, e.g.
curl -v -X POST -Fsequence=ATGTTACCACCAACTATTAGAATTTCAG -Fmethod=blastn -Fdatabases[]=3c0a5bc06f2596698f62c7ce87aeb62a -Fdatabases[]=2f8c0e19d8d5b8ab225962d7284a6cbf $BASEURL
Getting location header - you need this in order to retrieve the results
jobUrl=$(curl -v -X POST -Fsequence=ATGTTACCACCAACTATTAGAATTTCAG -Fmethod=blastn -Fdatabases[]=3c0a5bc06f2596698f62c7ce87aeb62a --write-out '%{redirect_url}' $BASEURL)
Altering the evalue threshold and adding a gap penalty:
curl -v -X POST -Fsequence=ATGTTACCACCAACTATTAGAATTTCAG -Fmethod=blastn -Fdatabases[]=3c0a5bc06f2596698f62c7ce87aeb62a -Fadvanced="-evalue 1.0e-8 -gapopen 1 -gapextend 1" $BASEURL
GET: /{jobId}.json
jobId
The Job Idcurl -o myresults.json $BASEURL/069b56c8-25bd-451e-b117-dc996a1aed24.json
GET: /download/{jobId}.{format}
jobId
the Job ID retrieved after submissionformat
is one of xml
, std_tsv
or full_tsv
curl -o myresults.xml $BASEURL/download/069b56c8-25bd-451e-b117-dc996a1aed24.xml
curl -o myresults.tsv $BASEURL/download/069b56c8-25bd-451e-b117-dc996a1aed24.std_tsv
curl -o myresults-full.tsv $BASEURL/download/069b56c8-25bd-451e-b117-dc996a1aed24.full_tsv
Download hits in FASTA format.
POST: /get_sequence
sequence_ids
A comma-separated list of sequence IDsdatabase_ids
A comma-separated list of database Idscurl -X POST -Fsequence_ids=SPAC1002.01,SPAC1002.02 -Fdatabase_ids=2f8c0e19d8d5b8ab225962d7284a6cbf $BASEURL/get_sequence