Reproducible analysis code for the paper:
Thermodynamic Fingerprinting Reveals Universal Grammar in Pathogenic Synonymous Variants
Jose Antonio Vilar Sanchez (2026)
First dedicated thermodynamic classifier for pathogenic synonymous variants. Synonymous mutations do not alter protein sequence but can cause disease through mRNA-level mechanisms: structural destabilization, splicing disruption, and translational kinetics alteration. Current predictors (REVEL, AlphaMissense, CADD) are blind to these variants because they operate at the protein level.
This repository implements a 1D-CNN that classifies synonymous variants using nearest-neighbor stacking free energy profiles (SantaLucia 1998) — a biophysical signal that captures the thermodynamic context disrupted by the mutation.
Patent: EnergoRNA P202630522 (OEPM, April 2026). The method is patent-protected; this code is released under the MIT license for research purposes.
| Method | AUC-ROC | Description |
|---|---|---|
| Strategy A (Isolation Forest) | 0.651 | Unsupervised anomaly detection |
| Strategy B (Dedicated CNN) | 0.683 ± 0.018 | 5-fold stratified CV |
| Strategy B (Focal Loss γ=2) | 0.677 ± 0.021 | Hard-example mining |
| Strategy C (Zero-shot from missense) | 0.386 | Transfer fails (anti-correlates) |
| LOGO validation | 0.625 ± 0.166 | 72% of genes above chance |
The Leave-One-Gene-Out (LOGO) result — training on all genes except one and predicting the held-out gene — demonstrates that the model learns universal thermodynamic rules transferable across genes without shared sequence homology.
- G>A enrichment: 2.60× overrepresented in pathogenic synonymous variants
- CDS length effect: Shorter CDS → higher AUC (p = 0.022)
- Geometry over amplitude: ΔG disruption geometry (gradient, curvature) matters more than raw magnitude
- Splice independence: Model does not depend on proximity to canonical splice sites
Input: 9-channel × 128-nucleotide tensor
│
├─ Channels 1-3: Reference ΔG stacking profile + gradient + curvature
├─ Channels 4-6: Alternative ΔG stacking profile + gradient + curvature
└─ Channels 7-9: Difference profile + gradient + curvature
│
▼
Conv1D(9→64, k=7) → BN → ReLU → Dropout(0.3)
Conv1D(64→128, k=5) → BN → ReLU → Dropout(0.3)
Multi-head Self-Attention (4 heads)
Conv1D(128→256, k=3) → BN → ReLU
Global Average Pooling
FC(256→64→2) → Softmax
│
▼
Pathogenic / Benign
~227K trainable parameters. Extreme class imbalance (1:203) handled via subsampling + WeightedRandomSampler + class-weighted loss.
synonymous-thermodynamic-classification/
├── core/
│ ├── energy.py # ΔG stacking profiles (SantaLucia 1998)
│ ├── genetics.py # Codon tables, FASTA utilities
│ └── model.py # EnergySignalCNN, GradCAM1D, training utilities
├── scripts/
│ ├── 01_download_clinvar.py # Download ALL synonymous variants from ClinVar
│ ├── 02_generate_tensors.py # Generate 9ch × 128 biophysical tensors
│ ├── 03_train_cnn.py # Train CNN with 5-fold stratified CV
│ ├── 04_mechanistic_analysis.py # 5 mechanistic hypotheses
│ └── 05_logo_validation.py # Leave-One-Gene-Out validation
├── data/ # Generated by scripts (not tracked)
├── figures/ # Generated plots
├── results/ # Summary metrics
├── environment.yml # Conda environment
├── LICENSE # MIT
└── CITATION.cff # Citation metadata
# Clone and set up environment
git clone https://github.com/josevilar-qbioai/synonymous-thermodynamic-classification.git
cd synonymous-thermodynamic-classification
conda env create -f environment.yml
conda activate synonymous-thermo
# Step 1: Download data (requires NCBI access — run locally)
python scripts/01_download_clinvar.py
# Step 2: Generate tensors
python scripts/02_generate_tensors.py
# Step 3: Train CNN
python scripts/03_train_cnn.py --subsample 20 --epochs 50 --folds 5
# Step 4: Mechanistic analysis
python scripts/04_mechanistic_analysis.py
# Step 5: LOGO validation
python scripts/05_logo_validation.py --min-pathogenic 3Note: Step 1 requires internet access to NCBI (FTP + Entrez). Steps 2–5 can run offline once data is downloaded.
The thermodynamic engine (core/energy.py) implements SantaLucia (1998) unified nearest-neighbor parameters. The same code powers EnergyFingerprint for missense variant classification and mRNA Stacking Analysis for therapeutic mRNA optimization (patent P202630522, OEPM 2026).
- Python ≥ 3.10
- PyTorch ≥ 2.0
- BioPython, NumPy, Pandas, scikit-learn, SciPy, Matplotlib
See environment.yml for the complete specification.
The classifier operates on a formal decomposition of biological information:
- S(x): discrete sequence (codons) — Matter
- Φ(x): thermodynamic field {ΔG_stack(x_i, x_{i+1})} — Form
- Λ(x) = S(x) ⊗ Φ(x): biological viability — Logos
For synonymous variants: S is unchanged but Φ is perturbed → ΔΛ ≠ 0 → pathogenic. The model captures exactly this signal.
If you use this code or data, please cite:
@misc{vilar2026synonymous,
author = {Vilar Sanchez, Jose Antonio},
title = {Thermodynamic Fingerprinting Reveals Universal Grammar in
Pathogenic Synonymous Variants},
year = {2026},
doi = {10.5281/zenodo.20275792},
url = {https://doi.org/10.5281/zenodo.20275792}
}- EnergyFingerprint — Missense variant classification using thermodynamic mRNA profiles
- mRNA Stacking Analysis — Nearest-neighbor ΔG as complementary dimension for mRNA codon optimization
- SantaLucia (1998) — doi:10.1073/pnas.95.4.1460
The nearest-neighbor stacking thermodynamic profiling method used in this work is protected under Spanish Patent Application P202630522 ("Método de huella termodinámica del mRNA", OEPM 2026). The code in this repository is released under the MIT License for academic and research purposes. Commercial use of the patented method may require a license from the patent holder.
MIT License. See LICENSE.
Jose Antonio Vilar Sanchez
- ORCID: 0009-0008-1057-4223
- GitHub: @josevilar-qbioai
- Contact: qmetrika@proton.me