Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Pathway scores per sample

The tests of Gene-set tests and Over-representation and GSEA ask one question of one contrast. A pathway score instead turns the expression of a set’s genes in each sample into one number, so that pathways can be compared across samples, drawn as a heatmap, correlated with other measurements and tested with any design Hänzelmann et al., 2013. By default gsva computes the scores by gene set variation analysis, and ssgsea, combined_z_scores and plage compute the other three methods of the GSVA package. Pathway and regulator activity scores published data with GSVA and tests the scores.

The values scored

Each method scores a samples x genes matrix of expression values, or a cell type of a cube. A cell type gives its samples with enough cells (min_cells, 10 by default, as for limma_voom; Samples with few cells or counts) and its genes that pass edgeR’s filter (Filtering by expression), as log-CPM values (log-CPM) or, with values="counts", as counts: the values that GSVA’s guide scores. NaN marks a missing value.

Sets with fewer than min_size or more than max_size genes among those scored are left out. The result, a PathwayScores, holds the scores of the samples by sets, with the table of the samples and the genes that each set used, and PathwayScores.table lists the scores one per row; plot_pathway_scores draws them as a heatmap, with the samples grouped by a variable.

GSVA

GSVA first puts each gene on a common scale. A kernel estimate of the gene’s distribution over the nn samples gives each value the probability that the gene’s value is no higher,

Fij=1n∑k=1nΦ ⁣(xij−xikhi)F_{ij} = \frac{1}{n} \sum_{k=1}^{n} \Phi\!\left(\frac{x_{ij} - x_{ik}}{h_i}\right)

for gene ii in sample jj, with a bandwidth hih_i of one quarter of gene ii’s standard deviation, for continuous values such as log-CPM. For counts the kernel is the Poisson probability P(Y≤xij)P(Y \le x_{ij}) with mean xik+1/2x_{ik} + 1/2, and without a kernel FijF_{ij} is the share of the samples whose value is at most xijx_{ij}. Each sample ranks its pp genes by FijF_{ij} and gives the gene of rank rijr_{ij} the weight ∣p/2−rij∣|p/2 - r_{ij}|, so that the genes at both ends of the ranking weigh most. A walk down the ranking rises at the genes of a set and falls at the others, as in gene set enrichment analysis, and the score is the walk’s largest deviation above zero minus its largest deviation below: high for a set whose genes are higher than usual in the sample, low for one whose genes are lower, and between -1 and 1.

ssGSEA

Single-sample GSEA ranks the genes of each sample by their values and sums the same walk over all genes rather than taking its extreme, with the genes of the set weighted by their ranks to the power α=1/4\alpha = 1/4 Barbie et al., 2009. By default the scores are then scaled by their range over every set and sample, as Barbie et al. (2009) scaled them, so that a score depends on the other sets and samples scored with it.

Combined z-scores

Each gene is standardized across the samples, and a set scores the sum of its kk genes’ z-scores over k\sqrt{k}: a standard normal score if its genes are independent and standard normal Lee et al., 2008.

PLAGE

PLAGE standardizes the genes of a set and scores the samples by the first right singular vector of their genes x samples matrix: the samples’ coordinates on the direction along which the set’s genes vary most together Tomfohr et al., 2005. Across the samples, a set’s scores have mean zero and length one. The vector could as well point the other way; CytePool points it where the scores rise with the set’s mean standardized expression.

How the scores differ

ssGSEA ranks the values themselves, so that a set of highly expressed genes scores high in every sample. GSVA first sets each gene against its own distribution across the samples, so that a set scores high where its genes are higher than usual, compared with the other genes of the sample. Combined z-scores and PLAGE also set each gene against itself across the samples, but do not compare it with other genes: combined z-scores add the genes of a set alike, and PLAGE follows the pattern along which they vary most together. GSVA and ssGSEA thus ask how a set ranks within a sample, and combined z-scores and PLAGE how a sample stands among the others.

Testing scores with a design

The scores of a set differ between conditions as the expression of a gene does, so they are tested as genes are, with limma’s linear models, contrasts, moderated t-tests and adjusted p-values, as GSVA’s guide does Hänzelmann et al., 2013Smyth, 2004. limma takes these steps in one call, with the Design built for the cube. It fits the samples that have scores, so a sample that the scores leave out, such as one with too few cells, is not fitted either, and a design that the remaining samples no longer determine is fitted as limma_voom fits a cell type (Designs that cannot answer the question). GSVA’s guide notes that the scores of larger sets vary less, and lets the prior variance of the moderation follow the set sizes: limma(scores, design, trend=scores.n_genes) does the same. The activities of the next chapter are tested alike.

Defaults and choices

Limits and differences

Checks and further reading

The four methods and their heatmap are compared with GSVA 2.0.0, run as a separate program on the same data: exact (1e-10), PLAGE up to sign (Validation). limma has no section of its own: tests/test_score_tests.py checks that its results are those of fit_linear_model, contrasts_fit and moderated_statistics, which are compared with limma 3.62.1 (Validation and Validation).

Further reading:

Activities from networks, the next chapter, scores regulators and pathways rather than gene sets.

References
  1. Hänzelmann, S., Castelo, R., & Guinney, J. (2013). GSVA: gene set variation analysis for microarray and RNA-Seq data. BMC Bioinformatics, 14(1), 7. 10.1186/1471-2105-14-7
  2. Barbie, D. A., Tamayo, P., Boehm, J. S., Kim, S. Y., Moody, S. E., Dunn, I. F., Schinzel, A. C., Sandy, P., Meylan, E., Scholl, C., Fröhling, S., Chan, E. M., Sos, M. L., Michel, K., Mermel, C., Silver, S. J., Weir, B. A., Reiling, J. H., Sheng, Q., … Hahn, W. C. (2009). Systematic RNA interference reveals that oncogenic KRAS-driven cancers require TBK1. Nature, 462(7269), 108–112. 10.1038/nature08460
  3. Lee, E., Chuang, H.-Y., Kim, J.-W., Ideker, T., & Lee, D. (2008). Inferring pathway activity toward precise disease classification. PLoS Computational Biology, 4(11), e1000217. 10.1371/journal.pcbi.1000217
  4. Tomfohr, J., Lu, J., & Kepler, T. B. (2005). Pathway level analysis of gene expression using singular value decomposition. BMC Bioinformatics, 6(1), 225. 10.1186/1471-2105-6-225
  5. Smyth, G. K. (2004). Linear models and empirical Bayes methods for assessing differential expression in microarray experiments. Statistical Applications in Genetics and Molecular Biology, 3(1), Article 3. 10.2202/1544-6115.1027