{"data":{"slug":"github-aipoch-medical-research-skills-scientific-skills-data-analysis-torchdrug-english-bb1aef9c057b","title":"TorchDrug for Molecular and Protein Analysis","summary":"A PyTorch-native framework for building custom GNN models in drug discovery, protein modeling, and knowledge graph reasoning. Users can predict molecular properties, enzyme functions, and identify new disease treatments using biomedical knowledge graphs.","url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-data-analysis-torchdrug-english-bb1aef9c057b","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-aipoch-medical-research-skills-scientific-skills-data-analysis-torchdrug-english-bb1aef9c057b","markdown_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-data-analysis-torchdrug-english-bb1aef9c057b.md","download_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-data-analysis-torchdrug-english-bb1aef9c057b\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"Ensure Python 3.10+ is installed before running any commands. Use the documented workflow in SKILL.md and reference materials in the 'references\/' folder for task-specific guidance. The first deliverable is a structured result tied to the requested task, such as model predictions or evaluation metrics.","instructions":"---\nname: torchdrug-english\ndescription: PyTorch-native Graph Neural Network framework for molecules and proteins. Suitable for building custom GNN architectures for drug discovery, protein modeling, or knowledge graph reasoning. Best for custom model development, protein property prediction, and retrosynthesis. If you need pretrained models and diverse feature extractors, use deepchem; if you need benchmark datasets, use pytdc.\nlicense: MIT\nauthor: AIPOCH\n---\n> **Source**: [https:\/\/github.com\/aipoch\/medical-research-skills](https:\/\/github.com\/aipoch\/medical-research-skills)\n\n# TorchDrug\n\n## When to Use\n\n- Use this skill when you need pytorch-native graph neural network framework for molecules and proteins. suitable for building custom gnn architectures for drug discovery, protein modeling, or knowledge graph reasoning. best for custom model development, protein property prediction, and retrosynthesis. if you need pretrained models and diverse feature extractors, use deepchem; if you need benchmark datasets, use pytdc in a reproducible workflow.\n- Use this skill when a data analytics task needs a packaged method instead of ad-hoc freeform output.\n- Use this skill when the user expects a concrete deliverable, validation step, or file-based result.\n- Use this skill when `the documented workflow in this package` is the most direct path to complete the request.\n- Use this skill when you need the `TorchDrug (English)` package behavior rather than a generic answer.\n\n## Key Features\n\n- Scope-focused workflow aligned to: PyTorch-native Graph Neural Network framework for molecules and proteins. Suitable for building custom GNN architectures for drug discovery, protein modeling, or knowledge graph reasoning. Best for custom model development, protein property prediction, and retrosynthesis. If you need pretrained models and diverse feature extractors, use deepchem; if you need benchmark datasets, use pytdc.\n- Documentation-first workflow with no packaged script requirement.\n- Reference material available in `references\/` for task-specific guidance.\n- Structured execution path designed to keep outputs consistent and reviewable.\n\n## Dependencies\n\n- `Python`: `3.10+`. Repository baseline for current packaged skills.\n- `Third-party packages`: `not explicitly version-pinned in this skill package`. Add pinned versions if this skill needs stricter environment control.\n\n## Example Usage\n\n```text\nSkill directory: 20260316\/scientific-skills\/Data Analytics\/TorchDrug-English\nNo packaged executable script was detected.\nUse the documented workflow in SKILL.md together with the references\/assets in this folder.\n```\n\nExample run plan:\n1. Read the skill instructions and collect the required inputs.\n2. Follow the documented workflow exactly.\n3. Use packaged references\/assets from this folder when the task needs templates or rules.\n4. Return a structured result tied to the requested deliverable.\n\n## Implementation Details\n\nSee `## Overview` above for related details.\n\n- Execution model: validate the request, choose the packaged workflow, and produce a bounded deliverable.\n- Input controls: confirm the source files, scope limits, output format, and acceptance criteria before running any script.\n- Primary implementation surface: instruction-only workflow in `SKILL.md`.\n- Reference guidance: `references\/` contains supporting rules, prompts, or checklists.\n- Parameters to clarify first: input path, output path, scope filters, thresholds, and any domain-specific constraints.\n- Output discipline: keep results reproducible, identify assumptions explicitly, and avoid undocumented side effects.\n\n## Overview\n\nTorchDrug is a PyTorch-based comprehensive machine learning toolbox designed for drug discovery and molecular science. It applies graph neural networks, pretrained models, and task definitions to molecules, proteins, and biological knowledge graphs, covering molecular property prediction, protein modeling, knowledge graph reasoning, molecular generation, retrosynthesis planning, and more, including 40+ curated datasets and 20+ model architectures.\n\n## When to Use This Skill\n\nUse this skill when dealing with the following:\n\n**Data Types:**\n- SMILES strings or molecular structures\n- Protein sequences or 3D structures (PDB files)\n- Reactions and retrosynthesis\n- Biomedical knowledge graphs\n- Drug discovery datasets\n\n**Tasks:**\n- Predict molecular properties (solubility, toxicity, activity)\n- Protein function or structure prediction\n- Drug-target binding prediction\n- Generate new molecular structures\n- Plan chemical synthesis routes\n- Link prediction in biomedical knowledge bases\n- Train graph neural networks on scientific data\n\n**Libraries and Integration:**\n- TorchDrug as core library\n- Often with RDKit for cheminformatics\n- PyTorch and PyTorch Lightning compatibility\n- Integrated AlphaFold and ESM for proteins\n\n## Getting Started\n\n### Installation\n\n```bash\npip install torchdrug\n```\n\n- Or install full version with optional dependencies\n\n```bash\npip install torchdrug[full]\n```\n\n### Quick Example\n\n```python\nfrom torchdrug import datasets, models, tasks\nfrom torch.utils.data import DataLoader\nimport torch\n\n# Load molecular dataset\ndataset = datasets.BBBP(\"~\/molecule-datasets\/\")\ntrain_set, valid_set, test_set = dataset.split()\n\n# Define GNN model\nmodel = models.GIN(\n    input_dim=dataset.node_feature_dim,\n    hidden_dims=[256, 256, 256],\n    edge_input_dim=dataset.edge_feature_dim,\n    batch_norm=True,\n    readout=\"mean\"\n)\n\n# Create property prediction task\ntask = tasks.PropertyPrediction(\n    model,\n    task=dataset.tasks,\n    criterion=\"bce\",\n    metric=[\"auroc\", \"auprc\"]\n)\n\n# Train with PyTorch\noptimizer = torch.optim.Adam(task.parameters(), lr=1e-3)\ntrain_loader = DataLoader(train_set, batch_size=32, shuffle=True)\n\nfor epoch in range(100):\n    for batch in train_loader:\n        loss = task(batch)\n        optimizer.zero_grad()\n        loss.backward()\n        optimizer.step()\n```\n\n## Core Capabilities\n\n### 1. Molecular Property Prediction\n\nPredict chemical, physical, and biological properties from molecular structures.\n\n**Use Cases:**\n- Drug-likeness and ADMET properties\n- Toxicity screening\n- Quantum chemical properties\n- Binding affinity prediction\n\n**Core Components:**\n- 20+ molecular datasets (BBBP, HIV, Tox21, QM9, etc.)\n- GNN models (GIN, GAT, SchNet)\n- `PropertyPrediction` and `MultipleBinaryClassification` tasks\n\n**Reference:** See molecular_property_prediction.md\n\n### 2. Protein Modeling\n\nProcess protein sequences, structures, and properties.\n\n**Use Cases:**\n- Enzyme function prediction\n- Protein stability and solubility\n- Subcellular localization\n- Protein-protein interactions\n- Structure prediction\n\n**Core Components:**\n- 15+ protein datasets (EnzymeCommission, GeneOntology, PDBBind, etc.)\n- Sequence models (ESM, ProteinBERT, ProteinLSTM)\n- Structure models (GearNet, SchNet)\n- Multiple task types for different prediction levels\n\n**Reference:** See protein_modeling.md\n\n### 3. Knowledge Graph Reasoning\n\nPredict missing links and relations in biomedical knowledge graphs.\n\n**Use Cases:**\n- Drug repurposing\n- Disease mechanism discovery\n- Gene-disease associations\n- Multi-hop biomedical reasoning\n\n**Core Components:**\n- General KGs (FB15k, WN18) and biomedical KGs (Hetionet)\n- Embedding models (TransE, RotatE, ComplEx)\n- `KnowledgeGraphCompletion` task\n\n**Reference:** See knowledge_graphs.md\n\n### 4. Molecular Generation\n\nGenerate novel molecular structures with desired properties.\n\n**Use Cases:**\n- De novo drug design\n- Lead compound optimization\n- Chemical space exploration\n- Property-directed generation\n\n**Core Components:**\n- Autoregressive generation\n- GCPN (policy-based generation)\n- `GraphAutoregressiveFlow`\n- Property optimization workflows\n\n**Reference:** See molecular_generation.md\n\n### 5. Retrosynthesis\n\nPredict synthesis routes from target molecules to starting materials.\n\n**Use Cases:**\n- Synthesis planning\n- Route optimization\n- Synthesizability assessment\n- Multi-step planning\n\n**Core Components:**\n- USPTO-50k reaction dataset\n- `CenterIdentification` (reaction center prediction)\n- `SynthonCompletion` (reactant prediction)\n- End-to-end retrosynthesis pipeline\n\n**Reference:** See retrosynthesis.md\n\n### 6. Graph Neural Network Models\n\nComprehensive catalog of GNN architectures for different data types and tasks.\n\n**Available Models:**\n- General GNN: GCN, GAT, GIN, RGCN, MPNN\n- 3D-aware: SchNet, GearNet\n- Protein-specific: ESM, ProteinBERT, GearNet\n- Knowledge graphs: TransE, RotatE, ComplEx, SimplE\n- Generative: GraphAutoregressiveFlow\n\n**Reference:** See models_architectures.md\n\n### 7. Datasets\n\n40+ curated datasets covering chemistry, biology, and knowledge graphs.\n\n**Categories:**\n- Molecular properties (drug discovery, quantum chemistry)\n- Protein properties (function, structure, interactions)\n- Knowledge graphs (general and biomedical)\n- Retrosynthesis reactions\n\n**Reference:** See datasets.md\n\n## Common Workflows\n\n### Workflow 1: Molecular Property Prediction\n\nScenario: Predict blood-brain barrier permeability for drug candidates.\nSteps:\n- Load dataset: datasets.BBBP()\n- Choose model: GNN for molecular graphs (e.g., GIN)\n- Define task: PropertyPrediction with binary classification\n- Train using scaffold split for realistic evaluation\n- Evaluate with AUROC and AUPRC\n\nNavigation: references\/molecular_property_prediction.md \u2192 Dataset Selection \u2192 Model Selection \u2192 Training\n\n### Workflow 2: Protein Function Prediction\n\nScenario: Predict enzyme function from sequence.\nSteps:\n- Load dataset: datasets.EnzymeCommission()\n- Choose model: pretrained ESM or GearNet with structure\n- Define task: PropertyPrediction with multi-class classification\n- Finetune pretrained model or train from scratch\n- Evaluate with accuracy and per-class metrics\n\nNavigation: references\/protein_modeling.md \u2192 Model Selection (Sequence vs Structure) \u2192 Pretraining Strategies\n\n### Workflow 3: Drug Repurposing via Knowledge Graph\n\nScenario: Find new disease treatments in Hetionet.\nSteps:\n- Load dataset: datasets.Hetionet()\n- Choose model: RotatE or ComplEx\n- Define task: KnowledgeGraphCompletion\n- Train with negative sampling\n- Query predictions for compound-treats-disease\n- Filter by plausibility and mechanism\n\nNavigation: references\/knowledge_graphs.md \u2192 Hetionet Dataset \u2192 Model Selection \u2192 Biomedical Applications\n","use_cases":["Predict blood-brain barrier permeability for drug candidates","Predict enzyme function from protein sequences","Find new disease treatments using biomedical knowledge graphs"],"limitations":[],"compatibility":[],"setup_tip":"```bash\npip install torchdrug\n```\n\n- Or install full version with optional dependencies\n\n```bash\npip install torchdrug[full]\n```","sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/aipoch\/medical-research-skills\/blob\/686e09dfdb45d9fa1a08664f06bb93769b3c9d91\/scientific-skills\/Data%20Analysis\/TorchDrug-English\/SKILL.md","source_commit":"686e09dfdb45d9fa1a08664f06bb93769b3c9d91","license":"MIT","version":null,"listing_approved_at":"2026-11-24","created_at":"2026-11-23T10:54:39.000000Z","updated_at":"2026-11-24T07:14:40.000000Z","seo_title":"TorchDrug for Molecular and Protein Analysis","seo_description":"TorchDrug is a PyTorch-native framework for building custom GNN models for drug discovery, protein modeling, and knowledge graph reasoning.","seo_keywords":["drug discovery GNN","protein function prediction","biomedical knowledge graph","molecular property prediction","TorchDrug framework"]}}