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|o__Fusobacteriales
##      scores
## 1 -5.246654
## 2 -5.244013
## 3 -5.043321
## 4 -4.958285
## 5 -4.930278
## 6 -4.859164

4 Visualizing results with lefserPlot

lefserPlot(res)

4.1 sessionInfo

sessionInfo()
## R version 4.2.0 RC (2022-04-19 r82224)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.15-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.15-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.6.0                SummarizedExperiment_1.26.0
##  [3] Biobase_2.56.0              GenomicRanges_1.48.0       
##  [5] GenomeInfoDb_1.32.0         IRanges_2.30.0             
##  [7] S4Vectors_0.34.0            BiocGenerics_0.42.0        
##  [9] MatrixGenerics_1.8.0        matrixStats_0.62.0         
## [11] BiocStyle_2.24.0           
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_1.0.8.3           mvtnorm_1.1-3          lattice_0.20-45       
##  [4] zoo_1.8-10             assertthat_0.2.1       digest_0.6.29         
##  [7] utf8_1.2.2             R6_2.5.1               evaluate_0.15         
## [10] highr_0.9              ggplot2_3.3.5          pillar_1.7.0          
## [13] zlibbioc_1.42.0        rlang_1.0.2            multcomp_1.4-19       
## [16] jquerylib_0.1.4        magick_2.7.3           Matrix_1.4-1          
## [19] rmarkdown_2.14         labeling_0.4.2         splines_4.2.0         
## [22] stringr_1.4.0          RCurl_1.98-1.6         munsell_0.5.0         
## [25] DelayedArray_0.22.0    compiler_4.2.0         xfun_0.30             
## [28] pkgconfig_2.0.3        libcoin_1.0-9          htmltools_0.5.2       
## [31] tidyselect_1.1.2       tibble_3.1.6           GenomeInfoDbData_1.2.8
## [34] bookdown_0.26          coin_1.4-2             codetools_0.2-18      
## [37] fansi_1.0.3            crayon_1.5.1           dplyr_1.0.8           
## [40] MASS_7.3-57            bitops_1.0-7           grid_4.2.0            
## [43] DBI_1.1.2              jsonlite_1.8.0         gtable_0.3.0          
## [46] lifecycle_1.0.1        magrittr_2.0.3         scales_1.2.0          
## [49] cli_3.3.0              stringi_1.7.6          farver_2.1.0          
## [52] XVector_0.36.0         bslib_0.3.1            ellipsis_0.3.2        
## [55] vctrs_0.4.1            generics_0.1.2         sandwich_3.0-1        
## [58] TH.data_1.1-1          tools_4.2.0            glue_1.6.2            
## [61] purrr_0.3.4            parallel_4.2.0         fastmap_1.1.0         
## [64] survival_3.3-1         yaml_2.3.5             colorspace_2.0-3      
## [67] BiocManager_1.30.17    knitr_1.38             sass_0.4.1            
## [70] modeltools_0.2-23