BioContext7

Jupyter

Use BioContext7 in Jupyter notebooks for interactive bioinformatics

Setup

Install BioContext7 in your Jupyter environment:

pip install -e "/path/to/biocontext7/packages/biocontext7[dev]"

Interactive Usage

Search for Tools

from bio_pipeline_maker.registry import BioToolsClient
 
async with BioToolsClient() as client:
    results = await client.search("RNA-seq alignment")
    for tool in results.tools:
        print(f"{tool.name}: {tool.description}")

Generate Pipelines

from bio_pipeline_maker import PipelineMaker
 
maker = PipelineMaker()
result = await maker.create(
    intent="RNA-seq from FASTQ to counts",
    target="nextflow",
)
 
if result.success:
    print(f"Tools: {result.tools_discovered}")
    print(result.files["main.nf"])

Query Protein Databases

from bio_pipeline_maker.registry import UniProtClient
 
async with UniProtClient() as client:
    protein = await client.get_protein("P53_HUMAN")
    print(f"Name: {protein.name}")
    print(f"Length: {len(protein.sequence)} aa")
    print(f"Function: {protein.function}")

Search Metabolites

from bio_pipeline_maker.registry import HMDBClient
 
async with HMDBClient() as client:
    results = await client.search("glucose")
    for metabolite in results.metabolites:
        print(f"{metabolite.name} ({metabolite.hmdb_id})")

Federated Variant Queries

from bio_pipeline_maker.registry import BeaconClient
 
async with BeaconClient("https://beacon.example.org") as client:
    response = await client.query(
        chromosome="1",
        position=12345,
        reference="A",
        alternate="G",
    )
    print(f"Variant exists: {response.exists}")

Async Support

BioContext7 uses async/await throughout. In Jupyter notebooks, you can use await directly at the top level (Jupyter handles the event loop automatically):

# This works directly in Jupyter cells
from bio_pipeline_maker.registry import BioToolsClient
 
async with BioToolsClient() as client:
    tools = await client.search("alignment")
    tools.tools[:5]

Visualization

Combine BioContext7 with common data science libraries:

import pandas as pd
from bio_pipeline_maker.registry import BioToolsClient
 
async with BioToolsClient() as client:
    results = await client.search("alignment", limit=50)
 
# Convert to DataFrame for analysis
df = pd.DataFrame([
    {"name": t.name, "operations": len(t.operations), "topics": len(t.topics)}
    for t in results.tools
])
 
df.sort_values("operations", ascending=False).head(10)

On this page