enrichment_test: Enrichment test

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

View source: R/enrichment.R

Description

Perform enrichment test of genes/features in categories with Fisher's exact test or Kolmogorov-Smirnov Tests.

Usage

1
2
3
4
5
6
7
8
enrichment_test(
  object,
  fit,
  group,
  test = c("fet", "kst"),
  alternative = c("both", "greater", "less", "two.sided"),
  p.cutoff
)

Arguments

object

HTSet-class

fit

ModelFit. The result of model_fit

group

character. The fdata column of object that will be used as the categories to perform enrichment analysis.

test

character. Must be "fet" for Fisher's exact test or "kst" for Kolmogorov-Smirnov test.

alternative

character. One of both, greater, less, or two.sided. Default is both, that both greater and less were calculated and returned.

p.cutoff

numeric. The p-value cutoff to define increase or decreasing. Only useful with fet. The default value of this argument is 0.05 when alternative equals to two.sided, and is 1 otherwise.

Details

For Fisher's exact test, the question being answered is, whether the number of genes/features in category A that are increased (or decreased) in treatment different from the background. In other words, the Fisher's exact test is used to test the independency of gene/feature category A and whether genes/features are increased (or decreased).

For Kilmogorov-Smirnov test, a similar hypothesis is tested. The p-values are first tranformed into one-tail. The transformation is done using the statistic values returned by model_fit. The transformed p-values are then compared to an arithmetic sequence between 0 and 1 using ks.test.

Value

A list-like S3 object. pval is the pvalues for enrichment of each category. For fet, the odds.ratio has the odds ratio for each category, and the matrix has the N, m, n, k, and x values. For kst, adj.p.val has the transformed p-values under each of the alternative hypothesis of greater or less.

Author(s)

Chenghao Zhu

See Also

HTSet-class model_fit fisher.test phyper ks.test

Examples

1
2
3
4
5
design = model.matrix(~ Condition, data = exrna$pdata)
coef = "ConditionSystemic Lupus Erythematosus"
fit = model_fit(exrna, design, coef, engine = "limma", args = list(voom = TRUE))
en = enrichment_test(exrna, fit, "gene_type", "fet")
en = enrichment_test(exrna, fit, "gene_type", "kst")

zhuchcn/HTSet documentation built on April 10, 2020, 4:51 p.m.