Skip to content

Beginner-friendly LEfSe/lefser pipeline for microbiome differential abundance analysis. Automatically formats input tables, builds a SummarizedExperiment, runs lefser, and generates publication-ready plots with a single command.

License

Notifications You must be signed in to change notification settings

manastast/lefse_for_dummies.R

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

###################################################################################

LEFSE FOR DUMMIES

A beginner-friendly wrapper for LEfSe / lefser differential abundance

###################################################################################

DOI

License: MIT

lefse-for-dummies

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 SummarizedExperiment object
  • 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.

INPUT

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, or Feature

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.

USAGE

Basic run (default settings)

Rscript lefse_for_dummies.R input.txt myrun

Custom feature column + custom grouping pattern

Rscript lefse_for_dummies.R input.txt myrun FeatureName "_."

Arguments:

  1. input.txt — your input table
  2. myrun — output prefix
  3. FeatureName — the name of the column containing feature IDs
  4. "_. " — 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.

OUTPUT FILES

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)


DIRECTORY STRUCTURE

lefse-for-dummies/
  lefse_for_dummies.R
  README.md
  LICENSE
  example_input.txt

DEPENDENCIES

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_easy

CITATION

If you use lefse-for-dummies in your work, please cite the original methods:

1. LEfSe (original algorithm)

Segata et al., Metagenomic biomarker discovery and explanation. Genome Biology. 2011.
https://doi.org/10.1186/gb-2011-12-6-r60

2. lefser (R implementation)

The R package used by this pipeline:
https://github.com/cole-trapnell-lab/lefser

3. Citation

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} }

LICENSE

License: MIT

About

Beginner-friendly LEfSe/lefser pipeline for microbiome differential abundance analysis. Automatically formats input tables, builds a SummarizedExperiment, runs lefser, and generates publication-ready plots with a single command.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published