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|g__Fusobacterium`
## 2 `k__Bacteria|p__Fusobacteria|c__Fusobacteriia|o__Fusobacteriales|f__Fusobacteriaceae`
## 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`
## 5 `k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Porphyromonadaceae|g__Porphyromonas|s__Porphyromonas_asaccharolytica|t__Porphyromonas_asaccharolytica_unclassified`
## 6 `k__Bacteria|p__Fusobacteria|c__Fusobacteriia`
## scores
## 1 -5.253117
## 2 -5.211406
## 3 -5.064497
## 4 -4.972599
## 5 -4.963452
## 6 -4.823576
lefserPlot
lefserPlot(res)
sessionInfo()
## R version 4.0.3 (2020-10-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.5 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.12-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.12-bioc/R/lib/libRlapack.so
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 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] parallel stats4 stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] lefser_1.0.0 SummarizedExperiment_1.20.0
## [3] Biobase_2.50.0 GenomicRanges_1.42.0
## [5] GenomeInfoDb_1.26.0 IRanges_2.24.0
## [7] S4Vectors_0.28.0 BiocGenerics_0.36.0
## [9] MatrixGenerics_1.2.0 matrixStats_0.57.0
## [11] BiocStyle_2.18.0
##
## loaded via a namespace (and not attached):
## [1] tidyselect_1.1.0 zoo_1.8-8 modeltools_0.2-23
## [4] xfun_0.18 coin_1.3-1 purrr_0.3.4
## [7] splines_4.0.3 lattice_0.20-41 generics_0.0.2
## [10] vctrs_0.3.4 colorspace_1.4-1 htmltools_0.5.0
## [13] yaml_2.2.1 survival_3.2-7 rlang_0.4.8
## [16] pillar_1.4.6 glue_1.4.2 multcomp_1.4-14
## [19] GenomeInfoDbData_1.2.4 lifecycle_0.2.0 stringr_1.4.0
## [22] zlibbioc_1.36.0 munsell_0.5.0 gtable_0.3.0
## [25] mvtnorm_1.1-1 codetools_0.2-16 evaluate_0.14
## [28] labeling_0.4.2 knitr_1.30 Rcpp_1.0.5
## [31] TH.data_1.0-10 scales_1.1.1 BiocManager_1.30.10
## [34] DelayedArray_0.16.0 magick_2.5.0 XVector_0.30.0
## [37] farver_2.0.3 ggplot2_3.3.2 digest_0.6.27
## [40] stringi_1.5.3 dplyr_1.0.2 bookdown_0.21
## [43] grid_4.0.3 tools_4.0.3 bitops_1.0-6
## [46] sandwich_3.0-0 magrittr_1.5 RCurl_1.98-1.2
## [49] tibble_3.0.4 pkgconfig_2.0.3 crayon_1.3.4
## [52] MASS_7.3-53 ellipsis_0.3.1 libcoin_1.0-6
## [55] Matrix_1.2-18 rmarkdown_2.5 R6_2.4.1
## [58] compiler_4.0.3