Skill Tracer
Skills › Scientific Agent Skills › pytdc › datasets.md

datasets.md

277 lines · skills/pytdc/references/datasets.md at 5f2bc03

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1# PyTDC datasets and data access
2
3This reference targets the **PyTDC 1.1.15** source distribution, verified
42026-10-01. Dataset registries evolve independently of this skill, so query the
5installed package instead of copying a historical catalog.
6

PyTDC datasets and data access

This reference targets the PyTDC 1.1.15 source distribution, verified 2026-10-01. Dataset registries evolve independently of this skill, so query the installed package instead of copying a historical catalog.

Raw lines 1 to 6
7## Discovery is not download
8
9`tdc.metadata` contains static Python registries. Reading them does not construct a
10loader, contact Harvard Dataverse, or download a dataset:
12```bash
13uv run --no-project --isolated --python 3.11 --with "setuptools==80.9.0" --with "PyTDC==1.1.15" \
14 python scripts/discover_metadata.py --kind tasks --limit 100
16uv run --no-project --isolated --python 3.11 --with "setuptools==80.9.0" --with "PyTDC==1.1.15" \
17 python scripts/discover_metadata.py --kind datasets --task DTI --limit 100
18```
20The package helper is also metadata-only:
22```python
23from tdc.utils import retrieve_dataset_names
25# Task key is exact and case-sensitive in PyTDC 1.1.15.
26names = retrieve_dataset_names("ADME")
27```
29`retrieve_dataset_names` returns normalized package identifiers, usually lowercase.
30Pass an exact returned name to scripts. Although constructors support fuzzy
31matching, fuzzy selection can hide a typo or select an unintended resource.

Discovery is not download

tdc.metadata contains static Python registries. Reading them does not construct a loader, contact Harvard Dataverse, or download a dataset:

uv run --no-project --isolated --python 3.11 --with "setuptools==80.9.0" --with "PyTDC==1.1.15" \
  python scripts/discover_metadata.py --kind tasks --limit 100

uv run --no-project --isolated --python 3.11 --with "setuptools==80.9.0" --with "PyTDC==1.1.15" \
  python scripts/discover_metadata.py --kind datasets --task DTI --limit 100

The package helper is also metadata-only:

from tdc.utils import retrieve_dataset_names

# Task key is exact and case-sensitive in PyTDC 1.1.15.
names = retrieve_dataset_names("ADME")

retrieve_dataset_names returns normalized package identifiers, usually lowercase. Pass an exact returned name to scripts. Although constructors support fuzzy matching, fuzzy selection can hide a typo or select an unintended resource.

Raw lines 7 to 32
Runs code python scripts/discover_metadata.py :14
33## Public task imports in 1.1.15
35These names come from the stable source distribution's public `__init__.py` files,
36not from older prose catalogs.

Public task imports in 1.1.15

These names come from the stable source distribution's public __init__.py files, not from older prose catalogs.

Raw lines 33 to 37
38### Single-instance prediction
40```python
41from tdc.single_pred import (
42 ADME,
43 CRISPROutcome,
44 Develop,
45 Epitope,
46 HTS,
47 Paratope,
48 QM,
49 Tox,
50 Yields,
52```

Single-instance prediction

from tdc.single_pred import (
    ADME,
    CRISPROutcome,
    Develop,
    Epitope,
    HTS,
    Paratope,
    QM,
    Tox,
    Yields,
)
Raw lines 38 to 53
54### Multi-instance prediction
56```python
57from tdc.multi_pred import (
58 AntibodyAff,
59 Catalyst,
60 DDI,
61 DrugRes,
62 DrugSyn,
63 DTI,
64 GDA,
65 MTI,
66 PeptideMHC,
67 PPI,
68 PerturbOutcome,
69 ProteinPeptide,
70 TCREpitopeBinding,
71 TrialOutcome,
73```
75Some new task classes and resource APIs do not share the ordinary
76download-to-DataFrame contract. Confirm that a task appears both in public imports
77and `metadata.dataset_names` before using the generic loader CLI.

Multi-instance prediction

