Official Python SDK for the smarts.bio bioinformatics platform
Project description
Official Python SDK for smarts.bio
Run BLAST, GATK, AlphaFold, BWA, DESeq2, and dozens more bioinformatics tools — all through a single API.
Get started in 2 minutes
- Sign up at smarts.bio and create a free account
- Generate an API key — Organization Settings → API Keys
- Install and run:
pip install smarts-bio
from smartsbio import SmartsBio
client = SmartsBio(api_key="sk_live_...")
response = client.query.run(
"Run BLAST for ATGCGTAACCGTAA and find homologs in nr database",
workspace_id="ws_abc",
)
print(response.answer)
Full documentation → smarts.bio/docs
What can you do?
Ask the AI agent anything — it orchestrates the right tools automatically:
| Category | Tools |
|---|---|
| Sequence analysis | BLAST, HMMER, Clustal Omega, MUSCLE |
| Variant calling | GATK HaplotypeCaller, FreeBayes, DeepVariant |
| Alignment | BWA-MEM, STAR, HISAT2, Bowtie2 |
| Structure prediction | AlphaFold, RoseTTAFold, ESMFold |
| RNA-seq / expression | DESeq2, edgeR, Salmon, kallisto |
| Genome annotation | Prokka, Augustus, BRAKER |
| Literature & databases | PubMed, NCBI Gene, UniProt, STRING, ClinVar |
| Pipelines | WES alignment, somatic variant calling, RNA-seq differential expression |
These are just some of the tools available. See the full updated list at smarts.bio/docs.
Installation
pip install smarts-bio
Requirements: Python 3.9+. Single dependency: httpx.
Authentication
# Pass directly
client = SmartsBio(api_key="sk_live_...")
# Or set SMARTSBIO_API_KEY environment variable
client = SmartsBio()
Generate your key at chat.smarts.bio → Organization Settings → API Keys.
Examples
Ask a bioinformatics question
response = client.query.run(
"Find BRCA1 variants associated with breast cancer and summarize the evidence",
workspace_id="ws_abc",
)
print(response.answer)
Real-time streaming
for chunk in client.query.stream("Align these reads to GRCh38", workspace_id="ws_abc"):
if chunk.type == "status":
print(f"[{chunk.status}]")
elif chunk.type == "content":
print(chunk.content, end="", flush=True)
elif chunk.type == "done":
print("\nDone.")
Run a bioinformatics pipeline
# Upload your FASTQ files
r1 = client.files.upload("sample_R1.fastq.gz", "ws_abc")
r2 = client.files.upload("sample_R2.fastq.gz", "ws_abc")
# Launch a WES alignment pipeline
pipeline = client.pipelines.create(
"ws_abc",
input={"fastq_r1": r1.key, "fastq_r2": r2.key, "reference": "GRCh38"},
pipeline_id="alignment-wes",
)
# Wait for results (polls automatically)
result = client.pipelines.wait(
pipeline.id,
"ws_abc",
on_progress=lambda p: print(f" {p.progress_pct}% — {p.current_step}"),
)
Async client
import asyncio
from smartsbio import SmartsBioAsync
async def main():
async with SmartsBioAsync(api_key="sk_live_...") as client:
response = await client.query.run(
"Find BRCA1 variants",
workspace_id="ws_abc",
)
print(response.answer)
asyncio.run(main())
Visualize results
result = client.visualizations.viewer_url("orgs/.../variants.vcf", "ws_abc")
print(f"Open in browser: {result.viewer_url}")
SDK Modules
| Module | Description |
|---|---|
client.query |
Ask the AI agent — sync or streaming SSE |
client.workspaces |
List and manage workspaces |
client.conversations |
Retrieve conversation history |
client.tools |
List available tools and run them directly |
client.files |
Upload, download, and manage files |
client.pipelines |
Launch and monitor long-running bioinformatics pipelines |
client.visualizations |
Generate shareable viewer URLs and render plots |
Error Handling
from smartsbio import AuthenticationError, PermissionDeniedError, RateLimitError, APIError
try:
client.query.run("...")
except AuthenticationError:
print("Invalid API key")
except PermissionDeniedError as e:
print(f"Key lacks required scope: {e.required_scope}")
except RateLimitError as e:
print(f"Rate limited — retry after {e.retry_after}s")
except APIError as e:
print(f"API error {e.status}: {e.message}")
Configuration
client = SmartsBio(
api_key="sk_live_...",
timeout=120, # seconds (default: 120)
max_retries=3, # retries on 429 / 5xx (default: 3)
)
More Examples
See the examples/ directory:
query_sync.py— basic AI queryquery_stream.py— real-time streaming outputquery_async.py— async client with streaminglist_tools.py— enumerate available toolsupload_and_pipeline.py— upload files and run a pipelineviewer_url.py— generate a bio-viewer link
Documentation & Support
- Full docs: smarts.bio/docs
- Platform: smarts.bio
- Issues: GitHub Issues
- Email: support@smarts.bio
Built with ❤️ by the smarts.bio team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smarts_bio-0.1.0.tar.gz.
File metadata
- Download URL: smarts_bio-0.1.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e229772ce96cdff9b1af3fbcfde8d1ea364090e847bd52bfcd1cbadc7350f9aa
|
|
| MD5 |
819619f4d7d7c456f3f236fc38f71c45
|
|
| BLAKE2b-256 |
1e109adb01e7f08d7e669f527ba827436fdba5682f996be5b599724dcfd741b2
|
File details
Details for the file smarts_bio-0.1.0-py3-none-any.whl.
File metadata
- Download URL: smarts_bio-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4365572bc305fb1e4c2e92a3582b59d470e1b965464cd0b6d2782ccbf15a472d
|
|
| MD5 |
f1a8f1d4b5eec40decb5e393eff64387
|
|
| BLAKE2b-256 |
b4f3868deaa64f6023c4921b5ade9131c3e238523529bc9d9ed412d8f0273878
|