getStatistics: getStatistics

View source: R/utilities.R

getStatisticsR Documentation

getStatistics

Description

Extract the list of p-values or/and log fold changes from the output of a differential abundance detection method.

Usage

getStatistics(
  method,
  slot = "pValMat",
  colName = "rawP",
  type = "pvalue",
  direction = NULL,
  verbose = FALSE
)

Arguments

method

Output of a differential abundance detection method. pValMat, statInfo matrices, and method's name must be present (See vignette for detailed information).

slot

The slot name where to extract values (default slot = "pValMat").

colName

The column name of the slot where to extract values (default colName = "rawP").

type

The value type of the column selected where to extract values. Two values are possible: "pvalue" or "logfc" (default type = "pvalue").

direction

statInfo's column name containing information about the signs of differential abundance (usually log fold changes) (default direction = NULL).

verbose

Boolean to display the kind of extracted values (default verbose = FALSE).

Value

A vector or a data.frame. If direction = NULL, the colname column values, transformed according to type (not tranformed if type = "pvalue", -abs(value) if type = "logfc"), of the slot are reported, otherwise the direction column of the statInfo matrix is added to the output.

See Also

extractStatistics

Examples

data("ps_plaque_16S")
# Add scaling factors
ps_plaque_16S <- norm_edgeR(object = ps_plaque_16S, method = "TMM")
# DA analysis
da.limma <- DA_limma(
    object = ps_plaque_16S,
    design = ~ 1 + HMP_BODY_SUBSITE,
    coef = 2,
    norm = "TMM"
)
# get p-values
getStatistics(
    method = da.limma, slot = "pValMat", colName = "rawP",
    type = "pvalue", direction = NULL
)
# get negative abs(logFC) values
getStatistics(
    method = da.limma, slot = "statInfo", colName = "logFC",
    type = "logfc", direction = NULL
)
# get p-values and logFC
getStatistics(
    method = da.limma, slot = "pValMat", colName = "rawP",
    type = "pvalue", direction = "logFC"
)

mcalgaro93/benchdamic documentation built on Sept. 26, 2024, 6:34 p.m.