liubuing's picture
Add training library: frozen homology-cold splits, audits, evaluation artifacts, and v10 release archive
92cfea3 verified
|
Raw History Blame Contribute Delete
4.27 kB

Reconstructing the BioCandidateRanker training corpus

This guide rebuilds the exact development corpus, frozen split, and baseline evaluation from the public upstream source plus the artifacts in this repository. It never requires the measurement rows to pass through this dataset repository.

1. Obtain the original corpus

Download Kcat_combination_0918_wildtype_mutant.json from the original UniKP repository. The same wildtype+mutant kcat compilation was distributed with DLKcat (Zenodo record 6438262).

2. Verify the frozen identity

The project's frozen manifests pin the source bytes. Compute:

sha256sum Kcat_combination_0918_wildtype_mutant.json

Expected:

13643b0b36374f8d3f64d8b014882cf1b3b58946eeaae2b9dcd59e8b2c2d6719  (12,132,719 bytes, 17,010 rows)

If the hash differs, stop: the split assignments in data/homology_split.parquet are keyed by row index and are only valid for a byte-identical copy. Cross-check against configs/unikp_source_manifest.json and data/unikp_audit.json in this repository. A verified copy was confirmed on 2026-10-24.

3. Audit the corpus with the project CLI

Unpack release/software-implementation-v10-redacted.zip, then:

python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e ".[dev]"
$env:PYTHONPATH="src"
python -m biocandidate.cli audit-data `
  --data "<path>\Kcat_combination_0918_wildtype_mutant.json" `
  --output artifacts\unikp_audit.json

Expected adapter statistics (recorded in configs/unikp_source_manifest.json):

field value
total rows 17,010
accepted 16,838
duplicates 395
conflicting duplicates 215
rejected 172

4. Apply the frozen homology-cold split

The split in data/homology_split.parquet / data/homology_split.json maps each 0-based source_row to an MMseqs2 cluster and a partition (MMseqs2 linclust, min identity 0.3, coverage 0.8, coverage mode 0, seed 42; 2,204 clusters; 13,470 / 1,684 / 1,684 rows). Join it to the source file by row index:

import json
import pandas as pd

source = json.load(open("Kcat_combination_0918_wildtype_mutant.json", encoding="utf-8"))
split = pd.read_parquet("data/homology_split.parquet").set_index("source_row")
train = [source[i] for i in split.index[split["split"] == "train"]]

Or let the CLI bind the identity itself (recommended — it refuses a source that does not match the audit manifest):

python -m biocandidate.cli train `
  --data "<path>\Kcat_combination_0918_wildtype_mutant.json" `
  --manifest artifacts\unikp_audit.json `
  --split-manifest artifacts\homology-final\homology_split.json `
  --output-dir artifacts\training

(artifacts/homology-final/homology_split.json is included byte-identical inside the release archive; the copy under data/ here is the same file with its one embedded local path redacted.)

5. Reproduce the frozen baseline evaluation

The baseline checkpoint artifacts/full-homology-baseline/best.pt ships inside the release archive. Evaluate the test partition:

python -m biocandidate.cli evaluate `
  --checkpoint artifacts\full-homology-baseline\best.pt `
  --data "<path>\Kcat_combination_0918_wildtype_mutant.json" `
  --manifest artifacts\unikp_audit.json `
  --split-manifest artifacts\homology-final\homology_split.json `
  --partition test `
  --output artifacts\full-homology-baseline\test_metrics.json

Reference result: data/full-homology-baseline/test_metrics.json.

torch >= 2.6 note: predict/evaluate checkpoint loading with weights_only=True rejects pre-2.6 checkpoints. Install torch<2.6 for CLI reproduction, or use the workbench server path documented in the README.

6. License obligations

  • The corpus rows stay out of public archives: upstream terms are unresolved (configs/data_license_inventory.json, corpus unikp-kcat-development-corpus).
  • If you redistribute anything derived from the corpus, resolve the upstream terms first and cite the UniKP and DLKcat papers.
  • EnzEngDB v1 (CC-BY-4.0) and the Lunzer IMDH landscape (CC0) have their own attribution requirements documented in the dataset card.