from tdc.multi_pred import (
    AntibodyAff,
    Catalyst,
    DDI,
    DrugRes,
    DrugSyn,
    DTI,
    GDA,
    MTI,
    PeptideMHC,
    PPI,
    PerturbOutcome,
    ProteinPeptide,
    TCREpitopeBinding,
    TrialOutcome,
)

Some new task classes and resource APIs do not share the ordinary download-to-DataFrame contract. Confirm that a task appears both in public imports and metadata.dataset_names before using the generic loader CLI.

Raw lines 54 to 78
79### Generation
81```python
82from tdc.generation import MolGen, Reaction, RetroSyn, SBDD
83```
85The 1.1.15 registry exposes ordinary MolGen corpora under `MolGen`, paired reaction
86data under `Reaction`/`RetroSyn`, and structure-based resources under the lowercase
87`sbdd` key. The bundled generic loader supports the verified ordinary
88MolGen/Reaction/RetroSyn paths; use specialized upstream documentation for SBDD.

Generation

from tdc.generation import MolGen, Reaction, RetroSyn, SBDD

The 1.1.15 registry exposes ordinary MolGen corpora under MolGen, paired reaction data under Reaction/RetroSyn, and structure-based resources under the lowercase sbdd key. The bundled generic loader supports the verified ordinary MolGen/Reaction/RetroSyn paths; use specialized upstream documentation for SBDD.

Raw lines 79 to 89
90## What causes a download
92Ordinary constructor calls immediately invoke a load wrapper:
94```python
95from tdc.single_pred import ADME
97# Potential network and disk write if the exact local file is absent.
98data = ADME(name="caco2_wang", path=".pytdc-data")
99```
101For core datasets, PyTDC 1.1.15:
1031. normalizes the requested name against the task registry;
1042. checks for a task-specific filename beneath `path`;
1053. if absent, requests a Harvard Dataverse file endpoint;
1064. streams the response to that path;
1075. parses the local tab/CSV/XLSX/pickle/JSON/H5AD/archive format.
109Many datasets are associated with the Harvard Dataverse collection
110<https://doi.org/10.7910/DVN/21LKWG>. Newer resources may instead use CELLxGENE,
111Hugging Face, or task-specific APIs; inspect the resource class before approval.
113The core contract is a public HTTPS `GET` to
114`https://dataverse.harvard.edu/api/access/datafile/{numeric_file_id}`. The release
115registries supply file IDs; there is no request body, pagination, or API key in
116this public-file path. The response is the file bytes (possibly after redirects),
117not JSON. Restricted provider files would need a separate access workflow; the
118core helper has no credential interface.
120In 1.1.15 `dataverse_download` sets neither a timeout nor `raise_for_status`, writes
121directly to the final filename, and verifies no checksum. HTTP error bodies or
122interrupted transfers can therefore leave a cache file that future calls accept.
123Check status/size/checksum against public file metadata when available and inspect
124a suspect file before reusing it. Initial Python-HTTP metadata probes received 403; bounded curl probes then
125returned public metadata for the three example datasets, three supported benchmark
126groups, MOSES and PrimeKG. Separate 512-byte range responses confirmed the Caco2
127and grouped PrimeKG headers. No full hosted dataset or archive was downloaded.
129PyTDC checks for expected filenames, not a complete content-addressed cache with
130documented checksums. An interrupted or stale local file may therefore need manual
131review. Never delete or redownload a user's cache without confirmation.

What causes a download

Ordinary constructor calls immediately invoke a load wrapper:

from tdc.single_pred import ADME

# Potential network and disk write if the exact local file is absent.
data = ADME(name="caco2_wang", path=".pytdc-data")

For core datasets, PyTDC 1.1.15:

  1. normalizes the requested name against the task registry;
  2. checks for a task-specific filename beneath path;
  3. if absent, requests a Harvard Dataverse file endpoint;
  4. streams the response to that path;
  5. parses the local tab/CSV/XLSX/pickle/JSON/H5AD/archive format.

