How chrisjason0505/genomic-hpc-pipeline-using-jl-projections works
Purpose and execution
This repository is a notebook-driven HPC genomics experiment for reconstructing high-dimensional HapMap SNP dosage data after dimensionality reduction. The primary entry point is JL_MLP_SNP_Pipeline.ipynb; it expects an untracked input file at data/data_geno_hmp.csv. Native encoding must be built first through scripts/setup.py.
Input and native encoding boundary
Raw SNP genotype strings are loaded from the HapMap CSV and converted to additive numeric dosages. The performance-critical genotype encoder is implemented in C at scripts/encode_utils.c and compiled as a Python extension by scripts/setup.py. The notebook invokes the compiled code through Python/ctypes, separating data parsing/experiment orchestration from native per-genotype encoding.
Dimensionality-reduction stage
The encoded sample-by-SNP matrix (documented as 150 × 16,735) is reduced to a fixed 128-dimensional representation using Johnson-Lindenstrauss random projection. This replaces PCA as the main reduction mechanism and creates the model input boundary: high-dimensional SNP dosage data becomes a compact projected matrix. The projection, comparison baselines, and timing analysis are orchestrated in JL_MLP_SNP_Pipeline.ipynb.
GPU autoencoder stage
A PyTorch MLP autoencoder consumes 128-dimensional JL vectors and reconstructs the original SNP feature space. Its encoder produces learned latent embeddings; its decoder expands back to 16,735 SNP dimensions. Training uses CUDA where available and automatic mixed precision, with BatchNorm, GELU, dropout, AdamW, cosine learning-rate scheduling, and early stopping managed by JL_MLP_SNP_Pipeline.ipynb.
Validation and evaluation flow
The notebook performs 5-fold cross-validation to estimate reconstruction RMSE, then runs a final held-out evaluation. A JL-only reconstruction baseline is compared against JL plus the trained MLP to isolate the neural reconstruction contribution. Persisted aggregate outputs are data/kfold_summary.csv and data/final_results.csv; the raw source dataset is intentionally excluded.
Runtime and infrastructure
The runtime is Python/Jupyter with dependencies declared in requirements.txt, a local C compiler for the extension build, and PyTorch CUDA/AMP support. The intended execution hardware is an NVIDIA GPU, specifically documented against an RTX 3060 Laptop GPU with 6 GB VRAM. There are no service, API, database, or deployment boundaries; computation and result generation are local.
Artifact generation
JL_MLP_SNP_Pipeline.ipynb is also the reporting layer: it produces exploratory, projection-quality, CPU/GPU profiling, fold-training, reconstruction, latent-space, and tradeoff visualizations. The README describes generated images under outputs/images/, although that directory is not present in the supplied tree and is therefore a runtime-generated artifact location.
Main entry points: JL_MLP_SNP_Pipeline.ipynb Pipeline notebook · setup.py Extension build · encode_utils.c Genotype encoder · requirements.txt Python dependencies
Components 17
Native encoding
- Extension build · Compiles the native genotype encoder.
scripts/setup.py - Genotype encoder · Converts genotype strings to additive dosages.
scripts/encode_utils.c - Compiled encoder · Called from Python through ctypes.
Notebook experiment
- Pipeline notebook · Orchestrates preprocessing, training, evaluation, and reporting.
JL_MLP_SNP_Pipeline.ipynb - SNP dosage matrix · 150 samples by 16,735 SNP features.
- JL projection · Projects dosage vectors to 128 dimensions.
JL_MLP_SNP_Pipeline.ipynb - 128-D JL vectors
- MLP encoder · Produces learned latent embeddings.
JL_MLP_SNP_Pipeline.ipynb - MLP decoder · Reconstructs 16,735 SNP dimensions.
JL_MLP_SNP_Pipeline.ipynb - CUDA/AMP training · Uses AdamW, cosine scheduling, and early stopping.
JL_MLP_SNP_Pipeline.ipynb - 5-fold validation · Estimates reconstruction RMSE.
JL_MLP_SNP_Pipeline.ipynb - Final held-out evaluation · Compares JL-only and JL-plus-MLP reconstruction.
JL_MLP_SNP_Pipeline.ipynb
Generated artifacts
- CV summary · Aggregate fold metrics.
data/kfold_summary.csv - Final results · Held-out reconstruction metrics.
data/final_results.csv - Experiment visualizations · Projection, profiling, reconstruction, latent-space, and tradeoff plots.
Other components
- HapMap genotype CSV · Untracked SNP genotype strings.
- Python dependencies · Provides Jupyter and PyTorch runtime dependencies.
requirements.txt
Connections 17
- Genotype encoder → Extension build: compiled by
- Extension build → Compiled encoder: produces
- Python dependencies → Pipeline notebook: defines runtime
- HapMap genotype CSV → Pipeline notebook: loaded by
- Compiled encoder → Pipeline notebook: invoked via ctypes
- Pipeline notebook → SNP dosage matrix: encodes
- SNP dosage matrix → JL projection: reduces
- JL projection → 128-D JL vectors: outputs
- 128-D JL vectors → MLP encoder: feeds
- MLP encoder → MLP decoder: latent embeddings
- MLP decoder → CUDA/AMP training: optimized by
- CUDA/AMP training → 5-fold validation: evaluated across folds
- 5-fold validation → CV summary: writes
- CUDA/AMP training → Final held-out evaluation: final model
- 128-D JL vectors → Final held-out evaluation: JL-only baseline
- Final held-out evaluation → Final results: writes
- Pipeline notebook → Experiment visualizations: generates