BLAST / Sequence Search
Search nucleotide and protein sequences against NCBI BLAST or smarts.bio's internal smarts.Match index. Use the blast_search tool for structured results.
TOOL
blast_searchRun BLASTN, BLASTP, BLASTX, or TBLASTN against NCBI databases or your workspace sequences.
| Parameter | Type | Description |
|---|---|---|
| sequence * | string | Query sequence (FASTA or raw). |
| program * | string | blastn, blastp, blastx, tblastn. |
| database | string | nt, nr, refseq_rna, or swissprot (default: nt). |
| evalue | number | E-value cutoff (default 0.001). |
| max_hits | integer | Max results returned (default 10, max 100). |
| workspace_id | string | Set to save results to your workspace. |
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id
result = client.tools.run(
tool_id="blast_search",
input={
"sequence": "MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSY",
"program": "blastp",
"database": "swissprot",
"evalue": 1e-5,
"max_hits": 10,
"workspace_id": ws_id,
},
)
print(f"Query length : {result['query_len']} aa")
print(f"Hits found : {result['n_hits']}")
for hit in result["hits"][:5]:
print(f" {hit['accession']:<12} {hit['description'][:50]:<50} e={hit['evalue']:.1e} id={hit['pct_identity']:.1f}%")BLAST from an uploaded FASTA file
Upload a multi-sequence FASTA file and run batch BLAST, getting back all hits in one call.
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id
# 1. Upload FASTA
fasta = client.files.upload("sequences.fa", workspace_id=ws_id, path="blast/")
# 2. Batch BLAST
result = client.tools.run(
tool_id="blast_search",
input={
"file_path": fasta["key"], # use file_path instead of sequence
"program": "blastn",
"database": "nt",
"evalue": 0.001,
"max_hits": 5,
"workspace_id": ws_id,
"output_path": "blast/results/",
},
)
# 3. Download results table
tsv = client.files.download(result["output_path"], workspace_id=ws_id, dest="./blast/")
print(f"Batch BLAST results saved to {tsv}")