Standalone, inference-only predictor that assigns a Parkinson's disease subtype from 98 SNP genotype calls. The model is fixed — it does not train, refit, or depend on the original research pipeline at runtime.
The bundled model was trained and validated on the PPMI discovery cohort:
- Samples: 265
- Cluster counts:
{0: 92, 1: 92, 2: 81} - Pipeline: 98 SNPs → 5D autoencoder latent space → 3-component full-covariance GMM
The predictor requires Python 3.10. The recommended way is to create a dedicated conda environment:
conda create -n snp2pdsub python=3.10
conda activate snp2pdsub
pip install -r requirements.txtAlternatively, with a plain virtual environment (Python 3.10 must already be installed):
python3.10 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtThe predictor accepts two input formats, auto-detected from the file extension.
One row per subject. A PATNO or sample_id column is optional but recommended for tracking outputs. The file must contain all 98 SNP columns listed in artifacts/snp_columns.txt; extra columns are ignored.
Accepted genotype values are 0, 1, and 2. Any value not exactly in that set after numeric conversion — including blanks, NaN, 3, negative values, decimals, and text — is treated as missing. The predictor reports how many values were treated as missing and imputes them with KNN (n_neighbors=5).
If an entire SNP column is missing or invalid for the submitted batch, prediction fails: batch-level KNN cannot recover a fully absent column.
Provide a multi-sample VCF containing whole-genome or whole-exome sequencing data. The predictor calls bcftools to extract the 98 curated SNPs by RSID and recodes genotypes to dosage (0/0 → 0, 0/1 → 1, 1/1 → 2; any other call becomes missing). Sample IDs are read from the VCF header.
Requirements: bcftools must be on your PATH:
conda install -c bioconda bcftoolsIf your data is split across per-chromosome VCF files, merge them first:
bcftools concat -Oz -o merged.vcf.gz chr1.vcf.gz chr2.vcf.gz ...SNPs not found by RSID in the VCF are reported as warnings. Prediction still proceeds unless an entire column is absent (same rule as the CSV path).
# From a SNP dosage CSV
python predict.py --input examples/example_input.csv --output clusters.csv
# From a VCF (auto-detected from extension)
python predict.py --input cohort.vcf.gz --output clusters.csv
# Explicit format flag (overrides auto-detection)
python predict.py --input cohort.vcf.gz --input-format vcf --output clusters.csvThe output CSV contains one row per subject with columns:
| Column | Description |
|---|---|
PATNO / sample_id |
Subject identifier from input, or sequential index if no PATNO column |
Cluster |
Assigned cluster (0, 1, or 2) |
Cluster_0_Probability |
Posterior probability for cluster 0 |
Cluster_1_Probability |
Posterior probability for cluster 1 |
Cluster_2_Probability |
Posterior probability for cluster 2 |
pytestThe test suite covers GMM mathematical correctness, KNN imputation edge cases, input validation, and the CLI end-to-end path.