Genomics
Variant annotation, GWAS lookups, and gene search pipelines using direct tool calls and file upload/download.
Upload → annotate → download a VCF
Upload a raw VCF, run GATK variant annotation, then download the annotated output.
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id
# 1. Upload the raw VCF
upload = client.files.upload("sample.vcf", workspace_id=ws_id, path="raw/")
vcf_key = upload["key"]
print(f"Uploaded: {vcf_key}")
# 2. Run GATK annotation tool
result = client.tools.run(
tool_id="gatk_variant_annotation",
input={
"file_path": vcf_key,
"workspace_id": ws_id,
"annotations": ["ClinVar", "gnomAD_AF", "CADD", "dbSNP"],
"output_path": "annotated/",
},
)
print(f"Status: {result['status']}")
annotated_key = result["output_path"]
# 3. Download the annotated VCF
local = client.files.download(annotated_key, workspace_id=ws_id, dest="./output/")
print(f"Saved to {local}")NCBI Gene lookup
Call the ncbi_search tool directly for structured gene records — no agent overhead, no prompt.
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
result = client.tools.run(
tool_id="ncbi_search",
input={
"database": "gene",
"query": "BRCA1[Gene Name] AND Homo sapiens[Organism]",
"maxResults": 1,
},
)
gene = result["results"][0]
print(f"Gene ID : {gene['id']}")
print(f"Location : chr{gene['chromosome']}:{gene['start']}-{gene['stop']}")
print(f"Summary : {gene['summary'][:300]}")GWAS lookup + agent interpretation
Fetch structured GWAS associations with a direct tool call, then stream the agent's clinical interpretation of the top hits.
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id
# Step 1: structured GWAS data (direct tool call)
gwas = client.tools.run(
tool_id="gwas_catalog_search",
input={"trait": "type 2 diabetes", "pvalue_threshold": 5e-8, "limit": 10},
)
top_snps = gwas["associations"][:10]
print(f"Top {len(top_snps)} associations fetched")
# Step 2: streaming clinical interpretation
for chunk in client.query.stream(
prompt=f"Interpret these GWAS hits for type 2 diabetes: {top_snps[:3]}. "
"Focus on the nearest genes and their biological roles.",
workspace_id=ws_id,
):
if chunk.type == "content":
print(chunk.content, end="", flush=True)Convert VCF to annotated TSV
Upload a VCF, convert to TSV with selected fields, then download for spreadsheet analysis.
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id
# Upload
vcf = client.files.upload("variants.vcf", workspace_id=ws_id, path="input/")
# Convert to TSV
conv = client.tools.run(
tool_id="convert_format",
input={
"file_path": vcf["key"],
"workspace_id": ws_id,
"output_format": "tsv",
"fields": ["CHROM", "POS", "REF", "ALT", "QUAL", "INFO/AF", "INFO/DP"],
"output_path": "converted/",
},
)
# Download TSV
tsv_path = client.files.download(conv["output_path"], workspace_id=ws_id, dest="./")
print(f"TSV saved to {tsv_path}")