This repository is prepared for anonymous peer review and reproducibility only.
It intentionally excludes paper narrative, author identity, and institutional information.
- OS: Linux (recommended) or Windows (path adjustments may be needed)
- Python:
3.10(recommended) - GPU: NVIDIA GPU with CUDA support (training scripts default to GPU execution)
Choose one setup option:
conda env create -f environment.yml
conda activate PathFlowpython -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtTraining scripts expect the following structure:
<SOURCE_DATAROOT>/
<DATASET>/
adata/
<sample_id>.h5ad
splits/
train_0.csv
test_0.csv
...
var_200genes.json # or another gene-list JSON containing a "genes" field
<EMBED_DATAROOT>/
<DATASET>/
<FEATURE_ENCODER>/
fp32/
<sample_id>.h5
Requirements:
splits/train_i.csvandsplits/test_i.csvmust contain asample_idcolumnvar_*.jsonmust follow{"genes": [...]}<sample_id>.h5and<sample_id>.h5admust match by sample ID
Authenticate first (some assets may be gated):
huggingface-cli loginThen download datasets:
# HEST-1k
huggingface-cli download MahmoodLab/hest \
--repo-type dataset \
--local-dir <SOURCE_DATAROOT>
# HEST-Bench
huggingface-cli download MahmoodLab/hest-bench \
--repo-type dataset \
--local-dir <SOURCE_DATAROOT>Python alternative (same repository IDs):
from huggingface_hub import snapshot_download
snapshot_download(
repo_id="MahmoodLab/hest",
repo_type="dataset",
local_dir="<SOURCE_DATAROOT>",
)
snapshot_download(
repo_id="MahmoodLab/hest-bench",
repo_type="dataset",
local_dir="<SOURCE_DATAROOT>",
)For --feature_encoder uni_v1_official, download UNI weights from:
[MahmoodLab/UNI](https://huggingface.co/MahmoodLab/UNI)
# Download UNI checkpoint to a local weights directory
huggingface-cli download MahmoodLab/UNI \
pytorch_model.bin \
--local-dir <WEIGHTS_ROOT>/uniPython alternative:
from huggingface_hub import hf_hub_download
hf_hub_download(
repo_id="MahmoodLab/UNI",
filename="pytorch_model.bin",
local_dir="<WEIGHTS_ROOT>/uni",
)If your dataset folder does not already contain var_200genes.json, generate it via:
python app/flow/generate_gene_panel.py \
--source_dataroot <SOURCE_DATAROOT> \
--dataset SKCM \
--top-k 200 \
--output-name var_200genes.jsonThis will scan <SOURCE_DATAROOT>/<DATASET>/adata/*.h5ad and write:
<SOURCE_DATAROOT>/<DATASET>/var_200genes.json.
Run from repository root:
python app/flow/train.py \
--source_dataroot <SOURCE_DATAROOT> \
--embed_dataroot <EMBED_DATAROOT> \
--save_dir results_dir \
--datasets SKCM \
--feature_encoder uni_v1_official \
--gene_list var_200genes.json \
--seed 1 \
--deterministicNotes:
--deterministicimproves reproducibility (may reduce throughput)- Use
--split-only 0to run a single split - For a quick smoke test, reduce
--epochsand/or dataset scope
python app/flow/pca_ridge_baseline.py \
--source_dataroot <SOURCE_DATAROOT> \
--embed_dataroot <EMBED_DATAROOT> \
--save_dir results_dir/baseline_pca_ridge \
--datasets SKCM \
--feature_encoder uni_v1_official \
--gene_list var_200genes.json \
--seed 1 \
--deterministicMain method outputs (timestamped under --save_dir):
<save_dir>/<timestamp>/<dataset>/config.json<save_dir>/<timestamp>/<dataset>/results_kfold.json<save_dir>/<timestamp>/<dataset>/test_results_all_splits.csv<save_dir>/<timestamp>/<dataset>/split*/checkpoints/best.pth<save_dir>/<timestamp>/<dataset>/split*/test_metrics.csv
Baseline outputs:
<save_dir>/<dataset>/results_kfold.json<save_dir>/<dataset>/test_results_all_splits.csv<save_dir>/<dataset>/split*/predictions.npz
- Fix random seed:
--seed <int> - Enable deterministic mode:
--deterministic - Log full commands, dependency versions, and runtime environment
- Avoid mixing CUDA/PyTorch versions across runs
- Do not modify official split files in
splits/*.csvduring reproduction
All rights reserved during anonymous review.
A final license statement will be released after publication decisions.
This repository is built upon the codebases of
Graph-and-Geometric-Learning/STFlow,
Graph-and-Geometric-Learning/STPath,
and mahmoodlab/HEST.