Many datasets are associated with the Harvard Dataverse collection <https://doi.org/10.7910/DVN/21LKWG>. Newer resources may instead use CELLxGENE, Hugging Face, or task-specific APIs; inspect the resource class before approval.

The core contract is a public HTTPS GET to https://dataverse.harvard.edu/api/access/datafile/{numeric_file_id}. The release registries supply file IDs; there is no request body, pagination, or API key in this public-file path. The response is the file bytes (possibly after redirects), not JSON. Restricted provider files would need a separate access workflow; the core helper has no credential interface.

In 1.1.15 dataverse_download sets neither a timeout nor raise_for_status, writes directly to the final filename, and verifies no checksum. HTTP error bodies or interrupted transfers can therefore leave a cache file that future calls accept. Check status/size/checksum against public file metadata when available and inspect a suspect file before reusing it. Initial Python-HTTP metadata probes received 403; bounded curl probes then returned public metadata for the three example datasets, three supported benchmark groups, MOSES and PrimeKG. Separate 512-byte range responses confirmed the Caco2 and grouped PrimeKG headers. No full hosted dataset or archive was downloaded.

PyTDC checks for expected filenames, not a complete content-addressed cache with documented checksums. An interrupted or stale local file may therefore need manual review. Never delete or redownload a user's cache without confirmation.

Raw lines 90 to 132
133## Cache locations
135- Ordinary loader default: `./data`
136- `MolGen`/`Reaction`/`RetroSyn` default: `./data`
137- Generic `BenchmarkGroup` default: `./data`, then a normalized group subdirectory
138- Download-backed oracle default: `./oracle`
139- Bundled dataset CLI default: `.pytdc-data`
140- Bundled benchmark CLI default: `.pytdc-benchmarks`
141- Bundled MolGen CLI default: `.pytdc-molgen`
142- Bundled oracle runtime default: `.pytdc-oracles` (upstream creates `oracle/`
143 inside it for acknowledged checkpoints)
145All bundled CLIs require relative paths inside the current workspace. They do not
146overwrite JSON outputs unless `--force` is supplied.
148Audit an existing directory without network access:
150```bash
151python scripts/cache_audit.py --cache-dir .pytdc-data --largest 20
152```
154The audit reports regular-file counts, total bytes, extensions, bounded largest
155files, errors, and skipped symbolic links. It does not hash, modify, or upload data.

Cache locations

  • Ordinary loader default: ./data
  • MolGen/Reaction/RetroSyn default: ./data
  • Generic BenchmarkGroup default: ./data, then a normalized group subdirectory
  • Download-backed oracle default: ./oracle
  • Bundled dataset CLI default: .pytdc-data
  • Bundled benchmark CLI default: .pytdc-benchmarks
  • Bundled MolGen CLI default: .pytdc-molgen
  • Bundled oracle runtime default: .pytdc-oracles (upstream creates oracle/ inside it for acknowledged checkpoints)

All bundled CLIs require relative paths inside the current workspace. They do not overwrite JSON outputs unless --force is supplied.

Audit an existing directory without network access:

python scripts/cache_audit.py --cache-dir .pytdc-data --largest 20

The audit reports regular-file counts, total bytes, extensions, bounded largest files, errors, and skipped symbolic links. It does not hash, modify, or upload data.

Raw lines 133 to 156
Runs code python scripts/cache_audit.py :151
157## Approval gate
159Before constructing any loader, present:
161- exact package version, task, and dataset registry name;
162- official TDC task/dataset page and original data source;
163- dataset-specific license/terms and required citations;
164- published row/record count or archive size when available;
165- proposed relative cache path and available local disk;
166- likely network transfer and decompressed footprint;
167- split method, fractions, seed, and rationale;
168- any sensitive/proprietary inputs that must not leave the environment.
170Use the user-authorized scope for downloads; ask only when the intended dataset,
171transfer, or disclosure is outside that scope. The
172bundled scripts make planning the default and reserve construction for `--execute`;
173MolGen additionally requires `--download`.

Approval gate

