Lefser is metagenomic biomarker discovery tool that is based on
LEfSe tool and is published by
Huttenhower et al. 2011.
Lefser
is the R implementation of the LEfSe
method.
Using statistical analyses, lefser
compares microbial populations of healthy
and diseased subjects to discover differencially expressed microorganisms.
Lefser
than computes effect size, which estimates magnitude of differential
expression between the populations for each differentially expressed
microorganism. Subclasses of classes can also be assigned and used within the
analysis.
To install Bioconductor and the lefser
package, run the following
commands.
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("lefser")
Then load the lefser
package.
library(lefser)
lefser
The lefser
function can be used with a SummarizedExperiment
.
Load the zeller14
example dataset and exclude ‘adenoma’ conditions.
data(zeller14)
zeller14 <- zeller14[, zeller14$study_condition != "adenoma"]
Note. lefser
supports only two-group contrasts.
The colData
in the SummarizedExperiment
dataset contains the grouping
column study_condition
which includes the ‘control’ and ‘CRC’ groups.
table(zeller14$study_condition)
##
## CRC control
## 91 66
There can be subclasses in each group condition. In the example dataset
we include age_category
as a subclass of study_condition
which includes
‘adults’ and ‘seniors’. This variable will correspond to the blockCol
input argument.
table(zeller14$age_category)
##
## adult senior
## 91 66
We can create a contingency table for the two categorical variables.
table(zeller14$age_category, zeller14$study_condition)
##
## CRC control
## adult 45 46
## senior 46 20
We can now use the lefser
function. It provides results as a data.frame
with the names of selected microorganisms and their effect size.
res <- lefser(zeller14, groupCol = "study_condition", blockCol = "age_category")
head(res)
## Names
## 1 k__Bacteria|p__Fusobacteria|c__Fusobacteriia|o__Fusobacteriales|f__Fusobacteriaceae
## 2 k__Bacteria|p__Fusobacteria|c__Fusobacteriia|o__Fusobacteriales|f__Fusobacteriaceae|g__Fusobacterium
## 3 k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Porphyromonadaceae|g__Porphyromonas
## 4 k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Porphyromonadaceae|g__Porphyromonas|s__Porphyromonas_asaccharolytica|t__Porphyromonas_asaccharolytica_unclassified
## 5 k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Porphyromonadaceae|g__Porphyromonas|s__Porphyromonas_asaccharolytica
## 6 k__Bacteria|p__Fusobacteria
## scores
## 1 -5.262970
## 2 -5.240971
## 3 -5.033524
## 4 -4.939455
## 5 -4.924305
## 6 -4.849309
lefserPlot
lefserPlot(res)
sessionInfo()
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.5 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.16-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.16-bioc/R/lib/libRlapack.so
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_GB LC_COLLATE=C
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats4 stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] lefser_1.8.0 SummarizedExperiment_1.28.0
## [3] Biobase_2.58.0 GenomicRanges_1.50.0
## [5] GenomeInfoDb_1.34.0 IRanges_2.32.0
## [7] S4Vectors_0.36.0 BiocGenerics_0.44.0
## [9] MatrixGenerics_1.10.0 matrixStats_0.62.0
## [11] BiocStyle_2.26.0
##
## loaded via a namespace (and not attached):
## [1] Rcpp_1.0.9 mvtnorm_1.1-3 lattice_0.20-45
## [4] zoo_1.8-11 assertthat_0.2.1 digest_0.6.30
## [7] utf8_1.2.2 R6_2.5.1 evaluate_0.17
## [10] highr_0.9 ggplot2_3.3.6 pillar_1.8.1
## [13] zlibbioc_1.44.0 rlang_1.0.6 multcomp_1.4-20
## [16] jquerylib_0.1.4 magick_2.7.3 Matrix_1.5-1
## [19] rmarkdown_2.17 labeling_0.4.2 splines_4.2.1
## [22] stringr_1.4.1 RCurl_1.98-1.9 munsell_0.5.0
## [25] DelayedArray_0.24.0 compiler_4.2.1 xfun_0.34
## [28] pkgconfig_2.0.3 libcoin_1.0-9 htmltools_0.5.3
## [31] tidyselect_1.2.0 tibble_3.1.8 GenomeInfoDbData_1.2.9
## [34] bookdown_0.29 coin_1.4-2 codetools_0.2-18
## [37] fansi_1.0.3 dplyr_1.0.10 MASS_7.3-58.1
## [40] bitops_1.0-7 grid_4.2.1 DBI_1.1.3
## [43] jsonlite_1.8.3 gtable_0.3.1 lifecycle_1.0.3
## [46] magrittr_2.0.3 scales_1.2.1 cli_3.4.1
## [49] stringi_1.7.8 cachem_1.0.6 farver_2.1.1
## [52] XVector_0.38.0 bslib_0.4.0 vctrs_0.5.0
## [55] generics_0.1.3 sandwich_3.0-2 TH.data_1.1-1
## [58] tools_4.2.1 glue_1.6.2 parallel_4.2.1
## [61] fastmap_1.1.0 survival_3.4-0 yaml_2.3.6
## [64] colorspace_2.0-3 BiocManager_1.30.19 knitr_1.40
## [67] sass_0.4.2 modeltools_0.2-23