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}%")import { SmartsBio } from '@smartsbio/sdk';
const client = new SmartsBio({ apiKey: 'sk_live_...' });
const [workspace] = await client.workspaces.list();
const result = await client.tools.run('blast_search', {
input: {
sequence: 'MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSY',
program: 'blastp',
database: 'swissprot',
evalue: 1e-5,
maxHits: 10,
workspaceId: workspace.id,
},
});
console.log('Query length:', result.queryLen, 'aa');
console.log('Hits found :', result.nHits);
result.hits.slice(0, 5).forEach((h: { accession: string; description: string; evalue: number; pct_identity: number }) => {
console.log(` ${h.accession.padEnd(12)} ${h.description.slice(0, 50).padEnd(50)} e=${h.evalue.toExponential(1)} id=${h.pct_identity.toFixed(1)}%`);
});curl -X POST https://api.smarts.bio/v1/tools/blast_search/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"input": {
"sequence": "MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSY",
"program": "blastp",
"database": "swissprot",
"evalue": 0.00001,
"max_hits": 10
}
}'# Run BLASTP against SwissProt smarts tool run blast_search \ --param sequence=MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSY \ --param program=blastp \ --param database=swissprot \ --param evalue=0.00001 \ --param max_hits=10
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}")import { SmartsBio } from '@smartsbio/sdk';
const client = new SmartsBio({ apiKey: 'sk_live_...' });
const [workspace] = await client.workspaces.list();
// 1. Upload FASTA
const fasta = await client.files.upload('./sequences.fa', {
workspaceId: workspace.id, path: 'blast/',
});
// 2. Batch BLAST
const result = await client.tools.run('blast_search', {
input: {
filePath: fasta.key,
program: 'blastn',
database: 'nt',
evalue: 0.001,
maxHits: 5,
workspaceId: workspace.id,
outputPath: 'blast/results/',
},
});
// 3. Download results
const tsv = await client.files.download(result.outputPath, workspace.id, './blast/');
console.log('Batch BLAST results saved to', tsv);# 1. Upload FASTA smarts file upload sequences.fa blast/ # 2. Batch BLAST against nt smarts tool run blast_search \ --param file_path=blast/sequences.fa \ --param program=blastn \ --param database=nt \ --param evalue=0.001 \ --param max_hits=5 \ --param output_path=blast/results/ # 3. Download results table smarts file download blast/results/ ./blast/