CPU-only DNA promoter classifier: E. coli sigma70 promoter prediction with k-mer and PSSM features (LightGBM). No GPU needed.
CPU-only machine-learning classifier that predicts whether an 81 bp E. coli DNA sequence is a sigma70 promoter or a non-promoter.
Built by Xylos Labs as an open-source, reproducible ML project: no GPU needed — the full training run (all 4 models plus 5-fold cross-validation and a small LightGBM grid search) takes ~320 seconds on a 4-core CPU.
| Model | Accuracy | ROC-AUC | MCC | Sensitivity | Specificity |
|---|---|---|---|---|---|
| Logistic Regression | 0.877 | 0.934 | 0.686 | 0.821 | 0.895 |
| Random Forest | 0.902 | 0.951 | 0.722 | 0.664 | 0.979 |
| XGBoost | 0.928 | 0.965 | 0.801 | 0.807 | 0.967 |
| LightGBM (shipped, tuned: 63 leaves, lr 0.03) | 0.923 | 0.962 | 0.786 | 0.793 | 0.965 |
Full metrics, 5-fold cross-validation numbers, per-version ablations and the independent-set evaluation are in RESULTS.md.
python -m venv .venv && source .venv/bin/activate
pip install -e ".[boosting,dev]"
# Train all models, select the best on the validation set, save it
python -m dna_promoter train
# Predict one sequence (81 bp, A/C/G/T only)
python -m dna_promoter predict --sequence AATTGACCGCTATCCTGTAGTGATGTTGCCAGAGTTACGCGCGCGTAAAGTAAGGTAAATAACTGAGTGGTTATTTTAGGG
# {"promoter_probability": 0.8603, "label": "promoter", "model": "lightgbm"}
# Re-evaluate the saved model
python -m dna_promoter evaluate
python -m dna_promoter evaluate --external data/test_sigma70.parquet
# Tests
python -m pytest -q
# Lint (also runs in CI)
python -m ruff check src tests scripts
# Type check (also runs in CI)
python -m mypy src scripts
# Pre-commit checks (also runs in CI); install once with `pre-commit install`
pre-commit run --all-files
# Tests with a coverage report (also runs in CI; badge at the top of this file)
python -m pytest -q --cov=src/dna_promoter --cov-report=term-missing
Data. The iPromoter-2L benchmark (Liu et al., Bioinformatics 2018):
1,694 experimentally validated E. coli sigma70 promoters and 2,860
non-promoters, all 81 bp in the [-60, +20] frame around the transcription
start site. 762 promoters that also appear in the independent
test_sigma70 set were removed before splitting, so that set stays a fair
external check. Final pool: 932 promoters + 2,860 non-promoters, split
stratified 70/15/15 (train/val/test, seed 42). See
DATA_SOURCES.md.
Features (5,196 total).
TTGACA) and -10 (TATAAT) hexamers.Models. Logistic Regression, Random Forest (300 trees), XGBoost and
LightGBM (300 rounds each). Model selection uses the validation set only
(best ROC-AUC); the test set is reported once, for every model. Stratified
5-fold cross-validation on the training split is reported alongside the
held-out test numbers in models/metrics.json (cross_validation).
src/dna_promoter/ package: sequences, features, pssm, geometry, data, models, train, CLI
tests/ pytest: features, validation, PSSM, geometry, smoke training, CLI, cross-validation
scripts/ rebuild data/ipromoter2l.csv from the official supplement
data/ ipromoter2l.csv, test_sigma70.parquet (see data/README.md)
models/ best_model.joblib (LightGBM + PSSM), metrics.json
RESULTS.md real measured results, including ablations
DATA_SOURCES.md dataset provenance, URLs, licences
Code: MIT (see LICENSE). Data files carry their own licences — see DATA_SOURCES.md and data/README.md. If you use this work, please cite Liu et al. 2018 (iPromoter-2L) and Ligeti et al. 2024 (ProkBERT / bacterial_promoters).
Show a friendly error when the model file is missing or invalid
https://github.com/Xylos-Labs/dna-promoter-classifier/issues/15
Labels: 없음
Add an example sequences file with one real promoter and one real non-promoter
https://github.com/Xylos-Labs/dna-promoter-classifier/issues/14
Labels: 없음
Add a Contributors section to the README
https://github.com/Xylos-Labs/dna-promoter-classifier/issues/13
Labels: 없음
Add GitHub issue templates for bug reports and feature requests
https://github.com/Xylos-Labs/dna-promoter-classifier/issues/12
Labels: 없음
Add a confusion-matrix plot for evaluate
https://github.com/Xylos-Labs/dna-promoter-classifier/issues/11
Labels: 없음
Add evaluate --out option to save metrics JSON to a file
https://github.com/Xylos-Labs/dna-promoter-classifier/issues/10
Labels: 없음
Enforce 81 bp length in predict with a clear error
https://github.com/Xylos-Labs/dna-promoter-classifier/issues/9
Labels: 없음
Add predict --threshold flag
https://github.com/Xylos-Labs/dna-promoter-classifier/issues/8
Labels: 없음
Add a quickstart notebook
https://github.com/Xylos-Labs/dna-promoter-classifier/issues/6
Labels: documentation, good first issue, help wanted
Add bootstrap confidence intervals for the test metrics
https://github.com/Xylos-Labs/dna-promoter-classifier/issues/5
Labels: enhancement, help wanted
Thanks for helping improve this project. It is a small, CPU-only ML project, so contributions that keep it reproducible and honest about its results are the most welcome.
git clone https://github.com/Xylos-Labs/dna-promoter-classifier.git
cd dna-promoter-classifier
python -m venv .venv && source .venv/bin/activate
pip install -e ".[boosting,dev]"
pre-commit install # runs the lint, type-check and file-hygiene hooks on every commit
No GPU is needed. The full training run takes about 35 seconds on a 4-core CPU.
main (for example fix/short-description).python -m pytest -q
python -m ruff check src tests scripts # lint (also runs in CI)
python -m mypy src scripts # type check (also runs in CI)
pre-commit run --all-files # same hooks CI runs, including ruff + mypy
python -m pytest -q --cov=src/dna_promoter --cov-report=term-missing # coverage report
python -m dna_promoter train # only if you changed training, features, or data handling
main using the pull request template. Describe what
changed, why, and the measured results (see below).test_sigma70 set stays a fair check: never train on it, and
never add sequences that duplicate it to the training pool (see DATA_SOURCES.md).The code is MIT. The data files carry their own licences (see DATA_SOURCES.md
and data/README.md). Do not add a dataset whose licence you cannot state.
The iPromoter-2L CSV has no explicit open licence statement and is redistributed
for non-commercial research with citation; do not re-license it.
train.py).Do not open a public issue for a security problem. See SECURITY.md.
Be kind and direct. See CODE_OF_CONDUCT.md.