🧬 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


🎯 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
Safetensors
Model size
89.2M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support