Skip to main content

Structural Biology

Structure retrieval, comparison, and active site analysis using direct PDB tool calls and file upload/download.

Upload a PDB file → run structure analysis → download report

Upload your own PDB (e.g., from AlphaFold or cryo-EM), run secondary structure and surface electrostatics analysis, then download the report.

from smartsbio import SmartsBio

client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id

# 1. Upload PDB file
pdb = client.files.upload("model.pdb", workspace_id=ws_id, path="structures/")
print(f"Uploaded: {pdb['key']}")

# 2. Run structural analysis
analysis = client.tools.run(
    tool_id="pdb_structure_analysis",
    input={
        "file_path": pdb["key"],
        "workspace_id": ws_id,
        "analyses": ["secondary_structure", "solvent_accessibility", "disulfide_bonds", "metal_sites"],
        "output_path": "structures/reports/",
    },
)
print(f"Chains    : {', '.join(analysis['chains'])}")
print(f"Alpha-helix: {analysis['helix_pct']:.1f}%  Beta-sheet: {analysis['sheet_pct']:.1f}%")
print(f"Disulfides : {analysis['n_disulfides']}")

# 3. Download full report PDF
report = client.files.download(analysis["report_path"], workspace_id=ws_id, dest="./output/")
print(f"Report saved to {report}")

PDB structure lookup and download

Retrieve metadata and coordinates for a PDB entry, and save the structure file to your workspace.

from smartsbio import SmartsBio

client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id

# Fetch PDB metadata + download structure to workspace
result = client.tools.run(
    tool_id="pdb_fetch",
    input={
        "pdb_id": "6LU7",          # SARS-CoV-2 main protease
        "workspace_id": ws_id,
        "output_path": "structures/",
        "format": "pdb",
    },
)

print(f"Title      : {result['title']}")
print(f"Method     : {result['method']}")
print(f"Resolution : {result['resolution_a']} Å")
print(f"Chains     : {result['chains']}")
print(f"Ligands    : {', '.join(result['ligands'])}")
print(f"Saved to   : {result['file_path']}")

AlphaFold structure retrieval and comparison

Fetch an AlphaFold predicted structure by UniProt ID, compare it against the experimental PDB structure, and download the superposition report.

from smartsbio import SmartsBio

client = SmartsBio(api_key="sk_live_...")
ws_id = client.workspaces.list()[0].id

# 1. Fetch AlphaFold structure
af = client.tools.run(
    tool_id="alphafold_fetch",
    input={
        "uniprot_id": "P00533",    # EGFR
        "workspace_id": ws_id,
        "output_path": "structures/alphafold/",
    },
)
print(f"pLDDT mean: {af['mean_plddt']:.1f}  (high-confidence residues: {af['high_conf_pct']:.0f}%)")

# 2. Compare with experimental PDB
comp = client.tools.run(
    tool_id="structure_compare",
    input={
        "reference": af["file_path"],    # AlphaFold model
        "query_pdb_id": "3NJP",             # Experimental EGFR kinase domain
        "workspace_id": ws_id,
        "output_path": "structures/comparison/",
    },
)
print(f"RMSD (Cα): {comp['rmsd_ca']:.2f} Å  over {comp['n_aligned']} residues")

# 3. Download superposition report
report = client.files.download(comp["report_path"], workspace_id=ws_id, dest="./")
print(f"Report saved to {report}")