DA.tta: Welch t-test - Multiplicative zero-correction and additive...

View source: R/DA.tta.R

DA.ttaR Documentation

Welch t-test - Multiplicative zero-correction and additive log-ratio normalization.

Description

Apply welch t-test to multiple features with one predictor

Usage

DA.tta(
  data,
  predictor,
  paired = NULL,
  p.adj = "fdr",
  delta = 1,
  testStat = function(case, control) {     mean(case) - mean(control) },
  testStat.pair = function(case, control) {     mean(case - control) },
  allResults = FALSE,
  ...
)

Arguments

data

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

predictor

The predictor of interest. Factor, OR if data is a phyloseq object the name of the variable in sample_data(data) in quotation

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

p.adj

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

delta

Numeric. Pseudocount for zero-correction.

testStat

Function. Function for calculating fold change. Should take two vectors as arguments. Default is a simple difference: mean(case abundances)-mean(control abundances)

testStat.pair

Function. Function for calculating fold change. Should take two vectors as arguments. Default is a simple difference: mean(case abundances-control abundances)

allResults

If TRUE will return raw results from the t.test function

...

Additional arguments for the t.test function

Details

Note: Last feature in the data is used as reference for the log-ratio transformation.

Value

A data.frame with with results.

Examples

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

# Running t-test on each feature
res <- DA.tta(data = mat, predictor = pred)

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