Skip to contents

Genes are ranked by decreasing correlation with the phenotype. Walking down the ranked list, a running sum increases by \(|r_j|^p / N_R\) (with \(N_R = \sum_{g_j \in S} |r_j|^p\)) when gene j belongs to the set S and decreases by \(1/(N - N_H)\) otherwise. The enrichment score ES is the maximum deviation from zero of the running sum, a weighted Kolmogorov-Smirnov-like statistic; p = 0 reduces to the standard Kolmogorov-Smirnov statistic and p = 1 is the paper default. With nperm > 0 a nominal p-value is estimated by permuting the gene labels of the set (pre-ranked variant), assessing positive and negative scores separately against the same-sign side of the permutation null as prescribed in the paper.

Usage

Gnsetenr(correlations, in_set, p = 1, nperm = 0L, seed = NULL)

Arguments

correlations

Correlation of each gene with the phenotype.

in_set

Logical/0-1 membership of each gene in the set.

p

Weighting exponent (default 1).

nperm

Number of gene-label permutations (0 = none).

seed

Seed for the permutation stream.

Value

List with es, arg_es (0-based rank of the extreme deviation), running, n, n_hits, nperm, pvalue (when nperm > 0), method.

References

Subramanian, A., Tamayo, P., Mootha, V. K., Mukherjee, S., Ebert, B. L., Gillette, M. A., Paulovich, A., Pomeroy, S. L., Golub, T. R., Lander, E. S. and Mesirov, J. P. (2005), Gene set enrichment analysis: A knowledge-based approach for interpreting genome-wide expression profiles, PNAS 102(43), 15545-15550. Appendix, Enrichment Score ES(S), p. 15550; sign-separated significance, p. 15546.

Examples

set.seed(1)
Gnsetenr(correlations = rnorm(20), in_set = c(rep(TRUE, 5), rep(FALSE, 15)))
#> $es
#> [1] 0.446793
#> 
#> $arg_es
#> [1] 0
#> 
#> $running
#>  [1]  4.467930e-01  3.801263e-01  3.134597e-01  2.467930e-01  1.801263e-01
#>  [6]  1.134597e-01  4.679300e-02 -1.987367e-02 -8.654033e-02 -1.532070e-01
#> [11] -6.092120e-02 -9.487903e-03 -7.615457e-02 -1.428212e-01 -2.094879e-01
#> [16] -2.761546e-01 -1.007026e-01 -1.673693e-01  6.666667e-02  6.938894e-17
#> 
#> $n
#> [1] 20
#> 
#> $n_hits
#> [1] 5
#> 
#> $nperm
#> [1] 0
#> 
#> $method
#> [1] "GSEA enrichment score (Subramanian et al. 2005)"
#>