Instructions to use rahuls472/DNABERT-Promoter-Classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rahuls472/DNABERT-Promoter-Classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="rahuls472/DNABERT-Promoter-Classifier", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("rahuls472/DNABERT-Promoter-Classifier", trust_remote_code=True) model = AutoModelForSequenceClassification.from_pretrained("rahuls472/DNABERT-Promoter-Classifier", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- 𧬠DNABERT Promoter Classifier
- π Overview
- 𧬠Sequence Preprocessing
- π¨βπ» Author
- π― Classification Task
- π Model Performance
- π Classification Report
- π Confusion Matrix
- π ROC Curve
- π PrecisionβRecall Curve
- βοΈ Training Configuration
- π» Example Usage
- π¬ Training Pipeline
- π Applications
- β οΈ Limitations
- π Future Work
- π Acknowledgements
𧬠DNABERT Promoter Classifier
A fine-tuned DNABERT model for binary promoter sequence classification. Given a DNA sequence, the model predicts whether it belongs to a Promoter or Non-Promoter region.
Unlike conventional NLP models, DNABERT treats DNA as a language. During preprocessing, each DNA sequence is converted into overlapping 6-mers, enabling the Transformer to learn biologically meaningful sequence patterns.
This project demonstrates the application of Transformer-based deep learning for computational genomics and serves as part of my Bioinformatics and Machine Learning portfolio.
π Overview
Promoters are regulatory DNA elements responsible for initiating gene transcription. Accurate promoter identification plays a critical role in:
- Genome annotation
- Gene regulation studies
- Functional genomics
- Bioinformatics research
This model fine-tunes DNABERT, a Transformer model pre-trained on genomic sequences represented as 6-mers.
| Property | Value |
|---|---|
| Base Model | DNABERT (DNA-BERT-6) |
| Task | Binary DNA Sequence Classification |
| Framework | Hugging Face Transformers |
| Backend | PyTorch |
| Precision | FP16 Mixed Precision |
| Training Platform | Google Colab GPU |
𧬠Sequence Preprocessing
Before tokenization, every DNA sequence is converted into overlapping 6-mers, matching the representation used during DNABERT pretraining.
Example:
DNA sequence
ATGCGTACGA
6-mer representation
ATGCGT TGCGTA GCGTAC CGTACG GTACGA
The generated 6-mer sentence is then tokenized using the DNABERT tokenizer.
Important: The same preprocessing must be applied during inference. Raw DNA sequences should always be converted to 6-mers before being passed to the model.
π¨βπ» Author
Rahul Kumar Singh
M.Sc. Bioinformatics
Deen Dayal Upadhyaya Gorakhpur University
- GitHub: https://github.com/rahuls472
- Hugging Face: https://huggingface.co/rahuls472
- LinkedIn: https://www.linkedin.com/in/rahul-kumar-singh-1796b5332/
π― Classification Task
| Label | Class |
|---|---|
| 0 | Non-Promoter |
| 1 | Promoter |
π Model Performance
The model was evaluated on the held-out test dataset.
| Metric | Score |
|---|---|
| Accuracy | 90.8% |
| Weighted Precision | 0.92 |
| Weighted Recall | 0.91 |
| Weighted F1-score | 0.91 |
| ROC-AUC | 0.958 |
| Average Precision (PR-AUC) | 0.973 |
π Classification Report
| Class | Precision | Recall | F1-score |
|---|---|---|---|
| Non-Promoter | 0.85 | 0.98 | 0.91 |
| Promoter | 0.98 | 0.85 | 0.91 |
Overall Test Accuracy: 90.8%
π Confusion Matrix
π ROC Curve
ROC-AUC = 0.958
π PrecisionβRecall Curve
Average Precision = 0.973
βοΈ Training Configuration
| Parameter | Value |
|---|---|
| Learning Rate | 2e-5 |
| Batch Size | 8 |
| Epochs | 5 |
| Weight Decay | 0.01 |
| Optimizer | AdamW |
| Mixed Precision | FP16 |
| Evaluation Strategy | Every Epoch |
| k-mer Size | 6 |
| Maximum Sequence Length | 512 Tokens |
π» Example Usage
from transformers import AutoTokenizer
from transformers import AutoModelForSequenceClassification
import torch
def generate_kmers(sequence, k=6):
return " ".join(
sequence[i:i+k]
for i in range(len(sequence)-k+1)
)
model_name = "rahuls472/DNABERT-Promoter-Classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
sequence = "ATCGGCTAGCTAGCTAGCTAGCTA"
sequence = generate_kmers(sequence)
inputs = tokenizer(
sequence,
return_tensors="pt",
truncation=True,
padding="max_length",
max_length=512
)
with torch.no_grad():
outputs = model(**inputs)
prediction = torch.argmax(outputs.logits, dim=1).item()
print("Promoter" if prediction == 1 else "Non-Promoter")
π¬ Training Pipeline
DNA Sequence
β
βΌ
Generate overlapping 6-mers
β
βΌ
DNABERT Tokenizer
β
βΌ
DNABERT Encoder
β
βΌ
Sequence Classification Head
β
βΌ
Promoter / Non-Promoter
π Applications
- Promoter prediction
- DNA sequence classification
- Genome annotation
- Functional genomics
- Computational biology research
- Educational projects
β οΈ Limitations
This model is intended for research and educational purposes only.
It is not intended for:
- Clinical diagnosis
- Medical decision making
- Disease prediction
- Variant interpretation
π Future Work
- Multi-species promoter prediction
- Cross-validation experiments
- Hyperparameter optimization
- Multi-class genomic element classification
- Explainability using attention visualization
- Integration into genomics analysis pipelines
π Acknowledgements
This project was developed using:
- Hugging Face Transformers
- PyTorch
- Google Colab
- DNABERT
- Genomic Benchmarks Dataset
Special thanks to the open-source bioinformatics and machine learning communities for providing the datasets, pretrained models, and tools that made this work possible.
- Downloads last month
- 19