Skip to main content

Official Python SDK for the smarts.bio bioinformatics platform

Project description

smarts.bio

Official Python SDK for smarts.bio

Run BLAST, GATK, AlphaFold, BWA, DESeq2, and dozens more bioinformatics tools — all through a single API.

PyPI version documentation MIT license


Get started in 2 minutes

  1. Sign up at smarts.bio and create a free account
  2. Generate an API key — Organization Settings → API Keys
  3. 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:


Documentation & Support


Built with ❤️ by the smarts.bio team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smarts_bio-0.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smarts_bio-0.1.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

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

Hashes for smarts_bio-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e229772ce96cdff9b1af3fbcfde8d1ea364090e847bd52bfcd1cbadc7350f9aa
MD5 819619f4d7d7c456f3f236fc38f71c45
BLAKE2b-256 1e109adb01e7f08d7e669f527ba827436fdba5682f996be5b599724dcfd741b2

See more details on using hashes here.

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

Hashes for smarts_bio-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4365572bc305fb1e4c2e92a3582b59d470e1b965464cd0b6d2782ccbf15a472d
MD5 f1a8f1d4b5eec40decb5e393eff64387
BLAKE2b-256 b4f3868deaa64f6023c4921b5ade9131c3e238523529bc9d9ed412d8f0273878

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page