Before constructing any loader, present:

  • exact package version, task, and dataset registry name;
  • official TDC task/dataset page and original data source;
  • dataset-specific license/terms and required citations;
  • published row/record count or archive size when available;
  • proposed relative cache path and available local disk;
  • likely network transfer and decompressed footprint;
  • split method, fractions, seed, and rationale;
  • any sensitive/proprietary inputs that must not leave the environment.

Use the user-authorized scope for downloads; ask only when the intended dataset, transfer, or disclosure is outside that scope. The bundled scripts make planning the default and reserve construction for --execute; MolGen additionally requires --download.

Raw lines 157 to 174
175## Data license is not the code license
177The `mims-harvard/TDC` codebase and this skill are MIT-licensed. That does not grant
178a blanket MIT license for hosted data.
180Official task pages show dataset-specific entries. As of the verification date,
181examples include Creative Commons licenses, “Not Specified” entries, and
182non-commercial terms (for example, clinical-trial outcome data). Treat the exact
183page and original provider terms as authoritative for:
185- commercial use;
186- redistribution or derivative datasets;
187- attribution and citation;
188- patient/clinical restrictions;
189- access tokens or API terms;
190- geographic or institutional restrictions.
192If the TDC page says “Not Specified,” do not infer permission from its nearby
193Creative Commons link. Trace the original source and ask the user to resolve the
194license before reuse.

Data license is not the code license

The mims-harvard/TDC codebase and this skill are MIT-licensed. That does not grant a blanket MIT license for hosted data.

Official task pages show dataset-specific entries. As of the verification date, examples include Creative Commons licenses, “Not Specified” entries, and non-commercial terms (for example, clinical-trial outcome data). Treat the exact page and original provider terms as authoritative for:

  • commercial use;
  • redistribution or derivative datasets;
  • attribution and citation;
  • patient/clinical restrictions;
  • access tokens or API terms;
  • geographic or institutional restrictions.

If the TDC page says “Not Specified,” do not infer permission from its nearby Creative Commons link. Trace the original source and ask the user to resolve the license before reuse.

Raw lines 175 to 195
Involves a person ask the user :193
196## Returned data
198For ordinary prediction loaders:
200```python
201frame = data.get_data(format="df")
202mapping = data.get_data(format="dict")
203```
205Supported formats and columns are loader-specific. Common prediction frames use
206entity identifiers/representations plus `Y`, but do not hard-code `Drug`, `Target`,
207or identifier columns before inspecting `frame.columns`.
209Some loaders also expose `format="DeepPurpose"`. Do not assume PyG, DGL, or
210arbitrary graph formats are valid `get_data` formats; representation conversion is
211a separate, dependency-heavy workflow.
213For multi-label datasets, constructors can require `label_name`. Discover labels
214without loading the main dataset:
216```python
217from tdc.utils import retrieve_label_name_list
219labels = retrieve_label_name_list("tox21")
220```
222Label meaning may require a separate mapping file and therefore can trigger its own
223download. Do not call it during a metadata-only plan.

Returned data

For ordinary prediction loaders:

frame = data.get_data(format="df")
mapping = data.get_data(format="dict")

Supported formats and columns are loader-specific. Common prediction frames use entity identifiers/representations plus Y, but do not hard-code Drug, Target, or identifier columns before inspecting frame.columns.

Some loaders also expose format="DeepPurpose". Do not assume PyG, DGL, or arbitrary graph formats are valid get_data formats; representation conversion is a separate, dependency-heavy workflow.

For multi-label datasets, constructors can require label_name. Discover labels without loading the main dataset:

from tdc.utils import retrieve_label_name_list

labels = retrieve_label_name_list("tox21")

Label meaning may require a separate mapping file and therefore can trigger its own download. Do not call it during a metadata-only plan.

Raw lines 196 to 224
225## Dataset and split provenance
227Record at minimum:
229```json
231 "package": "PyTDC",
232 "version": "1.1.15",
233 "task": "ADME",
234 "dataset": "caco2_wang",
235 "cache_path": ".pytdc-data",
236 "split_method": "scaffold",
237 "split_seed": 42,
238 "split_fractions": [0.7, 0.1, 0.2],
239 "license_reviewed": true,
240 "source_page": "https://tdcommons.ai/single_pred_tasks/adme"
242```
244Also record the downloaded filename, byte size, retrieval date, row count, columns,
245target transformation, duplicate handling, missing-value handling, and split
246overlap audits. Do not claim a split is leakage-free solely because it is named
247`scaffold` or `cold_split`.

