DNA Splice-Junction Classification
Classification of DNA sequences into splice-junction regions — exon-intron (EI), intron-exon (IE), and neither (N) — using classical ML in R and a recurrent neural network in Python.
Write-up
A detailed project report is available on the author’s blog: https://statgyan.wordpress.com/2022/08/21/dna-analysis-classification/
Problem
Given a 60-nucleotide DNA sequence window, predict whether it contains a splice-junction boundary and, if so, which type. This is a multi-class classification task on categorical (base-pair) sequence data.
Approach
Project1.r — Classical ML pipeline ®
- Preprocessing
- One-hot encoding of nucleotide positions (
caret::dummyVars)
- Dimensionality reduction via sparse PCA (
sparsepca::spca)
- 80/20 train-test split
- Exploratory analysis — class distribution across train/test splits (
ggplot2)
- Models evaluated
- Naive Bayes (
e1071)
- k-Nearest Neighbors, tuned via repeated cross-validation (
caret, kknn)
- Multinomial logistic regression (
nnet) and penalized/regularized variant (glmnet)
- Decision tree with cost-complexity pruning (
rpart)
- Random forest (
caret, rf)
- Feed-forward neural network, tuned over hidden-layer size and weight decay (
caret, nnet), visualized with NeuralNetTools
- Evaluation — confusion matrices and accuracy via
caret::confusionMatrix for every model
- k-mer feature extraction — a
count() utility for encoding sequences as k-mer frequency vectors, used as an alternative feature representation
DNA_RNN.ipynb — Recurrent neural network (Python)
Sequence-native classification approach using an RNN over raw nucleotide sequences, avoiding hand-engineered features.
Repository Contents
| File |
Description |
Project1.r |
Full classical ML pipeline: preprocessing, EDA, model training/tuning, evaluation across six algorithms |
DNA_RNN.ipynb |
RNN-based sequence classifier |
Data
The R script expects a pre-cleaned splice-junction dataset (spliced1.RDS) with a class column (EI / IE / N) and per-position nucleotide predictors — consistent with the UCI Molecular Biology (Splice-junction Gene Sequences) dataset format. The data path is currently hardcoded to a local file; update it before running.
Requirements ®
install.packages(c(
"dplyr", "ggplot2", "caret", "e1071", "caTools",
"rpart", "rpart.plot", "tree", "ISLR",
"glmnet", "Matrix", "nnet", "NeuralNetTools",
"FactoMineR", "elasticnet", "sparsepca"
))
https://statgyan.wordpress.com/2022/08/21/dna-analysis-classification/
评论