lefser: R implementation of the LEfSe method

Description Usage Arguments Value Examples

View source: R/lefser.R

Description

Perform a LEfSe analysis: the function carries out differential analysis between two sample groups for multiple microorganisms and uses linear discirminant analysis to establish their effect sizes. Subclass information for each class can be incorporated into the analysis (see examples). Microorganisms with large differences between two sample groups are identified as biomarkers.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
lefser(
  expr,
  kruskal.threshold = 0.05,
  wilcox.threshold = 0.05,
  lda.threshold = 2,
  groupCol = "GROUP",
  blockCol = NULL,
  assay = 1L,
  trim.names = FALSE
)

Arguments

expr

A SummarizedExperiment with expression data.

kruskal.threshold

numeric(1) The p-value for the Kruskal-Wallis Rank Sum Test (default 0.05).

wilcox.threshold

numeric(1) The p-value for the Wilcoxon Rank-Sum Test when 'blockCol' is present (default 0.05).

lda.threshold

numeric(1) The effect size threshold (default 2.0).

groupCol

character(1) Column name in 'colData(expr)' indicating groups, usually a factor with two levels (e.g., 'c("cases", "controls")'; default "GROUP").

blockCol

character(1) Optional column name in 'colData(expr)' indicating the blocks, usually a factor with two levels (e.g., 'c("adult", "senior")'; default NULL).

assay

The i-th assay matrix in the ‘SummarizedExperiment' (’expr'; default 1).

trim.names

If 'TRUE' extracts the most specific taxonomic rank of organism.

Value

The function returns a dataframe with two columns, which are names of microorganisms and their LDA scores.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
    # (1) Using classes only
    data(zeller14)
    # exclude 'adenoma'
    zeller14 <- zeller14[, zeller14$study_condition != "adenoma"]
    res_group <- lefser(zeller14, groupCol = "study_condition")
    head(res_group)

    # (2) Using classes and sublasses
    data(zeller14)
    # exclude 'adenoma'
    zeller14 <- zeller14[, zeller14$study_condition != "adenoma"]
    res_block <- lefser(
         zeller14, groupCol = "study_condition", blockCol = "age_category"
    )
    head(res_block)

lefser documentation built on Nov. 8, 2020, 8:01 p.m.