Query RCSB PDB for experimental protein structures. Use when user asks about crystal structures, X-ray, cryo-EM, NMR structures, or PDB IDs. Triggers on "pdb", "crystal structure", "cryo-em", "x-ray structure", "protein crystal", "experimental structure".
npx skills add https://github.com/BioTender-max/awesome-bio-agent-skills --skill query-pdb
Query the RCSB Protein Data Bank for experimental 3D structures.
import requests
import json
# 1. Text search (simple keyword)
def search_pdb(query_text, max_results=5):
url = "https://search.rcsb.org/rcsbsearch/v2/query"
query = {
"query": {
"type": "terminal",
"service": "full_text",
"parameters": {"value": query_text}
},
"return_type": "entry",
"request_options": {"paginate": {"start": 0, "rows": max_results}}
}
r = requests.post(url, json=query)
r.raise_for_status()
return r.json()
# 2. Advanced search (by gene + organism + method)
def advanced_search_pdb(gene_name, organism="Homo sapiens", method=None, max_results=5):
nodes = [
{"type": "terminal", "service": "text",
"parameters": {"attribute": "rcsb_entity_source_organism.rcsb_gene_name.value",
"operator": "exact_match", "value": gene_name}},
{"type": "terminal", "service": "text",
"parameters": {"attribute": "rcsb_entity_source_organism.ncbi_scientific_name",
"operator": "exact_match", "value": organism}}
]
if method:
nodes.append({"type": "terminal", "service": "text",
"parameters": {"attribute": "exptl.method", "operator": "exact_match", "value": method}})
query = {
"query": {"type": "group", "logical_operator": "and", "nodes": nodes},
"return_type": "entry",
"request_options": {"paginate": {"start": 0, "rows": max_results},
"sort": [{"sort_by": "rcsb_accession_info.deposit_date", "direction": "desc"}]}
}
r = requests.post("https://search.rcsb.org/rcsbsearch/v2/query", json=query)
r.raise_for_status()
return r.json()
# 3. Get entry details
def get_pdb_entry(pdb_id):
url = f"https://data.rcsb.org/rest/v1/core/entry/{pdb_id}"
r = requests.get(url)
r.raise_for_status()
return r.json()
# 4. Download structure
def download_pdb(pdb_id, output_dir="/workspace/group"):
url = f"https://files.rcsb.org/download/{pdb_id}.pdb"
r = requests.get(url)
r.raise_for_status()
path = f"{output_dir}/{pdb_id}.pdb"
with open(path, 'w') as f:
f.write(r.text)
return path
# Example
results = search_pdb("human insulin")
for hit in results.get("result_set", []):
pdb_id = hit["identifier"]
details = get_pdb_entry(pdb_id)
title = details.get("struct", {}).get("title", "N/A")
method = details.get("exptl", [{}])[0].get("method", "N/A")
resolution = details.get("rcsb_entry_info", {}).get("resolution_combined", ["N/A"])[0]
print(f"{pdb_id}: {title}")
print(f" Method: {method}, Resolution: {resolution} Å")
X-RAY DIFFRACTION — crystal structuresELECTRON MICROSCOPY — cryo-EMSOLUTION NMR — NMR in solutionEfficient database search tool for bioRxiv preprint server. Use this skill when searching for life sciences preprints by keywords, authors, date ranges, or categories, retrieving paper metadata, downloading PDFs, or conducting literature reviews.
Access BRENDA enzyme database via SOAP API. Retrieve kinetic parameters (Km, kcat), reaction equations, organism data, and substrate-specific enzyme information for biochemical research and metabolic pathway analysis.
Access ClinPGx pharmacogenomics data (successor to PharmGKB). Query gene-drug interactions, CPIC guidelines, allele functions, for precision medicine and genotype-guided dosing decisions.
Query NCBI ClinVar for variant clinical significance. Search by gene/position, interpret pathogenicity classifications, access via E-utilities API or FTP, annotate VCFs, for genomic medicine.
Access COSMIC cancer mutation database. Query somatic mutations, Cancer Gene Census, mutational signatures, gene fusions, for cancer research and precision oncology. Requires authentication.
Query Ensembl genome database REST API for 250+ species. Gene lookups, sequence retrieval, variant analysis, comparative genomics, orthologs, VEP predictions, for genomic research.
Query openFDA API for drugs, devices, adverse events, recalls, regulatory submissions (510k, PMA), substance identification (UNII), for FDA regulatory data analysis and safety research.
Query NCBI Gene via E-utilities/Datasets API. Search by symbol/ID, retrieve gene info (RefSeqs, GO, locations, phenotypes), batch lookups, for gene annotation and functional analysis.
Take biotender-max/query-pdb from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.