DrugBank Database
Overview
DrugBank contains drug and drug-target information. The bundled helper reads a licensed local XML export; it does not include the dataset or download it automatically. Available records depend on the supplied export and its version.
Core Capabilities
1. Data Access and Authentication
Access a DrugBank export that the user is licensed to use. The skill provides guidance on:
- Supplying an explicit local XML path or a pre-loaded XML root
- Keeping licensed data out of repositories and shared artifacts
- Recording the supplied database version
- Opening and parsing XML data efficiently
- Working with cached data to optimize performance
When to use: Setting up local DrugBank analysis or diagnosing a missing export.
Reference: See references/data-access.md for loading an explicitly provided licensed export, the current availability of DrugBank downloads, the separate hosted API, and troubleshooting.
2. Drug Information Queries
Extract comprehensive drug information from the database including identifiers, chemical properties, pharmacology, clinical data, and cross-references to external databases.
Query capabilities:
- Search by DrugBank ID, name, CAS number, or keywords
- Extract basic drug information (name, type, description, indication)
- Retrieve chemical properties (SMILES, InChI, molecular formula)
- Get pharmacology data (mechanism of action, pharmacodynamics, ADME)
- Access external identifiers (PubChem, ChEMBL, UniProt, KEGG)
- Build searchable drug datasets and export to DataFrames
- Filter drugs by type (small molecule, biotech, nutraceutical)
When to use: Retrieving specific drug information, building drug databases, pharmacology research, literature review, drug profiling.
Reference: See references/drug-queries.md for XML navigation, query functions, data extraction methods, and performance optimization.
3. Drug-Drug Interactions Analysis
Analyze drug-drug interactions (DDIs) including mechanism, clinical significance, and interaction networks for pharmacovigilance and clinical decision support.
Analysis capabilities:
- Extract all interactions for specific drugs
- Build bidirectional interaction networks
- Classify interactions by severity and mechanism
- Check interactions between drug pairs
- Identify drugs with most interactions
- Analyze polypharmacy regimens for safety
- Create interaction matrices and network graphs
- Perform community detection in interaction networks
- Calculate interaction risk scores
When to use: Polypharmacy safety analysis, clinical decision support, drug interaction prediction, pharmacovigilance research, identifying contraindications.
Reference: See references/interactions.md for interaction extraction, classification methods, network analysis, and clinical applications.
4. Drug Targets and Pathways
Access detailed information about drug-protein interactions including targets, enzymes, transporters, carriers, and biological pathways.
Target analysis capabilities:
- Extract drug targets with actions (inhibitor, agonist, antagonist)
- Identify metabolic enzymes (CYP450, Phase II enzymes)
- Analyze transporters (uptake, efflux) for ADME studies
- Map drugs to biological pathways (SMPDB)
- Find drugs targeting specific proteins
- Identify drugs with shared targets for repurposing
- Analyze polypharmacology and off-target effects
- Extract Gene Ontology (GO) terms for targets
- Cross-reference with UniProt for protein data
When to use: Mechanism of action studies, drug repurposing research, target identification, pathway analysis, predicting off-target effects, understanding drug metabolism.
Reference: See references/targets-pathways.md for target extraction, pathway analysis, repurposing strategies, CYP450 profiling, and transporter analysis.
5. Chemical Properties and Similarity
Perform structure-based analysis including molecular similarity searches, property calculations, substructure searches, and ADMET predictions.
Chemical analysis capabilities:
- Extract chemical structures (SMILES, InChI, molecular formula)
- Calculate physicochemical properties (MW, logP, PSA, H-bonds)
- Apply Lipinski's Rule of Five and Veber's rules
- Calculate Tanimoto similarity between molecules
- Generate molecular fingerprints (Morgan, MACCS, topological)
- Perform substructure searches with SMARTS patterns
- Find structurally similar drugs for repurposing
- Create similarity matrices for drug clustering
- Predict oral absorption and BBB permeability
- Analyze chemical space with PCA and clustering
- Export chemical property databases
When to use: Structure-activity relationship (SAR) studies, drug similarity searches, QSAR modeling, drug-likeness assessment, ADMET prediction, chemical space exploration.
Reference: See references/chemical-analysis.md for structure extraction, similarity calculations, fingerprint generation, ADMET predictions, and chemical space analysis.
Typical Workflows
Drug Discovery Workflow
- Use
data-access.mdto load an explicitly provided licensed export - Use
drug-queries.mdto build searchable drug database - Use
chemical-analysis.mdto find similar compounds - Use
targets-pathways.mdto identify shared targets - Use
interactions.mdto check safety of candidate combinations
Polypharmacy Safety Analysis
- Use
drug-queries.mdto look up patient medications - Use
interactions.mdto check all pairwise interactions - Use
interactions.mdto classify interaction severity - Use
interactions.mdto calculate overall risk score - Use
targets-pathways.mdto understand interaction mechanisms
Drug Repurposing Research
- Use
targets-pathways.mdto find drugs with shared targets - Use
chemical-analysis.mdto find structurally similar drugs - Use
drug-queries.mdto extract indication and pharmacology data - Use
interactions.mdto assess potential combination therapies
Pharmacology Study
- Use
drug-queries.mdto extract drug of interest - Use
targets-pathways.mdto identify all protein interactions - Use
targets-pathways.mdto map to biological pathways - Use
chemical-analysis.mdto predict ADMET properties - Use
interactions.mdto identify potential contraindications
Installation Requirements
Python Packages
# The local XML helper uses only the Python standard library.
# Install only the packages needed for the selected analysis:
uv pip install lxml # XML parsing optimization
uv pip install pandas # Data manipulation
uv pip install rdkit # Chemical informatics (for similarity)
uv pip install networkx # Network analysis (for interactions)
uv pip install scikit-learn # ML/clustering (for chemical space)
Account Setup
Obtain an XML export through the user's authorized DrugBank access; the helper only
loads an explicitly provided licensed export. An account or installed downloader does
not prove download entitlement, and references/data-access.md records the current
status of DrugBank downloads. Do not fetch a different or unlicensed copy as a fallback.
From the skill directory:
from scripts.drugbank_helper import DrugBankHelper
db = DrugBankHelper(xml_path="/path/to/licensed/drugbank.xml")
print(db.get_drug_info("DB00001"))
Alternatively set DRUGBANK_XML_PATH and use DrugBankHelper(). A previously
parsed XML root is still accepted with DrugBankHelper(root=root).
Data Version and Reproducibility
Record the version and checksum of the supplied XML export in analysis metadata. Do not silently substitute an older export when the requested version is unavailable.
Best Practices
- Credentials: Use environment variables or config files, never hardcode
- Versioning: Specify exact database version for reproducibility
- Caching: Cache parsed data to avoid re-parsing the export
- Namespaces: Handle XML namespaces properly when parsing
- Validation: Validate chemical structures with RDKit before use
- Cross-referencing: Use external identifiers (UniProt, PubChem) for integration
- Clinical Context: Always consider clinical context when interpreting interaction data
- License Compliance: Ensure proper licensing for your use case
Reference Documentation
All detailed implementation guidance is organized in modular reference files:
- references/data-access.md: Loading a licensed export, download availability, parsing, hosted API, caching
- references/drug-queries.md: XML navigation, query methods, data extraction, indexing
- references/interactions.md: DDI extraction, classification, network analysis, safety scoring
- references/targets-pathways.md: Target/enzyme/transporter extraction, pathway mapping, repurposing
- references/chemical-analysis.md: Structure extraction, similarity, fingerprints, ADMET prediction
Load these references as needed based on your specific analysis requirements.