wilcoxTest: Single-Gene Mann Whitney Wilcoxon Test

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/GSALightning.r

Description

A two-sample single-gene differential expression analysis using the Mann Whitney Wilcoxon Test.

Usage

1
wilcoxTest(eset, fac, tests = c("unpaired", "paired"))

Arguments

eset

The expression matrix. Each row is a gene, and each column is a subject/sample. The gene names must be presented as the row names.

fac

Subject labels, for unpaired T-test, either a factor or something that can be coerced into a factor (e.g. 0 and 1, Experiment and Control). For paired T-test, fac must be an integer vector of 1,-1,2,-2,..., where each number represents a pair, and the sign represents the conditions.

tests

The tests to performed. Can be either the default "unpaired" for unpaired T-tests or "paired" for paired T-tests.

Details

This function performs Mann Whitney Wilcoxon test (a.k.a Mann Whitney U test and Wilcoxon Rank Sum test) for all genes in eset. This function is built on the wilcox.test() function in the "stats" package, but is structured to align with the usage of permTestLight. We included this function in case users may want to compare the permutation test results with the results of a standard, non-permutation-based nonparametric test.

Value

A data frame with the p-values, the q-values (via Benjamini-Hochberg FDR control method). The p-values and q-values for up-regulation and down-regulation are reported.

Author(s)

Billy Heung Wing Chang

See Also

permTestLight, wilcox.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# see the vignette for more examples
# this example is adapted from R GSA package (Efron 2007)

### NOT RUN ###
set.seed(100)
x <- matrix(rnorm(1000*20),ncol=20)
rownames(x) <- paste("g",1:1000,sep="")
dd <- sample(1:1000,size=100)

u <- matrix(2*rnorm(100),ncol=10,nrow=100)
x[dd,11:20] <- x[dd,11:20]+u
y <- factor(c(rep('Control',10),rep('Experiment',10)))

results <- wilcoxTest(x, y, tests = "unpaired")
head(results)

Example output

   p-value:up-regulated in Control p-value:up-regulated in Experiment
g1                    4.852562e-01                         0.51474377
g2                    9.737870e-01                         0.02621295
g3                    3.696822e-01                         0.63031782
g4                    8.600695e-01                         0.13993050
g5                    5.412544e-06                         0.99999459
g6                    6.020319e-01                         0.39796813
   q-value:up-regulated in Control q-value:up-regulated in Experiment
g1                     0.975724187                          0.9730506
g2                     1.000000000                          0.4945840
g3                     0.926521743                          0.9968102
g4                     1.000000000                          0.8637685
g5                     0.001353136                          0.9999946
g6                     0.975724187                          0.9478141

GSALightning documentation built on Nov. 8, 2020, 11 p.m.