scientific-skills/Evidence Insights/drugbank-database/SKILL.md
Programmatic access to DrugBank drug and target data; use when you need to download, parse, and analyze DrugBank XML for properties, interactions, pathways, and pharmacology.
npx skillsauth add aipoch/medical-research-skills drugbank-databaseInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
drugbank-downloader (requires DrugBank access).lxml for reliable extraction of nested DrugBank entities.pandas DataFrames for filtering, joining, and export.networkx (e.g., DDI graphs, drug–target bipartite graphs).rdkit for structure-based processing (e.g., SMILES/InChI handling when present).drugbank-downloader (version varies by your environment)lxml>=4.9pandas>=2.0networkx>=3.0rdkit>=2022.09 (optional; required only for structure/chemistry workflows)"""
End-to-end example:
1) Parse a local DrugBank XML file
2) Extract a minimal drug table
3) Extract drug-drug interactions
4) Build a DDI graph
Prerequisites:
- You must obtain DrugBank XML via your DrugBank account/license.
- Place the XML file at ./drugbank.xml (or update the path).
"""
from lxml import etree
import pandas as pd
import networkx as nx
DRUGBANK_XML_PATH = "./drugbank.xml"
NS = {"db": "http://www.drugbank.ca"} # DrugBank XML namespace
# --- Parse XML ---
tree = etree.parse(DRUGBANK_XML_PATH)
root = tree.getroot()
# --- Extract drug records (minimal fields) ---
drugs = []
for drug in root.xpath("//db:drug", namespaces=NS):
drugbank_id = drug.xpath("string(db:drugbank-id[@primary='true'])", namespaces=NS).strip()
name = drug.xpath("string(db:name)", namespaces=NS).strip()
drug_type = drug.get("type", "").strip()
# Optional: first SMILES if present
smiles = drug.xpath(
"string(db:calculated-properties/db:property[db:kind='SMILES']/db:value)",
namespaces=NS,
).strip()
drugs.append(
{
"drugbank_id": drugbank_id,
"name": name,
"type": drug_type,
"smiles": smiles or None,
}
)
drugs_df = pd.DataFrame(drugs).dropna(subset=["drugbank_id"])
print("Drugs:", len(drugs_df))
print(drugs_df.head())
# --- Extract drug-drug interactions ---
interactions = []
for drug in root.xpath("//db:drug", namespaces=NS):
src_id = drug.xpath("string(db:drugbank-id[@primary='true'])", namespaces=NS).strip()
src_name = drug.xpath("string(db:name)", namespaces=NS).strip()
for ddi in drug.xpath("db:drug-interactions/db:drug-interaction", namespaces=NS):
tgt_id = ddi.xpath("string(db:drugbank-id)", namespaces=NS).strip()
tgt_name = ddi.xpath("string(db:name)", namespaces=NS).strip()
description = ddi.xpath("string(db:description)", namespaces=NS).strip()
if src_id and tgt_id:
interactions.append(
{
"source_id": src_id,
"source_name": src_name,
"target_id": tgt_id,
"target_name": tgt_name,
"description": description or None,
}
)
ddi_df = pd.DataFrame(interactions)
print("Interactions:", len(ddi_df))
print(ddi_df.head())
# --- Build a DDI graph ---
G = nx.from_pandas_edgelist(
ddi_df,
source="source_id",
target="target_id",
edge_attr=["description"],
create_using=nx.Graph(),
)
print("DDI graph nodes:", G.number_of_nodes())
print("DDI graph edges:", G.number_of_edges())
# Example analysis: top 10 drugs by interaction degree
top_degree = sorted(G.degree, key=lambda x: x[1], reverse=True)[:10]
top_degree_df = pd.DataFrame(top_degree, columns=["drugbank_id", "degree"]).merge(
drugs_df[["drugbank_id", "name"]],
on="drugbank_id",
how="left",
)
print(top_degree_df)
Access & authentication
drugbank-downloader step is responsible for fetching the release artifacts; ensure you comply with DrugBank terms.XML parsing approach
lxml.etree is used for robust XPath-based extraction.http://www.drugbank.ca); XPath queries must include the namespace mapping (e.g., NS = {"db": "http://www.drugbank.ca"}).Core extraction patterns
db:drugbank-id[@primary='true']db:namedb:calculated-properties/db:property[db:kind='SMILES']/db:valuedb:drug-interactions/db:drug-interaction with fields db:drugbank-id, db:name, db:descriptionData modeling
pandas DataFrames for normalized tables (drugs, targets, interactions, pathways).networkx for graph representations:
description as edge attribute).Performance considerations
etree.iterparse) and writing intermediate results to disk.Further references
references/data-access.mdreferences/drug-queries.mdreferences/interactions.mdtools
Generates complete conventional oncology bulk-transcriptome biomarker and hub-gene research designs from a user-provided cancer type and study direction. Always use this skill whenever a user wants to design, plan, or build a tumor bioinformatics study centered on differential expression, prognostic filtering or risk modeling, PPI-based hub-gene prioritization, diagnostic/prognostic evaluation, clinical association, immune infiltration context, methylation context, and optional tissue or cell validation. Covers five study patterns (signature-first prognostic workflow, hub-gene-first biomarker workflow, hybrid signature-to-hub workflow, immune-context biomarker workflow, translational validation workflow) and always outputs four workload configs (Lite / Standard / Advanced / Publication+) with recommended primary plan, step-by-step workflow, figure plan, validation strategy, minimal executable version, publication upgrade path...
development
Generates complete conventional non-oncology bioinformatics research designs from a user-provided disease context, process-related gene family or biological theme, and validation direction. Use when a study centers on multi-dataset bulk transcriptome integration, DEG analysis, process-gene intersection, enrichment analysis, GSEA, PPI hub-gene prioritization, TF/miRNA regulatory networks, ROC-based biomarker evaluation, and immune infiltration analysis. Covers five study patterns (process-DEG discovery, enrichment/GSEA interpretation, hub-gene prioritization, regulatory-network and immune interpretation, multi-layer public validation) and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.
tools
Plans confounder control, variable adjustment logic, and bias mitigation strategies at the protocol stage for clinical, epidemiologic, translational, observational, and biomarker studies. Always use this skill when a user needs to identify major confounders, decide which variables should or should not be adjusted for, compare matching/stratification/weighting approaches, anticipate selection or measurement bias, or pressure-test a study design before execution. Focus on bias sensing, causal structure awareness, variable-role classification, and critical design review rather than generic statistical advice.
testing
Generates complete comparative network-toxicology research designs from a user-provided exposure pair, shared toxic phenotype, and validation direction. Use when a study centers on two related exposures under one outcome and needs target collection, shared-vs-specific target decomposition, enrichment, PPI hub prioritization, docking, optional transcriptomic cross-checks, and conservative mechanistic synthesis. Covers five study patterns and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.