██████╗ ██╗ ████████╗ ██████╗███╗ ██╗███╗ ██╗
██╔══██╗██║ ╚══██╔══╝ ██╔════╝████╗ ██║████╗ ██║
██████╔╝██║ ██║ ██║ ██╔██╗ ██║██╔██╗ ██║
██╔══██╗██║ ██║ ██║ ██║╚██╗██║██║╚██╗██║
██████╔╝███████╗██║ ╚██████╗██║ ╚████║██║ ╚████║
╚═════╝ ╚══════╝╚═╝ ╚═════╝╚═╝ ╚═══╝╚═╝ ╚═══╝
BLT-CNN is a novel hybrid deep learning architecture that predicts antibiotic resistance
from raw DNA sequences — combining entropy-guided patching, local motif detection, and
global sequence context in a single end-to-end trainable model.
"Antimicrobial resistance is predicted to kill 10 million people per year by 2050 — more than cancer."
— UN Interagency Coordination Group on AMR
Traditional resistance testing takes 24–72 hours. Patients die waiting.
BLT-CNN predicts resistance from a DNA sequence in milliseconds.
DNA Sequence (300 nucleotides)
│
┌───────▼───────┐
│ Embedding │ 5-token vocab → 64-dim vectors
└───────┬───────┘
│
┌─────────────┼─────────────┐
│ │
┌─────────▼──────────┐ ┌──────────▼──────────┐
│ BLT Entropy │ │ 1D CNN │
│ Patcher │ │ Local Motifs │
│ │ │ │
│ H(i) > 1.5 bits │ │ Conv(256, k=9) │
│ → 3-nt patch │ │ Conv(128, k=9) │
│ H(i) ≤ 1.5 bits │ │ MaxPool(2) │
│ → 12-nt patch │ │ │
│ │ └──────────┬──────────┘
│ Output: 64-dim │ │
└─────────┬──────────┘ ┌──────────▼──────────┐
│ │ Transformer │
│ │ Encoder │
│ │ │
│ │ 4 layers, 8 heads │
│ │ GELU, sinusoidal PE │
│ │ Output: 128-dim │
│ └──────────┬──────────┘
│ │
└──────────┬───────────────┘
│ Concatenate [128 + 64] = 192-dim
┌────────▼────────┐
│ Fusion MLP │ 192 → 256 → 128
│ LayerNorm │ + Dropout
└────────┬────────┘
│
┌────────▼────────┐
│ Classifier │ 128 → 3
│ Sigmoid │ Multi-label output
└────────┬────────┘
│
┌──────────────┼──────────────┐
▼ ▼ ▼
Methicillin Ciprofloxacin Vancomycin
99.8% 0.6% 0.0%
RESISTANT SUSCEPTIBLE SUSCEPTIBLE
| Metric | Score |
|---|---|
| 🎯 Accuracy | 93.34% |
| 📈 AUC | 98.55% |
| ⚖️ F1 Score | 94.18% |
| 🔬 Precision | 95.57% |
| 📡 Recall | 93.35% |
| 🧮 Parameters | 944,387 |
| Antibiotic | Samples | Precision | Recall | F1 | Status |
|---|---|---|---|---|---|
| 🔵 Methicillin | 3,612 | 0.9761 | 0.9852 | 0.9806 | ✅ Excellent |
| 🟡 Ciprofloxacin | 283 | 0.8857 | 0.5849 | 0.7045 | |
| 🔴 Vancomycin | 171 | 0.6500 | 0.5417 | 0.5909 | 🔧 Improving |
|
Beta-lactam antibiotic Targets S. aureus (MRSA) |
Fluoroquinolone antibiotic Targets E. coli, Klebsiella |
Glycopeptide antibiotic Targets Enterococcus (VRE) |
git clone https://github.com/man-ra/BLT-CNN-Project.git
cd BLT-CNN-Project
pip install -r requirements.txt# Start the FastAPI backend
python app_api.py
# Then open blt_cnn_ui.html in your browser
# → Real predictions with 3D DNA helix animationpython -m streamlit run app.py
# Opens at http://localhost:8501# Process CARD database
python scripts/process_card.py
# Train BLT-CNN
python scripts/train_card.pyBLT-CNN-Project/
│
├── 🧠 src/
│ ├── models/
│ │ ├── blt_patcher.py ← Entropy-guided dynamic patching
│ │ ├── cnn1d.py ← 1D CNN local motif detection
│ │ ├── transformer.py ← Transformer encoder
│ │ └── blt_cnn.py ← Hybrid fusion model ⭐
│ ├── data/
│ │ ├── dataset.py ← CARD data loader
│ │ └── encoding.py ← Nucleotide encoder
│ └── training/
│ ├── trainer.py ← Training loop
│ ├── losses.py ← Loss functions
│ └── metrics.py ← Evaluation metrics
│
├── 🔬 scripts/
│ ├── process_card.py ← CARD database processor
│ ├── train_card.py ← Main training script
│ └── evaluate.py ← Evaluation script
│
├── 🌐 Frontend/
│ ├── blt_cnn_ui.html ← 3D animated web UI ✨
│ ├── app.py ← Streamlit app
│ └── app_api.py ← FastAPI backend
│
├── 📊 results/
│ └── card_results.json ← Training results
│
└── 🤖 models/
└── blt_cnn_card_best.pth ← Best trained model (epoch 18)
Unlike fixed tokenization, BLT dynamically adjusts resolution based on information content:
DNA: A T G A A A C G T A T C G G A A T T C G ...
│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
Ent: 1.2 1.1 2.1 2.3 1.9 2.2 1.0 1.0 1.1 1.2
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
[ large ][small][small][ large ][large]
12-nt patch 3-nt 3-nt 12-nt patch
conserved hotspot conserved
- High entropy (>1.5 bits) → 3-nucleotide patches → captures mutation hotspots
- Low entropy (≤1.5 bits) → 12-nucleotide patches → efficiently compresses conserved regions
This mirrors biology: resistance mutations cluster in specific variable regions while flanking sequences remain conserved.
torch>=2.0
numpy
scikit-learn
fastapi
uvicorn
streamlit
biopython
pandas
matplotlib
If you use this work, please cite:
@misc{bltcnn2026,
title = {BLT-CNN: A Hybrid Deep Learning Architecture for
Antibiotic Resistance Prediction from Genomic Sequences},
author = {Mantasha},
year = {2026},
url = {https://github.com/man-ra/BLT-CNN-Project},
note = {B.Tech Research Project}
}- Pagnoni et al. (2024) — Byte Latent Transformer, Meta AI
- Alcock et al. (2023) — CARD 2023, Nucleic Acids Research
- Arango-Argoty et al. (2018) — DeepARG, Microbiome
- Vaswani et al. (2017) — Attention Is All You Need, NeurIPS
Built with 🧬 by Mantasha
B.Tech 3rd Year · Antibiotic Resistance Research
⭐ Star this repo if you found it useful
"The bacteria are evolving. So should our tools."