Dataset and split provenance

Record at minimum:

{
  "package": "PyTDC",
  "version": "1.1.15",
  "task": "ADME",
  "dataset": "caco2_wang",
  "cache_path": ".pytdc-data",
  "split_method": "scaffold",
  "split_seed": 42,
  "split_fractions": [0.7, 0.1, 0.2],
  "license_reviewed": true,
  "source_page": "https://tdcommons.ai/single_pred_tasks/adme"
}

Also record the downloaded filename, byte size, retrieval date, row count, columns, target transformation, duplicate handling, missing-value handling, and split overlap audits. Do not claim a split is leakage-free solely because it is named scaffold or cold_split.

Raw lines 225 to 248
249## Stable verified examples
251These are used only as API checks; run package discovery before use:
253- `ADME` → `caco2_wang` (official ADME page)
254- `DTI` → `davis` and `bindingdb_patent` (official DTI/benchmark sources)
255- `MolGen` → `moses` (official molecule-generation page)
257Names such as `PairMolGen`, generic `Prodrug`, or arbitrary `GuacaMol` datasets do
258not appear in the PyTDC 1.1.15 public generation imports/registry and must not be
259presented as supported loaders.

Stable verified examples

These are used only as API checks; run package discovery before use:

  • ADME → caco2_wang (official ADME page)
  • DTI → davis and bindingdb_patent (official DTI/benchmark sources)
  • MolGen → moses (official molecule-generation page)

Names such as PairMolGen, generic Prodrug, or arbitrary GuacaMol datasets do not appear in the PyTDC 1.1.15 public generation imports/registry and must not be presented as supported loaders.

Raw lines 249 to 260
261## PrimeKG is a distinct resource contract
263The released API is `from tdc.resource import PrimeKG`, then
264`PrimeKG(path=".pytdc-data")`; construction can download a large graph.
265PyTDC 1.1.15 maps `primekg` to Dataverse file **6180626**, the grouped
266`kg_grouped.csv` artifact, cached as comma-separated `primekg.tab`. This is not the separate
267`kg.csv` file 6180620. Record which artifact was used.
269`get_data()` returns the edge dataframe; `get_node_list(node_type="drug")` uses
270the **node_type** keyword. `get_features(feature_type="drug")` or `"disease"` can
271fetch additional tab-separated files. `to_nx()` constructs an undirected
272`networkx.Graph` keyed by **display names** and can merge distinct typed IDs and
273overwrite parallel relations. Preserve the edge table, `(id, type, source)` node
274identities and all relation rows when preparing scientific graphs. Reverse
275storage rows are not independent evidence, and contraindication edges are not
276treatment evidence. These resource semantics were checked against released
277source and a tiny local CSV, not a full PrimeKG download.

PrimeKG is a distinct resource contract

The released API is from tdc.resource import PrimeKG, then PrimeKG(path=".pytdc-data"); construction can download a large graph. PyTDC 1.1.15 maps primekg to Dataverse file 6180626, the grouped kg_grouped.csv artifact, cached as comma-separated primekg.tab. This is not the separate kg.csv file 6180620. Record which artifact was used.

get_data() returns the edge dataframe; get_node_list(node_type="drug") uses the node_type keyword. get_features(feature_type="drug") or "disease" can fetch additional tab-separated files. to_nx() constructs an undirected networkx.Graph keyed by display names and can merge distinct typed IDs and overwrite parallel relations. Preserve the edge table, (id, type, source) node identities and all relation rows when preparing scientific graphs. Reverse storage rows are not independent evidence, and contraindication edges are not treatment evidence. These resource semantics were checked against released source and a tiny local CSV, not a full PrimeKG download.

Raw lines 261 to 277