Contents

1 Introduction

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.

2 Installation

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)

3 Overview and example use of 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
## 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.295297
## 2 -5.266233
## 3 -5.063656
## 4 -4.936072
## 5 -4.931879
## 6 -4.927330

4 Visualizing results with lefserPlot

lefserPlot(res)

4.1 sessionInfo

sessionInfo()
## R version 4.1.1 (2021-08-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.3 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.14-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.14-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.4.0                SummarizedExperiment_1.24.0
##  [3] Biobase_2.54.0              GenomicRanges_1.46.0       
##  [5] GenomeInfoDb_1.30.0         IRanges_2.28.0             
##  [7] S4Vectors_0.32.0            BiocGenerics_0.40.0        
##  [9] MatrixGenerics_1.6.0        matrixStats_0.61.0         
## [11] BiocStyle_2.22.0           
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.7             mvtnorm_1.1-3          lattice_0.20-45       
##  [4] zoo_1.8-9              assertthat_0.2.1       digest_0.6.28         
##  [7] utf8_1.2.2             R6_2.5.1               evaluate_0.14         
## [10] highr_0.9              ggplot2_3.3.5          pillar_1.6.4          
## [13] zlibbioc_1.40.0        rlang_0.4.12           multcomp_1.4-17       
## [16] jquerylib_0.1.4        magick_2.7.3           Matrix_1.3-4          
## [19] rmarkdown_2.11         labeling_0.4.2         splines_4.1.1         
## [22] stringr_1.4.0          RCurl_1.98-1.5         munsell_0.5.0         
## [25] DelayedArray_0.20.0    compiler_4.1.1         xfun_0.27             
## [28] pkgconfig_2.0.3        libcoin_1.0-9          htmltools_0.5.2       
## [31] tidyselect_1.1.1       tibble_3.1.5           GenomeInfoDbData_1.2.7
## [34] bookdown_0.24          coin_1.4-2             codetools_0.2-18      
## [37] fansi_0.5.0            crayon_1.4.1           dplyr_1.0.7           
## [40] MASS_7.3-54            bitops_1.0-7           grid_4.1.1            
## [43] DBI_1.1.1              jsonlite_1.7.2         gtable_0.3.0          
## [46] lifecycle_1.0.1        magrittr_2.0.1         scales_1.1.1          
## [49] stringi_1.7.5          farver_2.1.0           XVector_0.34.0        
## [52] bslib_0.3.1            ellipsis_0.3.2         vctrs_0.3.8           
## [55] generics_0.1.1         sandwich_3.0-1         TH.data_1.1-0         
## [58] tools_4.1.1            glue_1.4.2             purrr_0.3.4           
## [61] parallel_4.1.1         fastmap_1.1.0          survival_3.2-13       
## [64] yaml_2.2.1             colorspace_2.0-2       BiocManager_1.30.16   
## [67] knitr_1.36             sass_0.4.0             modeltools_0.2-23