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)lefserThe 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      66There 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     66We can create a contingency table for the two categorical variables.
table(zeller14$age_category, zeller14$study_condition)##         
##          CRC control
##   adult   45      46
##   senior  46      20We 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__Fusobacteria|c__Fusobacteriia
## 5                                                                      k__Bacteria|p__Fusobacteria|c__Fusobacteriia|o__Fusobacteriales
## 6 k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Porphyromonadaceae|g__Porphyromonas|s__Porphyromonas_asaccharolytica
##      scores
## 1 -5.310607
## 2 -5.282705
## 3 -5.079698
## 4 -4.992747
## 5 -4.990987
## 6 -4.990308lefserPlotlefserPlot(res)sessionInfo()## R version 4.1.0 (2021-05-18)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.2 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.13-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.13-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] parallel  stats4    stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] lefser_1.2.0                SummarizedExperiment_1.22.0
##  [3] Biobase_2.52.0              GenomicRanges_1.44.0       
##  [5] GenomeInfoDb_1.28.0         IRanges_2.26.0             
##  [7] S4Vectors_0.30.0            BiocGenerics_0.38.0        
##  [9] MatrixGenerics_1.4.0        matrixStats_0.58.0         
## [11] BiocStyle_2.20.0           
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.6             mvtnorm_1.1-1          lattice_0.20-44       
##  [4] zoo_1.8-9              assertthat_0.2.1       digest_0.6.27         
##  [7] utf8_1.2.1             R6_2.5.0               evaluate_0.14         
## [10] highr_0.9              ggplot2_3.3.3          pillar_1.6.1          
## [13] zlibbioc_1.38.0        rlang_0.4.11           multcomp_1.4-17       
## [16] jquerylib_0.1.4        magick_2.7.2           Matrix_1.3-3          
## [19] rmarkdown_2.8          labeling_0.4.2         splines_4.1.0         
## [22] stringr_1.4.0          RCurl_1.98-1.3         munsell_0.5.0         
## [25] DelayedArray_0.18.0    compiler_4.1.0         xfun_0.23             
## [28] pkgconfig_2.0.3        libcoin_1.0-8          htmltools_0.5.1.1     
## [31] tidyselect_1.1.1       tibble_3.1.2           GenomeInfoDbData_1.2.6
## [34] bookdown_0.22          coin_1.4-1             codetools_0.2-18      
## [37] fansi_0.4.2            crayon_1.4.1           dplyr_1.0.6           
## [40] MASS_7.3-54            bitops_1.0-7           grid_4.1.0            
## [43] DBI_1.1.1              jsonlite_1.7.2         gtable_0.3.0          
## [46] lifecycle_1.0.0        magrittr_2.0.1         scales_1.1.1          
## [49] stringi_1.6.2          farver_2.1.0           XVector_0.32.0        
## [52] bslib_0.2.5.1          ellipsis_0.3.2         vctrs_0.3.8           
## [55] generics_0.1.0         sandwich_3.0-1         TH.data_1.0-10        
## [58] tools_4.1.0            glue_1.4.2             purrr_0.3.4           
## [61] survival_3.2-11        yaml_2.2.1             colorspace_2.0-1      
## [64] BiocManager_1.30.15    knitr_1.33             sass_0.4.0            
## [67] modeltools_0.2-23