TorchDrug English

From aipoch/medical-research-skills · View interactive version

TorchDrug English is an AI agent skill from the GitHub repository aipoch/medical-research-skills. 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 mode

How to use this skill

Skill file

Source: https://github.com/aipoch/medical-research-skills

TorchDrug

When to Use

Key Features

Dependencies

Example Usage

Skill directory: 20260316/scientific-skills/Data Analytics/TorchDrug-English
No packaged executable script was detected.
Use the documented workflow in SKILL.md together with the references/assets in this folder.

Example run plan:

  1. Read the skill instructions and collect the required inputs.
  2. Follow the documented workflow exactly.
  3. Use packaged references/assets from this folder when the task needs templates or rules.
  4. Return a structured result tied to the requested deliverable.

Implementation Details

See ## Overview above for related details.

Overview

TorchDrug 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.

When to Use This Skill

Use this skill when dealing with the following:

Data Types:

Tasks:

Libraries and Integration:

Getting Started

Installation

pip install torchdrug
pip install torchdrug[full]

Quick Example

from torchdrug import datasets, models, tasks
from torch.utils.data import DataLoader
import torch

# Load molecular dataset
dataset = datasets.BBBP("~/molecule-datasets/")
train_set, valid_set, test_set = dataset.split()

# Define GNN model
model = models.GIN(
    input_dim=dataset.node_feature_dim,
    hidden_dims=[256, 256, 256],
    edge_input_dim=dataset.edge_feature_dim,
    batch_norm=True,
    readout="mean"
)

# Create property prediction task
task = tasks.PropertyPrediction(
    model,
    task=dataset.tasks,
    criterion="bce",
    metric=["auroc", "auprc"]
)

# Train with PyTorch
optimizer = torch.optim.Adam(task.parameters(), lr=1e-3)
train_loader = DataLoader(train_set, batch_size=32, shuffle=True)

for epoch in range(100):
    for batch in train_loader:
        loss = task(batch)
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()

Core Capabilities

1. Molecular Property Prediction

Predict chemical, physical, and biological properties from molecular structures.

Use Cases:

Core Components:

Reference: See molecular_property_prediction.md

2. Protein Modeling

Process protein sequences, structures, and properties.

Use Cases:

Core Components:

Reference: See protein_modeling.md

3. Knowledge Graph Reasoning

Predict missing links and relations in biomedical knowledge graphs.

Use Cases:

Core Components:

Reference: See knowledge_graphs.md

4. Molecular Generation

Generate novel molecular structures with desired properties.

Use Cases:

Core Components:

Reference: See molecular_generation.md

5. Retrosynthesis

Predict synthesis routes from target molecules to starting materials.

Use Cases:

Core Components:

Reference: See retrosynthesis.md

6. Graph Neural Network Models

Comprehensive catalog of GNN architectures for different data types and tasks.

Available Models:

Reference: See models_architectures.md

7. Datasets

40+ curated datasets covering chemistry, biology, and knowledge graphs.

Categories:

Reference: See datasets.md

Common Workflows

Workflow 1: Molecular Property Prediction

Scenario: Predict blood-brain barrier permeability for drug candidates.

Steps:

Navigation: references/molecular_property_prediction.md → Dataset Selection → Model Selection → Training

Workflow 2: Protein Function Prediction

Scenario: Predict enzyme function from sequence.

Steps:

Navigation: references/protein_modeling.md → Model Selection (Sequence vs Structure) → Pretraining Strategies

Workflow 3: Drug Repurposing via Knowledge Graph

Scenario: Find new disease treatments in Hetionet.

Steps:

Navigation: references/knowledge_graphs.md → Hetionet Dataset → Model Selection → Biomedical Applications

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.