###################################################################################
###################################################################################
A simple, beginner-friendly pipeline that runs LEfSe-style differential abundance analysis using the R package lefser.
This script automatically:
- cleans the input table
- standardizes feature and sample names
- builds a
SummarizedExperimentobject - extracts group/condition labels from sample names
- runs
lefser() - exports results
- generates a publication-ready plot
No advanced R skills needed — just run one command.
Your input must be a tab-delimited file containing:
- One feature per row (e.g. Genus, Family, OTU, ASV)
- One sample per column
- A feature ID column such as
Genus,Taxon, orFeature
Example input format:
Genus Sample1 Sample2 Sample3 ...
A 10 2 8
B 3 15 5
C 0 1 20
The default feature column is Genus, but you can change this in the command.
Rscript lefse_for_dummies.R input.txt myrun
Rscript lefse_for_dummies.R input.txt myrun FeatureName "_."
Arguments:
input.txt— your input tablemyrun— output prefixFeatureName— the name of the column containing feature IDs"_. "— regex pattern removed from sample names to extract group labels
Example:
If your sample names are:
Control_1 Control_2 Stress_1 Stress_2
Then "_. " strips the trailing underscore+number and leaves group names.
After running, you will get:
-
myrun_lefser_results.tsv
(table of LefSe/lefser LDA-style results) -
myrun_lefser_plot.png
(bar plot of significant features)
lefse-for-dummies/
lefse_for_dummies.R
README.md
LICENSE
example_input.txt
Install the required R packages:
install.packages(c("dplyr", "tidyr", "stringr"))
BiocManager::install("SummarizedExperiment")
install.packages("lefser")Or run inside a conda environment with R:
conda create -n lefse_easy r-base r-dplyr r-tidyr r-stringr bioconductor-summarizedexperiment -c bioconda -c conda-forge
conda activate lefse_easyIf you use lefse-for-dummies in your work, please cite the original methods:
Segata et al., Metagenomic biomarker discovery and explanation. Genome Biology. 2011.
https://doi.org/10.1186/gb-2011-12-6-r60
The R package used by this pipeline:
https://github.com/cole-trapnell-lab/lefser
If you use lefse-for-dummies in your research, please cite:
Anastasia Boutsika (2025). lefse-for-dummies (v1.0.0). Zenodo.
https://doi.org/10.5281/zenodo.17855909
@software{boutsika_2025_lefse_for_dummies,
author = {Boutsika, Anastasia},
title = {lefse-for-dummies: A lightweight wrapper around lefser for fast and simple LEfSe-style differential analysis},
year = {2025},
publisher = {Zenodo},
version = {v1.0.0},
doi = {10.5281/zenodo.17855909},
url = {https://doi.org/10.5281/zenodo.17855909}
}