allDA: Run many differential abundance/expression methods

View source: R/allDA.R

allDAR Documentation

Run many differential abundance/expression methods

Description

Run many differential abundance and expression tests at a time, to easily compare their results

Usage

allDA(
  data,
  predictor,
  paired = NULL,
  covars = NULL,
  tests = c("bay", "ds2", "ds2x", "per", "adx", "znb", "zpo", "msf", "zig", "erq",
    "erq2", "neb", "qpo", "poi", "sam", "lrm", "llm", "llm2", "lma", "lmc", "ere",
    "ere2", "pea", "spe", "wil", "kru", "qua", "fri", "abc", "ttt", "ltt", "ltt2", "tta",
    "ttc", "ttr", "aov", "lao", "lao2", "aoa", "aoc", "vli", "lim", "lli", "lli2", "lia",
    "lic"),
  relative = TRUE,
  cores = (detectCores() - 1),
  p.adj = "fdr",
  args = list(),
  out.all = NULL,
  alpha = 0.1,
  core.check = TRUE,
  verbose = TRUE
)

Arguments

data

Either a data.frame with counts/abundances, OR a phyloseq object. If a data.frame is provided rows should be taxa/genes/proteins and columns samples, and there should be rownames

predictor

The predictor of interest. Either a Factor or Numeric, OR if data is a phyloseq object the name of the variable in sample_data(data) in quotation. If the predictor is numeric it will be treated as such in the analyses

paired

For paired/blocked experimental designs. Either a Factor with Subject/Block ID for running paired/blocked analysis, OR if data is a phyloseq object the name of the variable in sample_data(data) in quotation.

covars

Either a named list with covariates, OR if data is a phyloseq object a character vector with names of the variables in sample_data(data)

tests

Character. Which tests to include. Default all

relative

Logical. TRUE (default) for compositional data. FALSE for absoloute abundances or pre-normalized data.

cores

Integer. Number of cores to use for parallel computing. Default one less than available

p.adj

Character. Method for p-value adjustment. See p.adjust for details. Default "fdr"

args

List. A list with lists of arguments passed to the different methods. See details for more.

out.all

If TRUE models will output results and p-values from anova/drop1. If FALSE will output results for 2. level of the predictor. If NULL (default) set as TRUE for multi-class predictor and FALSE otherwise

alpha

q-value threshold for calling significance. Default 0.1

core.check

If TRUE (default) will make an interactive check that the amount of cores specified are desired. Only if cores>20. This is to ensure that the function doesn't automatically overloads a server with workers.

verbose

If TRUE will print informative messages

Details

mva is excluded by default, as it is slow.

Value

A list of results:

  • raw - A data.frame with raw p-values from all methods

  • adj - A data.frame with adjusted p-values from all methods (detection/no-detection from sam)

  • est - A data.frame with estimates/fold.changes from all relevant methods

  • details - A dataframe with details from the run

  • results - A complete list of output from all the methods. Example: Get wilcoxon results from 2. run as such: $results[[2]]["wil"]

Examples

# Creating random count_table and predictor
set.seed(5)
mat <- matrix(rnbinom(500, size = 0.1, mu = 500), nrow = 50, ncol = 10)
pred <- c(rep("Control", 5), rep("Treatment", 5))

# Running allDA to compare methods
# This example uses 1 core (cores = 1). 
# Remove the cores argument to get it as high (and thereby fast) as possible.
res <- allDA(data = mat, predictor = pred, cores = 1)

# View adjusted p-values from all methods
print(res$adj)

# View estimates from all methods
print(res$est)


# Include a paired variable for dependent/blocked samples
subject <- rep(1:5, 2)
res <- allDA(data = mat, predictor = pred, paired = subject, cores = 1)

# Include covariates
covar1 <- rnorm(10)
covar2 <- rep(c("A","B"), 5)
res <- allDA(data = mat, predictor = pred, 
             covars = list(FirstCovar = covar1, CallItWhatYouWant = covar2), cores = 1)

# Data is absolute abundance
res <- allDA(data = mat, predictor = pred, relative = FALSE, cores = 1)


Russel88/DAtest documentation built on March 24, 2022, 3:50 p.m.