Add precomputed ML mechanistic labels as parquet (ml_preds/)
edohollou+1: Claude Sonnet 4.6
8132ff2
- scripts/precompute_ml_predictions.py: new script — downloads 20K variant
parquets from HF, runs XGBoost lite classifier, writes
ml_preds/protein_id=X/data_0.parquet (mutation_code | ml_mechLabel | ml_confidence)
for all 216M variants; uploads back to edohollou/mutvar-variants
- backend/main.py: add ML_PREDS_DIR + _local_has_ml_preds(); extend
_create_variants_view() to LEFT JOIN ml_preds parquet; expose ml_mechLabel
and ml_confidence in /api/search and /api/lookup responses; remove
runtime sklearn/xgboost inference (_load_classifier, /api/predict-mechanism)
- backend/requirements.txt: drop joblib/scikit-learn/xgboost; add requests
- index.html: parse ml_mechLabel/ml_confidence from API; mechDisplay() shows
dashed ML badge when structural label is Unassigned; remove async
fetchMechPrediction — predictions now come directly from the JOIN
- scripts/download_hf_dataset.py: route ml_preds/ parquets to
/app/backend/data/ml_preds/ at Docker build time
- Dockerfile.bac…
Add Colab notebook for mechanistic label classifier
edohollou+1: Claude Sonnet 4.6
aa8824c
Trains XGBoost + calibration on 32K labeled variants (3 proteins).
Two models: lite (no PDB, for proteome-wide inference) and full (pLDDT + RSA).
Additions beyond brief:
- BLOSUM62 substitution score (evolutionary conservation proxy)
- Interaction features: am × pred_ddg, am × esm1b_llr
- Consensus score (0-3 pathogenicity signals)
- XGBoost instead of RF (better calibrated for imbalanced tabular)
- CalibratedClassifierCV (isotonic) for reliable probabilities
- SMOTE inside each StratifiedKFold fold (Interface 6%, Pockets 10%)
- position_relative (position / protein_length, generalises better)
- Uploads both models + metadata to HF Space automatically
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix disk space management in join_rasp_ddg: skip re-extraction, delete early
edohollou+1: Claude Sonnet 4.6
faf5d0e
- _hdf5_is_valid(): integrity check before deciding to re-extract
- Skip extraction if HDF5 already valid (was overwriting 105G file blindly)
- Remove corrupt/partial HDF5 before fresh extraction
- Delete zip immediately after extraction (frees 8.7 GB before conversion)
- Delete HDF5 immediately after flat parquet written (frees 105 GB before
DuckDB partitioning, not at end of script)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace vaex with h5py for RaSP conversion (no gcc required)
edohollou+1: Claude Sonnet 4.6
42193c2
vaex requires annoy which needs gcc to compile — not available on this
machine. h5py was already installed successfully. Rewrote vaex_to_parquet
to use h5py directly with 5M-row chunked reads to avoid OOM on 230M rows.
Reads Vaex HDF5 layout (/table/columns/{col}/data) with robust fallbacks.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- scripts/join_rasp_ddg.py: download RaSP bulk Vaex (~8.6 GB), convert to
flat parquet, DuckDB COPY partition by protein_id, upload_large_folder
to HF as ddg/protein_id=X/data_0.parquet (resumable)
- backend/main.py: refactor _create_variants_view to handle two enrichment
tables (esm1b/ and ddg/) independently; each uses _try_enrich_view which
probes the file eagerly to catch httpfs 404s before query time;
COALESCE keeps existing ESM-IF1 values for 13 enriched proteins
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bump CACHEBUST=8 + route esm1b/ parquets to separate data dir
edohollou+1: Claude Sonnet 4.6
01632ce
download_hf_dataset.py now splits the snapshot into two output dirs:
- variants/protein_id=X/ -> /app/backend/data/variants/ (AM scores)
- esm1b/protein_id=X/ -> /app/backend/data/esm1b/ (VESM++ ESM1b)
Previously all parquets were copied to data/variants/ which would have
overwritten AM scores with VESM++ data after the esm1b upload.
CACHEBUST=8 forces a fresh snapshot_download on the next Space rebuild
(to be pushed once the esm1b/ upload to HF is complete).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix upload_large_folder: bake esm1b/ prefix into local dir structure
edohollou+1: Claude Sonnet 4.6
8064ddb
upload_large_folder has no path_in_repo parameter. Fix: DuckDB writes
parquets to out_dir/esm1b/protein_id=X/ and we upload out_dir/ to the
repo root, so the esm1b/ prefix comes from the local directory layout.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Switch to upload_large_folder + persistent output dir for resumable upload
edohollou+1: Claude Sonnet 4.6
7d6be95
upload_folder makes a single giant commit and cannot resume after Ctrl-C.
upload_large_folder splits into chunked commits and is fully resumable.
Also use ~/mutvar_esm1b_upload/ as default output dir (instead of a random
tempdir) so if the upload is interrupted, re-running the script skips the
10-20 min DuckDB partition step and resumes the upload directly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add ESM1b/VESM++ JOIN to backend get_db() + fix hf_index scoping
edohollou+1: Claude Sonnet 4.6
75800cf
- New _create_variants_view() helper: LEFT JOINs esm1b/ partition into
the variants VIEW, COALESCing with pre-computed values on the 13 enriched
proteins so they keep their ESM2 scores while all others get VESM++
- Works for both local (data/esm1b/) and HF httpfs fallback paths
- _ensure_hf_index now skips non-variants/ paths so esm1b/ files don't
pollute the protein lookup table
- join_vesm_scores.py already handles the upload; this wires up the read side
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix join_vesm_scores: bulk download + local join + single upload_folder
edohollou+1: Claude Sonnet 4.6
10f7d90
Previous approach: 20K individual API calls (one upload per protein) = ~17h.
New approach:
1. snapshot_download() — full MutVar dataset to local dir (~2 GB, one shot)
2. DuckDB join local MutVar + local VESM (no HTTP rate limits)
3. upload_folder() — single git commit for all 20K files
Estimated total: ~1-2h (same order as original AlphaMissense upload)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add VESM++ join script for proteome-wide ESM enrichment
edohollou+1: Claude Sonnet 4.6
7b391d8
Replaces compute_esm2_llr_all.py GPU approach with a simpler download+join:
- Source: ntranoslab/vesm_scores (UniProtKB_VESM++_scores.parquet.gzip)
216M variants, UniProtKB format, precomputed ESM1b+ESM2+structure scores
- DuckDB queries per-protein from the local cached file (~no RAM spike)
- Threshold: -7.0 (calibrated on TP53 vs AlphaMissense labels)
TP53 R175H = -8.27 → PATH ✓ KRAS G12D = -12.53 → PATH ✓
- Full 100% variant coverage on tested proteins (1.2s/protein)
- Checkpoint + resume for safe interruption
- Estimated runtime: ~17h for 20K proteins (dominated by HF upload)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add ESM2 LLR pipeline for full proteome (20K proteins)
edohollou+1: Claude Sonnet 4.6
79accb5
compute_esm2_llr_all.py:
- ESM2-650M loaded once, processes all proteins sequentially
- Positions masked in batches of 8 (configurable) to limit peak memory
- CPU threads capped at 4 to avoid saturation
- Skip proteins already enriched (esm1b_llr populated)
- Checkpoint file for safe resume after interruption/crash
- OOM fallback: auto-retry with batch=1
- Uploads each protein to HF immediately after processing
colab_esm2_llr.ipynb:
- Ready-to-run Colab notebook with GPU runtime (T4 free)
- Test mode (--max-proteins 5) before full run
- Checkpoint inspection cell
Estimated runtime: ~20h on T4 GPU, ~13 days on CPU
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CACHEBUST=5 + fix download script to always overwrite parquets