---
title: Patient Stratification
slug: patient-stratification
createdAt: 2026-04-27T07:49:30.423Z
---

The Patient Stratification Heatmap shows the gene expression pattern of the graph genes across the samples contributing to the graph construction. It helps you quickly see which genes are high or low in expression, and how variable patient cohorts or genes relate to each other. The Patient Stratification card contains further details and inclusion options on the datasets contributing to the heatmap. Note that in some networks, sample selection is required to ensure that no more than 1,500 samples are included in the heatmap, in order to reduce computational time and maintain a clear visualization.&#x20;

The heatmap intensity goes from blue (low expression levels) to red (high expression levels). The genes are shown over the rows with row labels showing the gene details, and the samples are shown over columns with column labels showing the annotated sample details. The heatmap can thus be used to detect gene profiles and potential biomarkers for all variable patient cohorts with curated metadata details.&#x20;

When a second network is added to the graph creation, as described under [Two Networks Comparison](docId\:tKQKi5G_OPbWEJgrIvtj3), first select the nework based on which data you want the heatmap to be generated from, before clicking the "Generate heatmap"-button. Note that the genes within the heatmap will include all genes within the graph.&#x20;

:::hint{type="info"}
If you get this note: "N genes from the graph are not included in the heatmap datasets.", it indicates the number of genes not identified in the data contributing to heatmap production.
:::

:::hint{type="warning"}
We are working on updating the heatmaps within Mavatar Discovery, with the intention to include more data and to have a higher-level metadata integration.&#x20;

The majority of heatmaps now are either based on one dataset representative of the tissue and disease, or a copy from the disease-specific networks respective tissue – General network. If your network of interest contains a heatmap based on only one dataset, or contains more diseases than your network of interest, be aware that an improved version is underway. &#x20;
:::

Read more about how the heatmaps are produced under [Expression Heatmap Construction](docId\:kV178h6LLc16gG2xzFbgH).

# Heatmap Management and Functions

- Manage the heatmap by selecting which gene and sample details to show under Show/Hide tracks.
- Hover over the gene and sample labels to see the details.&#x20;
- Click on a gene to highlight in within the graph. This will also show it within the [Gene Information](docId\:XtQ51aIwkYZ4fK97aY_Eg), [Gene Expression](docId\:bo2L7QhKrocN1EZlqHaIv), and [Cell Type Explorer](docId\:XFU1ggaWGnttLn4ypFW0V) cards.
- [Right click on a gene](docId:2cxKfMzDutKKJQeIgyScd) for further actions.

# Sample Category Enrichment Analysis

The Statistical Analysis can be used to test whether any of the sample categories are significantly enriched or depleted within any of the hierarchical clusters in the heatmap. To run it, define the number of clusters (any value between two and 50) and select the metadata set to perform the statistics on. A global test is first performed to evaluate whether any of the categories show variable expression across any of the clusters. A pairwise comparison is then performed to check, for each category and cluster, whether the genes are enriched or depleted.

The global test used depends on the smallest sample size involved, as well as the number of clusters and categories being compared. The standard procedure is the Chi-squared test (χ²) applied to the full contingency table. However, if the sample size is smaller than five in any of the categories, a Fisher's Exact test is used instead for 2×2 tables, or a Monte Carlo simulation of the χ² statistic when there are more categories to compare. The output includes information on which statistical test was used in each case.

For each category within each cluster, a pairwise comparison is then performed by computing the Odds Ratio (OR) to quantify the association between that category and the cluster, relative to all other categories and clusters combined. If any of the groups contain zero counts, a Haldane-Anscombe correction is applied before the OR is calculated. The category is defined as enriched or depleted within the cluster based on whether the OR is greater than or less than 1, respectively. A Fisher's Exact test is then performed to evaluate whether this enrichment or depletion is statistically significant, with p-values adjusted for multiple comparisons using the Benjamini-Hochberg (FDR) correction. The results are presented in a downloadable table.
