Torch-eCpG v2.0.0 Beta 1
Pre-release
Pre-release
Torch-eCpG v2.0.0-beta.1 — Release Notes
Pre-release of the dev branch, accumulating ~18 months of work since Release 1.0.0 (__version__ = '0.0.1'). The 2.0 line graduates Torch-eCpG from a GPU MLR kernel into a full, reproducible eQTM analysis pipeline: scalable compute, end-to-end automation, rich downstream visualization, and a hardened annotation/QC layer.
Headline Additions
1. New MLR Backend & Bootstrap Inference
- New
torch.linalg.lstsqMLR backend with validation tests against the legacy path (1.1.0-dev). lstsqbootstrap subcommand with a configurable bootstrap batch size and a newtools/createBootstrapList.pyfor filtering candidate eQTMs (1.7.0–1.7.1-dev).- Integrated Gradients (IG) integrated into the
lstsqbackend, with decoupled IG outputs and covariate filtering by file (1.6.0-dev, 1.6.5-dev). - Bit-equivalent inner-kernel peak-memory reduction in the
lstsqpath (in-place buffer assembly, earlyXfree, K=1 slicing for methylation-only/no-IG; verified against pre-1.20.1 baseline) (1.20.1-dev).
2. Parquet I/O and Output Tooling
- First-class Parquet output with Snappy/ZSTD compression in
mergeOutputs.py(1.4.1-dev) andsummarizeOutput_parquet.pyfor FDR on Parquet outputs (1.6.0-dev). summaryParquetToCsv.py,recalculate_pvalues_parquet.py, andassignRegionToEcpg_parquet.py(GFF/GTF/BED6 + region assignment withverify_alignment) (1.5.0–1.6.3-dev).- Numerous Parquet hardening fixes — chunk-merge contamination at the 1,000,000-hit limit, pandas type inference for nullable int columns,
gt_id/mt_idindex-vs-column handling,sample_reservoir.csvexclusion in merges, and unique-count restoration inmergeOutputs.py(1.25.0–1.26.1-dev).
3. Host-Aware Performance & Memory Management
- New
--host-profile {auto,minimum,server}(envTECPG_HOST_PROFILE) drives defaults for save-pool size, output format (auto→ Parquet on server, CSV on minimum), prefetch depth, and chunk auto-sizing (1.20.1-dev). --prefetch-chunkswith aThreadPoolExecutorto overlap chunk preparation with GPU compute, plus a--blas-threadspre-import shim (1.13.0-dev).- Anchored auto-chunking: supply one of
-g/-mand the other dimension is bisected against an 80%-of-budget memory target (CUDAmem_get_info/psutil) (1.21.0-dev). - IG-aware chunk estimator with bisection-based fallback and a VRAM safety ceiling that fixes a severe OOM regression on tight GPUs (L4-class, ~22 GB) when
--compute-igwas set (1.22.2-dev). - Auto-scaled
--save-threads, streamingto_csv, save-queue backpressure, switch toThreadPoolExecutorfor Parquet (GIL-released by PyArrow) while CSV keeps theProcessPoolExecutor, and removal of per-chunkempty_cache()overhead (1.8.x–1.14.0-dev). - QR-decomposition cache and non-blocking NVML calls for higher GPU utilization (1.11.0-dev).
- Rich per-chunk profiling and bottleneck heuristics (GPU/I/O/CPU-bound classification), GPU UUID-based monitoring, thermal/memory reporting (1.2.x, 1.12.x-dev).
4. End-to-End Pipeline Automation
- New
pipeline.shorchestrating the full analysis with argument parsing, descriptive logging, timestamps, and data-existence checks (1.8.0-dev). - PCA covariate preprocessing integrated into the pipeline, with a standalone PCA script (1.8.0-dev).
pipeline.shstage-resume via-s/--start-stage(e.g.pca,map,summarize) (1.27.0-dev).- New
pipelinePost.shautomating downstream visualizations and network analyses (1.26.3-dev). tools/exploreOmics.pyintegrated into the pipeline for QC of methylation/expression, with a consolidated HTML report comparing original vs. processed inputs (1.23.2-dev, 1.24.3-dev).tools/estimateCellProportions.R(EpiDISH) with automatic M-value → Beta-value conversion for MESA-style inputs (1.23.1-dev).- Data-prep hardening: floor +
log2(x+1)gene-expression transform intecpg/mesa.py/tecpg/gtp.py, NaN diagnostics, early errors on<= -1values, dataset-specific--logit-transformpolicy (1.23.0–1.23.2-dev).
5. Annotation Layer Rewrite
- Comprehensive BED6 annotations for EPIC and HT-12 (hg19/hg38) (1.27.2-dev).
- Rewritten
tools/generate_annotations.py: multi-source HT-12 mapping with provenance (Re-Annotator → GEO → UCSC WG-6 → NA), canonical chromosome cleaning, retention of unmapped probes with NA coordinates, and a singlewrite_bed6()gate. Net effect: HT-12 hg19 valid mappings rise 42,692 → 51,553. Includes 28 offline synthetic tests (1.27.1, 1.27.4-dev). - Vendored Re-Annotator HT-12 v4 data and UCSC hg19
illuminaProbes.txtrecovery source (1.27.0-dev, post-1.27.6). - BED6 readers skip NA-coordinate rows safely (eliminates
int('')andchr22.0crashes) (1.27.5-dev). - Missing-annotation logging consolidated to a sidecar
annotation_missing_ids.txtfile instead of flooding the main log (1.27.6-dev).
6. Visualization Suite
- Circos plot generator for eQTM architecture with cytoband labels, custom legend, and detailed exclusion reporting (missing/invalid coords, chromosome not in cytoband) (1.6.6–1.6.8, 1.23.0, 1.26.3–1.26.7-dev). Switched to hg19 cytoband (1.26.3-dev).
tools/visualizeFindings.pyfor multi-omic Volcano / Manhattan / Scatter plots, with per-p-value-column output prefixes (bootstrapP_,preciseP_,mtP_) preferringp_bootwhen available (1.6.3, 1.22.4, 1.23.0-dev).- Bipartite Network Suite:
tools/exportBipartiteNetwork.py(formerlyexport_cytoscape.py) emits Cytoscape-style node/edge tables with effect-size / bootstrap-p / top-K filtering and--out-dirsupport (1.24.0, 1.24.4, 1.26.5-dev);tools/visualizeBipartiteNetwork.pyadds ForceAtlas2 layouts, UMAP Beta-Diversity (Bray–Curtis), degree distributions, clustered adjacency heatmaps, arc diagrams, and bipartite→unipartite projection (count / sum / hypergeometric) (1.24.1–1.24.2-dev). - ENCODE enrichment analysis and regional functional enrichment (
gseapy,mygene) insummarizeOutput_parquet.py; FDR threshold discovery, QQ plots, genomic-inflation (λ) (1.3.x, 1.6.8-dev).
7. Docker & Deployment
- Multi-stage Docker rebuild against
devwith full-pipeline support, runtime R + shared-library fixes (libxml2,libcurl4,libssl3), and adocker-related/REBUILD_DESIGN.mddesign memo (1.27.0, 1.27.3-dev). tools/install_dependencies.Rto install all required R packages (pheatmap,EpiDISH,sva, EPIC anno,ExperimentHub) viaBiocManager(1.22.5-dev).
8. Profiling, Diagnostics & Agents
profiling.shbash GPU diagnostic tool drivingnvidia-smi/top/vmstat/pidstat, with matrix sweeps over prefetching, chunk size, TF32, and BLAS threads; environment-annotated result tarball (docs/profiling.md) (1.15.0–1.15.1-dev).AGENTS.mdand vendored Clean Code / A Philosophy of Software Design rule sets underdocs/agent-rules/for AI agent contributors (1.15.0-dev).- Gap-fill diagnostics in startup banner and per-chunk metrics (
gpu_idle_between_chunks_ms,save_queue_depth,prefetch_fill) (1.13.0-dev).
Breaking Changes
- CLI short flags removed.
tecpg run mlrno longer accepts-g/-mfor--gene-loci-per-chunk/--meth-loci-per-chunk— they collided with the top-level-g, --gene-file/-m, --meth-file. Use the long forms:--gene-loci-per-chunk <N> --meth-loci-per-chunk <N>. Thedata dummyandchunkssubcommands' own-g/-mflags are unchanged. (1.21.0-dev) - Default
p-threshreverted to0.001(briefly0.00001in 1.22.3-dev) (1.24.2-dev). tools/export_cytoscape.pyrenamed totools/exportBipartiteNetwork.py(and its test file likewise) (1.24.1-dev).- Output format default is now
auto(Parquet on server-class hosts, CSV on minimum-class); explicit--output-formatoverrides win (1.20.1-dev).
Notable Bug Fixes (highlights)
- Severe OOM regression on IG runs with tight VRAM (1.22.2-dev).
pipeline.shmlr_run.logclobber viateeinside thetecpg-managed output dir (1.22.3-dev).- Duplicate-edge
ValueErrorinvisualizeBipartiteNetwork.pyUMAP/heatmap pivots; dropped rows persisted todropped_duplicate_edges.csv(1.26.2-dev). prefetch_chunksauto-resolution now reports0on CPU-only systems, preventingpin_memory()crashes (1.20.1-dev).- Bottleneck-log ETA correction (1.26.0-dev).
- Numerous Parquet schema / index / nullable-int fixes (see §2).
New Dependencies
networkx, fa2, umap-learn, plus R packages installable via tools/install_dependencies.R.
Upgrade Notes
- Update any scripts that pass
-g <N> -m <N>totecpg run mlr(use long forms). - If you used
tools/export_cytoscape.py, switch totools/exportBipartiteNetwork.py. - For minimum-spec hosts, set
--host-profile minimum(orTECPG_HOST_PROFILE=minimum) to opt into conservative defaults; for tight-VRAM IG runs, the new safety ceiling is automatic. - Rebuild Docker images from the updated multi-stage
Dockerfileto pick up runtime R/library fixes.
Full per-version detail is in CHANGELOG.md (versions 1.1.0-dev through 2.0.0b1).