> For the complete documentation index, see [llms.txt](https://docs.owkin.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.owkin.com/explore-and-analyse-data/data-analysis/genomic-alterations/oncoprint.md).

# Oncoprint

Visualize mutations and copy-number alterations across genes and samples in an oncoprint, revealing cohort-wide alteration patterns and co-occurrences.

Visualize mutations and copy-number alterations across genes and samples in an oncoprint, revealing cohort-wide alteration patterns and co-occurrences.

## Alteration matrix (oncoprint)

### Description

#### Analysis summary

A genes × samples heatmap displaying genomic alterations (mutations and copy-number changes) across a cohort, with genes ranked by alteration frequency and samples waterfall-sorted — those hit in the most-altered genes first — to highlight patterns of co-occurrence and mutual exclusivity.

#### Computation

Builds the ordered alteration matrix from a long table of alterations plus a sample spine, so unaltered samples stay in the cohort denominator. Genes are ordered by their number of altered samples, most-altered first, filtered by the recurrence floor and capped at the row limit. Samples are sorted in the classic oncoprint waterfall order: each alteration type is weighted by its cohort-wide frequency, and samples are ordered by their hits on the top gene, then the second, and so on — samples altered in the most-recurrent gene sit leftmost, unaltered spine samples trail last. When a sample-level subgroup column is present, the analysis computes the share of each subgroup's samples altered per gene and tests whether each gene's alteration rate differs across subgroups (Fisher's exact for two subgroups, chi-square for more, Benjamini-Hochberg-adjusted across genes; samples with no subgroup value go to 'Unknown', shown but excluded from the test), and the display splits into one column of cells per subgroup. The statistical tests always carry a pairwise mutual-exclusivity / co-occurrence table (cBioPortal-style): for every pair of displayed genes, a two-sided Fisher's exact test on the 2x2 alteration-overlap table with a log2 odds ratio, a Benjamini-Hochberg FDR q-value, and a tendency label (co-occurrence vs mutual exclusivity).

#### When to use

Use whenever the user asks for a cohort-level mutation/CNV landscape across a panel of genes, co-occurrence patterns of alterations, or a 'who's mutated where' summary across samples.

#### Caveats

The waterfall sort is a display construction: co-altered samples cluster because of the sort, not necessarily because of shared biology. Genes altered in a single sample add rows with little signal — raise the recurrence floor to focus on recurrent alterations. Alteration-overlap p-values are Benjamini-Hochberg-adjusted across the tested gene pairs only; no correction spans the two test families.

### Example questions

<details>

<summary><code>example questions</code></summary>

* Oncoprint of mutations and CNV across a driver gene panel
* Oncoprint of TP53, KRAS, EGFR, STK11, KEAP1 across the LUAD cohort
* Oncoprint of recurrent alterations only (genes altered in ≥3 samples)
* Mutations-only oncoprint (no CNV)
* Oncoprint tagging oncogenic driver mutations (Mosaic datasets)

</details>

### Input columns

<details>

<summary><code>input columns</code></summary>

| column            | type        | required | description                                                                                                                                                       |
| ----------------- | ----------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| patient\_id       | categorical | required | Patient identifier required for population summary plots.                                                                                                         |
| sample\_id        | categorical | required | Sample identifier — one grid column per sample. Include EVERY cohort sample (via a sample-spine LEFT JOIN), not only altered ones, so per-gene '% altered' uses…  |
| gene\_name        | categorical | required | Gene symbol — one grid row per gene. Null for spine rows of samples that carry no alteration in the queried gene panel (kept only to count the cohort size).      |
| alteration\_type  | categorical | required | Alteration label that colors the tile — pass the source column through unchanged. For mutations, alias `variant_classification` (MAF terms like Missense\_Mutati… |
| alteration\_class | categorical | optional | Optional layer tag: 'mutation' or 'cnv'. CNV tiles render as a full-cell block, mutations as a smaller block on top, so co-occurring hits both stay visible. Wh…  |
| subgroup          | categorical | optional | Optional sample-level grouping (e.g. immune hot/cold, tumor stage, treatment arm): one value per sample, repeated on all of that sample's rows. descriptive\_sta… |

</details>

### Visualizations

* `oncoprint` How to read: A grid of colored tiles: one column per sample (waterfall-sorted, so co-altered samples cluster and unaltered samples trail on the right), one row per gene (most-altered first). Each cell carries a CNV background block (e.g. Amplification, Deep Deletion) with the mutation type (e.g. Missense, Nonsense) layered as a narrower stripe on top — the cBioPortal convention. Alteration labels follow the MAF (TCGA) or Sequence-Ontology (Mosaic) vocabularies and are colored the same way; unknown terms fall back to the categorical palette (overridable via color\_map). With a subgroup column the grid splits into one column of cells per subgroup, sharing the gene rows. Per-gene '% altered' annotations sit on the y-axis, and summary bars on the top and right margins stack alterations per sample and per gene.

### Example analysis 1

#### Name — Oncoprint: mutations + CNV across top recurrently mutated genes (TCGA BRCA cohort)

#### Analysis parameters

<details>

<summary><code>analysis_name, analysis_params, viz_params</code></summary>

```json
{
  "analysis_name": "oncoprint_analysis",
  "analysis_params": {
    "max_genes": 40,
    "min_samples_altered": 1
  },
  "viz_params": {
    "plot_name": "oncoprint",
    "title": "Oncoprint: mutations + CNV across top recurrently mutated genes (TCGA BRCA cohort)"
  }
}
```

</details>

#### Visualization — `oncoprint`

![Oncoprint: mutations + CNV across top recurrently mutated genes (TCGA BRCA cohort)](https://1034377358-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTmCjUj6W0sltjW7q2vBp%2Fuploads%2Fgit-blob-113020ffc8b2d1586bb23005f0977c7894933d92%2Foncoprint_analysis__oncoprint__oncoprint.png?alt=media)

#### Output table

<details>

<summary><code>descriptive_stats</code> (first 10 of 33 rows)</summary>

| gene\_name | n\_altered | pct\_altered | n\_Missense\_Mutation | n\_Amplification | n\_Duplication | n\_Frame\_Shift\_Del | n\_Hetero Deletion | n\_Nonsense\_Mutation | n\_Frame\_Shift\_Ins | n\_Splice\_Site | n\_Full Deletion | n\_In\_Frame\_Del | n\_In\_Frame\_Ins | n\_Intron | n\_Translation\_Start\_Site |
| ---------- | ---------- | ------------ | --------------------- | ---------------- | -------------- | -------------------- | ------------------ | --------------------- | -------------------- | --------------- | ---------------- | ----------------- | ----------------- | --------- | --------------------------- |
| PIK3CA     | 378        | 31.1         | 338                   | 81               | 137            | 0                    | 4                  | 0                     | 0                    | 0               | 0                | 15                | 0                 | 1         | 0                           |
| TP53       | 350        | 28.8         | 214                   | 9                | 70             | 48                   | 87                 | 47                    | 14                   | 25              | 0                | 5                 | 0                 | 0         | 0                           |
| GATA3      | 168        | 13.8         | 13                    | 46               | 54             | 24                   | 1                  | 4                     | 65                   | 22              | 0                | 1                 | 0                 | 0         | 0                           |
| ERBB2      | 155        | 12.8         | 27                    | 133              | 10             | 2                    | 2                  | 0                     | 0                    | 0               | 0                | 1                 | 0                 | 0         | 0                           |
| CDH1       | 133        | 10.9         | 16                    | 3                | 5              | 35                   | 59                 | 31                    | 33                   | 13              | 0                | 4                 | 0                 | 0         | 0                           |
| KMT2C      | 108        | 8.9          | 37                    | 13               | 37             | 20                   | 4                  | 35                    | 10                   | 3               | 2                | 1                 | 0                 | 0         | 0                           |
| MAP3K1     | 94         | 7.7          | 26                    | 12               | 26             | 37                   | 3                  | 23                    | 28                   | 4               | 2                | 4                 | 0                 | 0         | 0                           |
| PTEN       | 87         | 7.2          | 21                    | 6                | 10             | 17                   | 14                 | 13                    | 6                    | 6               | 24               | 2                 | 0                 | 0         | 0                           |
| MAP2K4     | 63         | 5.2          | 15                    | 2                | 7              | 7                    | 17                 | 9                     | 4                    | 8               | 18               | 0                 | 0                 | 0         | 0                           |
| NF1        | 62         | 5.1          | 14                    | 23               | 3              | 5                    | 17                 | 11                    | 4                    | 7               | 1                | 0                 | 0                 | 0         | 0                           |

</details>

<details>

<summary><code>statistical_tests</code> (first 10 of 528 rows)</summary>

| Contrast         | Gene A | Gene B | Neither | A Not B | B Not A | Both | Log2 Odds Ratio | P-value   | Adjusted P-value | Tendency           |
| ---------------- | ------ | ------ | ------- | ------- | ------- | ---- | --------------- | --------- | ---------------- | ------------------ |
| TP53 vs CDH1     | TP53   | CDH1   | 743     | 339     | 122     | 11   | -2.282          | 1.764e-09 | 9.312e-07        | Mutual exclusivity |
| ERBB2 vs NF1     | ERBB2  | NF1    | 1021    | 132     | 39      | 23   | 2.197           | 4.278e-07 | 0.0001048        | Co-occurrence      |
| TP53 vs ERBB2    | TP53   | ERBB2  | 782     | 278     | 83      | 72   | 1.287           | 5.954e-07 | 0.0001048        | Co-occurrence      |
| PIK3CA vs MAP2K4 | PIK3CA | MAP2K4 | 811     | 341     | 26      | 37   | 1.75            | 4.112e-06 | 0.0005428        | Co-occurrence      |
| TP53 vs AKT2     | TP53   | AKT2   | 856     | 330     | 9       | 20   | 2.483           | 6.702e-06 | 0.0007078        | Co-occurrence      |
| TP53 vs MYB      | TP53   | MYB    | 850     | 326     | 15      | 24   | 2.042           | 1.681e-05 | 0.001479         | Co-occurrence      |
| AKT1 vs CTCF     | AKT1   | CTCF   | 1162    | 29      | 18      | 6    | 3.791           | 3.403e-05 | 0.002567         | Co-occurrence      |
| PIK3CA vs CDH1   | PIK3CA | CDH1   | 767     | 315     | 70      | 63   | 1.132           | 3.967e-05 | 0.002618         | Co-occurrence      |
| PIK3CA vs MAP3K1 | PIK3CA | MAP3K1 | 790     | 331     | 47      | 47   | 1.254           | 6.982e-05 | 0.003815         | Co-occurrence      |
| TP53 vs MAP3K1   | TP53   | MAP3K1 | 782     | 339     | 83      | 11   | -1.655          | 7.225e-05 | 0.003815         | Mutual exclusivity |

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.owkin.com/explore-and-analyse-data/data-analysis/genomic-alterations/oncoprint.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
