tmodUtest: Perform a statistical test of module expression

Description Usage Arguments Details Value Custom module definitions See Also Examples

View source: R/statisticaltests.R


Perform a statistical test of module expression


tmodUtest(l, modules = NULL, qval = 0.05, = "pval",
  filter = FALSE, mset = "LI", cols = "Title", useR = FALSE)

tmodCERNOtest(l, modules = NULL, qval = 0.05, = "pval",
  filter = FALSE, mset = "LI", cols = "Title")

tmodZtest(l, modules = NULL, qval = 0.05, = "pval",
  filter = FALSE, mset = "LI", cols = "Title")

tmodWZtest(l, modules = NULL, weights = NULL, qval = 0.05, = "pval", filter = FALSE, mset = "LI", cols = "Title")

tmodHGtest(fg, bg, modules = NULL, qval = 0.05, = "pval",
  filter = FALSE, mset = "LI", cols = "Title")



sorted list of HGNC gene identifiers


optional list of modules for which to make the test


Threshold FDR value to report

Order by P value ("pval") or none ("none")


Remove gene names which have no module assignments


Which module set to use. Either a character vector ("LI", "DC" or "all", default: LI) or a list (see "Custom module definitions" below)


Which columns from the MODULES data frame should be included in resulsts


use the R wilcox.test function; slow, but with exact p-values for small samples


for tmodWZtest


foreground gene set for the HG test


background gene set for the HG test


Performs a test on either on an ordered list of genes (tmodUtest, tmodCERNOtest, tmodZtest) or on two groups of genes (tmodHGtest). tmodUtest is a U test on ranks of genes that are contained in a module.

tmodCERNOtest is also a nonparametric test working on gene ranks, but it originates from Fisher's combined probability test. This test weights genes with lower ranks more, the resulting p-values better correspond to the observed effect size. In effect, modules with small effect but many genes get higher p-values than in case of the U-test.

tmodZtest works very much like tmodCERNOtest, but instead of combining the rank-derived p-values using Fisher's method, it uses the Stouffer method (known also as the Z-transform test).

tmodWZtest is the weighted version of the tmodZtest. The weights can be provided as a named numeric vector (the "weights" parameter). In this case, the weights of any genes in the parameter l which are not in the names of "weights" are set to 0. These weights will be constant for a given gene in all modules. Alternatively, weights associated with the "mset" parameter (an object of class tmod) in the "WEIGHTS" member of the object (if present).

For a discussion of the above three methods, read M. C. Whitlock, "Combining probability from independent tests: the weighted Z-method is superior to Fisher's approach", J. Evol. Biol. 2005 (doi: 10.1111/j.1420-9101.2005.00917.x) for further details.

tmodHGtest is simply a hypergeometric test.

In tmod, two module sets can be used, "LI" (from Li et al. 2013), or "DC" (from Chaussabel et al. 2008). Using the parameter "mset", the module set can be selected, or, if mset is "all", both of sets are used.


