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}")import { SmartsBio } from '@smartsbio/sdk';
const client = new SmartsBio({ apiKey: 'sk_live_...' });
const [workspace] = await client.workspaces.list();
// 1. Upload PDB file
const pdb = await client.files.upload('./model.pdb', {
workspaceId: workspace.id,
path: 'structures/',
});
console.log('Uploaded:', pdb.key);
// 2. Run structural analysis
const analysis = await client.tools.run('pdb_structure_analysis', {
input: {
filePath: pdb.key,
workspaceId: workspace.id,
analyses: ['secondary_structure', 'solvent_accessibility', 'disulfide_bonds', 'metal_sites'],
outputPath: 'structures/reports/',
},
});
console.log('Chains :', analysis.chains.join(', '));
console.log(`Alpha-helix: ${analysis.helixPct.toFixed(1)}% Beta-sheet: ${analysis.sheetPct.toFixed(1)}%`);
console.log('Disulfides :', analysis.nDisulfides);
// 3. Download report
const report = await client.files.download(analysis.reportPath, workspace.id, './output/');
console.log('Report saved to', report);# 1. Upload PDB file
FILE_PATH=$(curl -s -X POST https://api.smarts.bio/v1/files/upload \
-H "Authorization: Bearer sk_live_..." \
-F "file=@model.pdb" -F "workspace_id=ws_abc123" -F "path=structures/" \
| jq -r '.data.path')
# 2. Run structural analysis
curl -s -X POST https://api.smarts.bio/v1/tools/pdb_structure_analysis/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"input": {"file_path": "'"$FILE_PATH"'", "workspace_id": "ws_abc123", "analyses": ["secondary_structure", "solvent_accessibility", "disulfide_bonds", "metal_sites"], "output_path": "structures/reports/"}}' \
| jq '{chains, helix_pct, sheet_pct, n_disulfides, report_path}'# 1. Upload the PDB file smarts file upload model.pdb --to structures/ # 2. Run structural analysis smarts tool run pdb_structure_analysis \ --param file_path=structures/model.pdb \ --param analyses=secondary_structure,solvent_accessibility,disulfide_bonds,metal_sites \ --param output_path=structures/reports/ # 3. Download the full report smarts file download structures/reports/ -o ./output/
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']}")import { SmartsBio } from '@smartsbio/sdk';
const client = new SmartsBio({ apiKey: 'sk_live_...' });
const [workspace] = await client.workspaces.list();
const result = await client.tools.run('pdb_fetch', {
input: {
pdbId: '6LU7',
workspaceId: workspace.id,
outputPath: 'structures/',
format: 'pdb',
},
});
console.log('Title :', result.title);
console.log('Method :', result.method);
console.log('Resolution :', result.resolutionA, 'Å');
console.log('Chains :', result.chains);
console.log('Ligands :', result.ligands.join(', '));
console.log('Saved to :', result.filePath);curl -X POST https://api.smarts.bio/v1/tools/pdb_fetch/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"input": {
"pdb_id": "6LU7",
"workspace_id": "ws_abc123",
"output_path": "structures/",
"format": "pdb"
}
}'# Fetch PDB metadata + download structure to workspace # (6LU7 = SARS-CoV-2 main protease) smarts tool run pdb_fetch \ --param pdb_id=6LU7 \ --param output_path=structures/ \ --param format=pdb
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}")import { SmartsBio } from '@smartsbio/sdk';
const client = new SmartsBio({ apiKey: 'sk_live_...' });
const [workspace] = await client.workspaces.list();
// 1. Fetch AlphaFold structure
const af = await client.tools.run('alphafold_fetch', {
input: {
uniprotId: 'P00533', // EGFR
workspaceId: workspace.id,
outputPath: 'structures/alphafold/',
},
});
console.log(`pLDDT mean: ${af.meanPlddt.toFixed(1)} high-conf: ${af.highConfPct.toFixed(0)}%`);
// 2. Structural comparison
const comp = await client.tools.run('structure_compare', {
input: {
reference: af.filePath,
queryPdbId: '3NJP',
workspaceId: workspace.id,
outputPath: 'structures/comparison/',
},
});
console.log(`RMSD (Cα): ${comp.rmsdCa.toFixed(2)} Å over ${comp.nAligned} residues`);
// 3. Download report
const report = await client.files.download(comp.reportPath, workspace.id, './');
console.log('Report saved to', report);# 1. Fetch AlphaFold structure
AF_FILE=$(curl -s -X POST https://api.smarts.bio/v1/tools/alphafold_fetch/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"input": {"uniprot_id": "P00533", "workspace_id": "ws_abc123", "output_path": "structures/alphafold/"}}' \
| tee /dev/stderr | jq -r '.file_path')
# 2. Compare with experimental PDB (3NJP)
curl -s -X POST https://api.smarts.bio/v1/tools/structure_compare/run \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d "{\"input\": {\"reference\": \"$AF_FILE\", \"query_pdb_id\": \"3NJP\", \"workspace_id\": \"ws_abc123\", \"output_path\": \"structures/comparison/\"}}" \
| jq '{rmsd_ca, n_aligned, report_path}'# 1. Fetch AlphaFold structure (EGFR) smarts tool run alphafold_fetch \ --param uniprot_id=P00533 \ --param output_path=structures/alphafold/ # 2. Compare with experimental PDB (3NJP = EGFR kinase domain) smarts tool run structure_compare \ --param reference=structures/alphafold/P00533.pdb \ --param query_pdb_id=3NJP \ --param output_path=structures/comparison/ # 3. Download the superposition report smarts file download structures/comparison/ -o ./