Predict Mitochondrial Fitness from single-cell RNA-seq using Kolmogorov-Arnold Neural Networks
You give it: A Seurat object with normalized counts
It gives you: Mitochondrial Function Index (MFI) for every cell
- Auto-calculates metabolic scores (Mitophagy, OXPHOS, TCA, Glycolysis, UPRmt, mt%)
- Computes MFI from those scores
- Trains a neural network to predict MFI from ~200 mitochondrial genes
- Finds important genes that drive mitochondrial quality
install.packages(c("Seurat", "qs", "dplyr", "torch", "ggplot2"))
torch::install_torch() # Downloads PyTorch (~500MB)library(Seurat)
source("kann_mfi.R")
# Load your data
seu <- readRDS("my_seurat_object.rds")
# Step 1: Calculate MFI (auto-calculates everything!)
seu <- calculate_MFI(seu)
# Step 2: Train neural network
fit <- train_kann(seu, epochs = 300)
# Step 3: Predict for all cells
seu <- predict_kann(seu, fit)
# Step 4: Plot
plot_predictions(seu)
# Step 5: Find important genes
imp <- perm_importance(seu, fit)
plot_importance(imp)
# Step 6: Save everything
save_kann(fit, dir = "my_model")
saveRDS(seu, "seurat_with_MFI.rds")That's it! Check out example.R for a complete annotated walkthrough.
- A Seurat object with normalized counts (run
NormalizeData()if you haven't) - That's it!
- Mitophagy score (27 genes)
- OXPHOS score (Complex I-V genes)
- TCA cycle score
- Glycolysis score
- UPRmt score (15 genes)
- Mitochondrial % (from MT- genes)
- MFI (combines all of the above)
All you need is raw RNA counts! π
Mitochondrial Function Index = a single number that summarizes mitochondrial health
MFI = (Mitophagy + OXPHOS + UPRmt) - penalties
Higher MFI = healthier mitochondria
Penalties for:
- High mitochondrial DNA %
- OXPHOS/Glycolysis imbalance
- Excess TCA activity
Mitophagy- mitophagy activityOXPHOS1- oxidative phosphorylationTCA1- TCA cycle activityGlyco1- glycolysisUPRmtScore- mitochondrial unfolded protein responsepercent.mt- mitochondrial fractionMFI_v1- calculated mitochondrial quality index βMFI_pred- KANN prediction of MFI β
pred_vs_obs.pdf- How well the model worksimportance.pdf- Top genes that determine MFIimportance_all_genes.csv- Complete gene rankingsmy_model/- Saved model (reusable!)
source("kann_mfi.R")
seu <- readRDS("data.rds")
# Everything in 4 lines:
seu <- calculate_MFI(seu)
fit <- train_kann(seu, epochs = 300)
seu <- predict_kann(seu, fit)
plot_predictions(seu)source("kann_mfi.R")
# Load model
fit <- load_kann("my_model")
# Apply to new data
new_seu <- readRDS("new_data.rds")
new_seu <- calculate_MFI(new_seu)
new_seu <- predict_kann(new_seu, fit)# After running the pipeline
library(ggplot2)
# MFI by cell type
ggplot(seu@meta.data, aes(x = cell_type, y = MFI_v1)) +
geom_boxplot() +
theme_classic()
# Top genes for each cell type
for (ct in unique(seu$cell_type)) {
seu_sub <- subset(seu, cell_type == ct)
imp <- perm_importance(seu_sub, fit, repeats = 3)
print(head(imp, 10))
}- RΒ² > 0.7 - Model captures most MFI variation
- RMSE < 0.5 - Predictions are close to observed
- > 0.01 - Gene strongly affects MFI
- 0.001-0.01 - Moderate effect
- < 0.001 - Weak effect
- Mitophagy receptors (BNIP3, FUNDC1, PINK1, PRKN)
- OXPHOS genes (Complex I, Complex V)
- Quality control (LONP1, CLPP, HSPD1)
kann-mfi/
βββ kann_mfi.R # π΄ Main file - source this!
βββ example.R # Complete working example
βββ README.md # This file
βββ LICENSE # MIT License
βββ logo.png # Hex sticker
Just download kann_mfi.R and you're good to go!
**Q: I'm so lost what do I do?
A: Create an issue on the issue tab :)
Q: I only have a count matrix, not a Seurat object
A:
seu <- CreateSeuratObject(counts = your_matrix)
seu <- NormalizeData(seu)
# Now use the pipeline!Q: Some genes are missing from my dataset
A: No problem! The pipeline uses whatever genes are available and tells you the coverage %.
Q: Can I use my own gene sets?
A: Yes! Pass your own genes to train_kann():
my_genes <- c("PINK1", "PRKN", "MFN1", "MFN2", ...)
fit <- train_kann(seu, features = my_genes)Q: How long does training take?
A: ~2-5 minutes for 10,000 cells on a laptop. Permutation importance takes longer (10-30 min).
Q: Can I use this on mouse data?
A: Yes! Gene names should be in the same format as your Seurat object (e.g., Ppargc1a for mouse).
Q: What if I already have metabolic scores?
A: The pipeline checks for existing scores and skips them. Use force_recalc=TRUE to recalculate:
seu <- calculate_MFI(seu, force_recalc = TRUE)@software{kann_mfi_2025,
author = {<Fahd Qadir aka Dragonmasterx87>},
title = {KANN-MFI: Kolmogorov-Arnold Networks for Mitochondrial Fitness Prediction},
year = {2025},
url = {https://github.com/FMJLabTulane/kann-mfi}
}MIT License - Free to use, modify, and share!
- Issues? Open an issue on GitHub
- Questions? Check
example.Rfor detailed walkthrough - Email: mqadir@tulane.edu
Based on:
- Kolmogorov-Arnold representation theorem
- Liu et al. (2024) "KAN: Kolmogorov-Arnold Networks" arXiv:2404.19756
- Seurat: Hao et al. (2021) Cell