A data frame with module names, additional statistic (e.g. enrichment or AUC, depending on the test), P value and FDR q-value (P value corrected for multiple testing using the p.adjust function and Benjamini-Hochberg correction.

Custom module definitions

Custom and arbitrary module, gene set or pathway definitions can be also provided through the mset option, if the parameter is a list rather than a character vector. The list parameter to mset must contain the following members: "MODULES", "MODULES2GENES" and "GENES".

"MODULES" and "GENES" are data frames. It is required that MODULES contains the following columns: "ID", specifying a unique identifier of a module, and "Title", containing the description of the module. The data frame "GENES" must contain the column "ID".

The list MODULES2GENES is a mapping between modules and genes. The names of the list must correspond to the ID column of the MODULES data frame. The members of the list are character vectors, and the values of these vectors must correspond to the ID column of the GENES data frame.

See Also



fg <- tmod$MODULES2GENES[["LI.M127"]]
bg <- tmod$GENES$ID
result <- tmodHGtest( fg, bg )

## A more sophisticated example
## Gene set enrichment in TB patients compared to 
## healthy controls (Egambia data set)

  design <- cbind(Intercept=rep(1, 30), TB=rep(c(0,1), each= 15))
  if(require(limma)) {
  fit <- eBayes( lmFit(Egambia[,-c(1:3)], design))
  tt <- topTable(fit, coef=2, number=Inf, genelist=Egambia[,1:3] )

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
Loading required package: limma
                 ID                                            Title      U  N1
LI.M37.0   LI.M37.0              immune activation - generic cluster 352659 100
LI.M37.1   LI.M37.1                      enriched in neutrophils (I)  50280  12
LI.S4         LI.S4                       Monocyte surface signature  43220  10
LI.M75       LI.M75                          antiviral IFN signature  42996  10
LI.M11.0   LI.M11.0                       enriched in monocytes (II)  74652  20
LI.M67       LI.M67                        activated dendritic cells  28095   6
LI.M112.0 LI.M112.0                        complement activation (I)  44786  11
LI.M118.0 LI.M118.0                       enriched in monocytes (IV)  38041   9
LI.M105     LI.M105                                              TBA  34495   8
LI.M16       LI.M16                   TLR and inflammatory signaling  23600   5
LI.S5         LI.S5                             DC surface signature 111335  34
LI.M150     LI.M150                        innate antiviral response  22897   5
LI.M127     LI.M127                       type I interferon response  22793   5
LI.M165     LI.M165       enriched in activated dendritic cells (II)  65734  19
LI.M81       LI.M81          enriched in myeloid cells and monocytes  47320  13
LI.M3         LI.M3                regulation of signal transduction  41122  11
LI.M188     LI.M188                                              TBA  25116   6
LI.M240     LI.M240                              chromosome Y linked  31441   8
LI.M196     LI.M196              platelet activation - actin binding  40391  11
LI.M4.3     LI.M4.3 myeloid cell enriched receptors and transporters  21356   5
LI.M47.0   LI.M47.0                          enriched in B cells (I)  33884   9
LI.M20       LI.M20                AP-1 transcription factor network  21124   5
LI.M162.0 LI.M162.0                   plasma membrane, cell junction   4525   6
LI.M168     LI.M168                      enriched in dendritic cells  24264   6
LI.S10       LI.S10         Resting dendritic cell surface signature  82183  26
                AUC      P.Value    adj.P.Val
LI.M37.0  0.7462103 1.597067e-17 5.525852e-15
LI.M37.1  0.8703781 4.530577e-06 6.569127e-04
LI.S4     0.8974252 6.853638e-06 6.569127e-04
LI.M75    0.8927741 8.632649e-06 6.569127e-04
LI.M11.0  0.7766542 9.492958e-06 6.569127e-04
LI.M67    0.9714730 3.200305e-05 1.811391e-03
LI.M112.0 0.8455773 3.664663e-05 1.811391e-03
LI.M118.0 0.8774710 4.453083e-05 1.925959e-03
LI.M105   0.8949512 5.532208e-05 2.126827e-03
LI.M16    0.9790500 1.043533e-04 3.530412e-03
LI.S5     0.6833387 1.122385e-04 3.530412e-03
LI.M150   0.9498859 2.484015e-04 7.162243e-03
LI.M127   0.9455715 2.812548e-04 7.485705e-03
LI.M165   0.7197180 4.653053e-04 1.149969e-02
LI.M81    0.7562851 6.961216e-04 1.605721e-02
LI.M3     0.7763995 7.581896e-04 1.639585e-02
LI.M188   0.8684647 8.917113e-04 1.814895e-02
LI.M240   0.8157171 9.995329e-04 1.921324e-02
LI.M196   0.7625979 1.292714e-03 2.354100e-02
LI.M4.3   0.8859573 1.405919e-03 2.432240e-02
LI.M47.0  0.7815837 1.732539e-03 2.695001e-02
LI.M20    0.8763327 1.789370e-03 2.695001e-02
LI.M162.0 0.1564661 1.791475e-03 2.695001e-02
LI.M168   0.8390041 2.024541e-03 2.918713e-02
LI.S10    0.6585176 2.618625e-03 3.624176e-02

tmod documentation built on March 18, 2018, 1:59 p.m.