variantllm / README.md
hardiksood21
docs: add official Zenodo permanent DOI badge (10.5281/zenodo.22269466)
0efd050
|
Raw History Blame Contribute Delete
6.01 kB

A newer version of the Gradio SDK is available: 6.31.0

Upgrade
metadata
title: VariantLLM
emoji: 🧬
colorFrom: indigo
colorTo: pink
sdk: gradio
sdk_version: 6.26.0
app_file: app.py
pinned: false
license: mit

🧬 VariantLLM: Clinical Variant Effect Prediction Engine

Python 3.10+ PyTorch License: MIT FastAPI DOI Hugging Face Space

An open-source, production-grade genomic foundation AI software system designed to predict the pathogenicity, functional consequence, and zero-shot evolutionary fitness scores of human genetic mutations and single-nucleotide variants (SNVs) powered by Meta's ESM-2 Foundation Model.

Developed by Hardik Sood (Indian Institute of Technology (BHU), Varanasi).


🌟 Key Engineering Features

  1. Meta ESM-2 Transformer Foundation Backbone: Directly integrates facebook/esm2_t6_8M_UR50D for contextual protein and genomic representation learning.
  2. Zero-Shot Evolutionary Fitness Delta-Scoring: Computes masked-marginal Log-Likelihood Ratio (LLR) scoring: $$\Delta \text{Score} = \log P(\text{Wildtype Residue} \mid \text{Context}) - \log P(\text{Mutant Residue} \mid \text{Context})$$ Quantifying sequence disruption without requiring supervised task-specific fine-tuning (aligned with Meta ESM1v and DeepMind AlphaMissense methodologies).
  3. Production FastAPI Microservice: High-throughput REST API with automated validation schemas for downstream clinical pipelines.
  4. Interactive Web Dashboard: Native Gradio and Streamlit interfaces with sequence mismatch mapping, risk meters, residue entropy indicators, and preset clinical mutations (TP53, BRCA1, EGFR, BRAF, KRAS).
  5. Automated CI/CD: Complete unit test suite with pytest and GitHub Actions workflow.

πŸ—οΈ Repository Architecture

variantllm/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── tests.yml                     # Automated CI/CD workflow
β”œβ”€β”€ app.py                                # Native Gradio Web Application (HF Spaces)
β”œβ”€β”€ app/
β”‚   └── app.py                            # Streamlit Web Application
β”œβ”€β”€ benchmarks/
β”‚   └── evaluate_clinvar.py               # ClinVar Benchmark & Evaluation Suite
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ processed/
β”‚   β”‚   β”œβ”€β”€ clinvar_benchmark_sample.csv  # Curated ClinVar clinical benchmark
β”‚   β”‚   └── clinvar_evaluation_results.csv# Live benchmark metrics
β”‚   └── curate_clinvar_benchmark.py       # Gold-standard ClinVar curator
β”œβ”€β”€ notebooks/
β”‚   └── train_benchmark.py                # Benchmark training pipeline
β”œβ”€β”€ src/
β”‚   └── variantllm/                       # Core Python Package
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ api/
β”‚       β”‚   β”œβ”€β”€ __init__.py
β”‚       β”‚   └── main.py                   # FastAPI REST API Microservice
β”‚       β”œβ”€β”€ inference/
β”‚       β”‚   β”œβ”€β”€ __init__.py
β”‚       β”‚   └── scorer.py                 # ESM-2 Zero-Shot LLR Evolutionary Scorer
β”‚       β”œβ”€β”€ models/
β”‚       β”‚   β”œβ”€β”€ __init__.py
β”‚       β”‚   └── variant_transformer.py    # PyTorch Multi-Head Attention Transformer
β”‚       β”œβ”€β”€ tokenization/
β”‚       β”‚   β”œβ”€β”€ __init__.py
β”‚       β”‚   └── genomic_tokenizer.py      # k-mer & Character Genomic Tokenizers
β”‚       └── training/
β”‚           β”œβ”€β”€ __init__.py
β”‚           β”œβ”€β”€ dataset.py                # PyTorch Dataset Loader
β”‚           └── trainer.py                # Focal Loss & Cosine Annealing Trainer
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_api.py                       # FastAPI endpoint test suite
β”‚   β”œβ”€β”€ test_inference.py                 # ESM-2 zero-shot scoring test suite
β”‚   β”œβ”€β”€ test_model.py                     # Transformer forward pass test suite
β”‚   └── test_tokenizer.py                 # Tokenizer encoding test suite
β”œβ”€β”€ LICENSE                               # MIT License
β”œβ”€β”€ pyproject.toml                        # Modern Python package configuration
β”œβ”€β”€ README.md                             # Project documentation & HF Space Header
└── requirements.txt                      # Project dependencies

πŸš€ Quick Start

1. Installation

git clone https://github.com/hardiksood21/variantllm.git
cd variantllm
pip install -e .

2. Run Test Suite

pytest tests/ -v

3. Run ClinVar Benchmark Evaluation

python benchmarks/evaluate_clinvar.py

4. Launch Interactive Gradio Web App

python app.py

5. Launch FastAPI REST Service

uvicorn variantllm.api.main:app --reload --port 8000

πŸ”¬ Benchmark Performance on ClinVar Multi-Disease Cohort

Metric Score Clinical Significance
ROC-AUC 1.0000 Exceptional discrimination between pathogenic & benign controls
PR-AUC 1.0000 Outstanding precision-recall across imbalanced genomic variants
Overall Accuracy 94.44% Robust concordant classification across multi-disease cohorts
F1-Score 0.9524 Optimal harmonic mean of precision and recall
Matthews Correlation (MCC) 0.8919 High-fidelity correlation on gold-standard ClinVar

πŸ“œ Citation & License

Distributed under the MIT License. Created by Hardik Sood.