Skip to contents

This function computes the significance of enriched (over or underrepresented) Phylostrata or Divergence Strata within an input test.set based on the fisher.test. Please concult PlotEnrichment for details.

Usage

EnrichmentTest(
  ExpressionSet,
  test.set,
  use.only.map = FALSE,
  measure = "log-foldchange",
  complete.bg = TRUE,
  epsilon = 1e-05
)

Arguments

ExpressionSet

a standard PhyloExpressionSet or DivergenceExpressionSet object.

test.set

a character vector storing the gene ids for which PS/DS enrichment analyses should be performed.

use.only.map

a logical value indicating whether instead of a standard ExpressionSet only a Phylostratigraphic Map or Divergene Map is passed to this function.

measure

a character string specifying the measure that should be used to quantify over and under representation of PS/DS. Measures can either be measure = "foldchange" (odds) or measure = "log-foldchange" (log-odds).

complete.bg

a logical value indicating whether the entire background set of the input ExpressionSet should be considered when performing Fisher's exact test (complete.bg = TRUE) or whether genes that are stored in test.set should be excluded from the background set before performing Fisher's exact test (complete.bg = FALSE).

epsilon

a small value to shift values by epsilon to avoid log(0) computations.

Author

Hajk-Georg Drost

Examples


data(PhyloExpressionSetExample)

set.seed(123)
test_set <- sample(PhyloExpressionSetExample[ , 2],1000)

E.Result <- EnrichmentTest(ExpressionSet = PhyloExpressionSetExample,
                           test.set      = test_set ,
                           measure       = "log-foldchange")
                           
# get the log-fold change table
E.Result$enrichment.matrix
#>           BG_Set     Test_Set
#> 1  -0.0004337003  0.010481817
#> 2   0.0017181154 -0.042321022
#> 3   0.0056691770 -0.144837926
#> 4  -0.0021020073  0.050078271
#> 5   0.0044161681 -0.111500196
#> 6  -0.0113320413  0.250731629
#> 7   0.0167409104 -0.480258084
#> 8  -0.0004004521  0.009681065
#> 9   0.0166840812 -0.478313742
#> 10  0.0021668586 -0.053590619
#> 11  0.0114655330 -0.310378255
#> 12 -0.0039843952  0.093435996

# get P-values for the enrichment significance for each Phylostratum
E.Result$p.values
#>         1         2         3         4         5         6         7         8 
#> 0.8665888 0.6054816 0.6418368 0.6730864 0.7200825 0.1238752 0.4403599 0.8772462 
#>         9        10        11        12 
#> 0.3351155 0.9329851 0.7095475 0.5673222