31DrugProt — Drug-Protein Relation Query

SkillProductivity

Query drug/chemical and gene/protein entities in the BioCreative VII DrugProt dataset. Returns annotated relations (e.g., INHIBITOR, ACTIVATOR, SUBSTRATE) between chemicals and genes/proteins from biomedical literature.

Instructions available. Your AI can read the instructions. Execution depends on the setup they require.

Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.

Then ask your AI: use the 31DrugProt skill

About this skill

🦀 Agentic RAG for drug intelligence · 57 skills · 15 task categories · DTI · ADR · DDI · PGx · Repurposing · Powered by LangGraph

What this skill tells your AI

The instructions your AI receives, as published by qsong-github/drugclaw in skills/drug_nlp/drugprot/SKILL.md and read by ahel’s review.

Overview

Query drug/chemical and gene/protein entities in the BioCreative VII DrugProt dataset. Returns annotated relations (e.g., INHIBITOR, ACTIVATOR, SUBSTRATE) between chemicals and genes/proteins from biomedical literature.

Data Location

DrugClaw/
├── skills/drug_nlp/drugprot/
│   └── example.py                  ← helper script
└── resources_metadata/drug_nlp/DrugProt/
    └── drugprot-gs-training-development/
        ├── training/
        │   ├── drugprot_training_abstracs.tsv
        │   ├── drugprot_training_entities.tsv
        │   └── drugprot_training_relations.tsv
        ├── development/
        │   ├── drugprot_development_abstracs.tsv
        │   ├── drugprot_development_entities.tsv
        │   └── drugprot_development_relations.tsv
        └── test-background/
            ├── test_background_abstracts.tsv
            └── test_background_entities.tsv

Use the repo-local resources_metadata/drug_nlp/DrugProt/drugprot-gs-training-development path, or override it with the DRUGPROT_DIR environment variable if your dataset lives elsewhere.

All three splits are loaded by default. Note: test-background has no relations file (relations are the prediction target).

Quick Start

from importlib.util import spec_from_file_location, module_from_spec

# Load module
spec = spec_from_file_location("drugprot", "/path/to/skills/drug_nlp/drugprot/example.py")
dp = module_from_spec(spec)
spec.loader.exec_module(dp)

# Load dataset (one-time, ~2 s)
ds = dp.load_dataset("/path/to/drugprot-gs-training-development")

# Query single entity
results = dp.query_entities(ds, "aspirin")
print(dp.format_results(results))

# Query multiple entities
results = dp.query_entities(ds, ["metformin", "insulin", "EGFR"])
print(dp.format_results(results))

API

load_dataset(base_dir, splits=["training","development","test-background"]) -> dict

Loads and indexes all TSV files. Returns a dict with keys: abstracts, entities, relations, name_index.

query_entities(dataset, names, case_sensitive=False) -> list[dict]

ParameterTypeDescription
datasetdictOutput of load_dataset()
namesstr or list[str]Entity name(s) to query
case_sensitiveboolDefault False; falls back to substring match if exact match fails

Returns a list of result dicts, one per query name:

[
  {
    "query": "aspirin",
    "matches": [
      {
        "pmid": "12345678",
        "entity_id": "T3",
        "entity_type": "CHEMICAL",
        "entity_text": "aspirin",
        "relations": [
          {
            "relation_type": "INHIBITOR",
            "partner_id": "T12",
            "partner_text": "COX-2",
            "partner_type": "GENE-Y",
            "role": "arg1(chemical)"
          }
        ],
        "article_title": "Effects of aspirin on ..."
      }
    ]
  }
]

format_results(results, max_matches=5) -> str

Formats query results into a concise, LLM-readable plain-text summary.

Relation Types

TypeDescription
INHIBITORChemical inhibits gene/protein
ACTIVATORChemical activates gene/protein
AGONISTChemical is an agonist
ANTAGONISTChemical is an antagonist
SUBSTRATEChemical is a substrate
PRODUCT-OFChemical is a product of enzyme
INDIRECT-DOWNREGULATORChemical indirectly downregulates
INDIRECT-UPREGULATORChemical indirectly upregulates
DIRECT-REGULATORChemical directly regulates
PART-OFChemical is part of protein complex
COFACTORChemical acts as cofactor
NOTNegative relation
UNDEFINEDUndefined relation

CLI Usage

export DRUGPROT_DIR=/path/to/drugprot-gs-training-development
python 31_DrugProt.py aspirin insulin p53

Signals

GitHub stars
116
Forks
3
Last commit
Aug 2026
Advanced
Item type
skill
Key
drugprot
Source
github.com/qsong-github/drugclaw