← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-data-visualization-oncoprint-mutation-matrices / references / usage-guide.md

OncoPrint and Mutation Matrix Plots - Usage Guide

Overview

OncoPrint is the canonical cancer-cohort mutation visualization (Cerami 2012; cBioPortal). Each cell in a gene-by-sample grid stacks colored rectangles per alteration class (missense, truncating, splice, copy-gain, copy-loss, fusion), preserving multi-modal alteration patterns that a flat heatmap would lose. ComplexHeatmap::oncoPrint is the most customizable R implementation; maftools::oncoplot is faster to onboard; comut.py covers Python.

Prerequisites

install.packages(c('circlize'))
BiocManager::install(c('ComplexHeatmap', 'maftools'))
pip install comut pandas matplotlib

Quick Start

Tell your AI agent what you want to do: - "Build an OncoPrint of top 20 recurrently mutated genes across the cohort" - "Add clinical annotation tracks for subtype and stage" - "Show co-occurrence and mutual exclusivity between top driver genes" - "Split samples by molecular subtype" - "Log-transform the TMB bar so hypermutators don't dominate"

Example Prompts

TCGA-style cohort

"OncoPrint from a TCGA MAF: top 20 recurrently mutated genes, stacked by alteration class (missense, truncating, splice, amp, homdel, fusion). Add subtype and stage clinical annotations. Default memoSort for samples."

Subtype split

"OncoPrint split into 3 column panels by molecular subtype. Per-panel gene frequency right bar."

Mutex / co-occurrence

"Run somaticInteractions (maftools) to identify mutually exclusive and co-occurring driver pairs among the top 20 genes."

Custom alter_fun

"Build the cells as ;-separated alteration strings; render Amp as full red rectangle, HomDel as full blue, Missense as green half-height, Truncating as black quarter-height, Fusion as triangle marker."

Hypermutator-aware TMB

"Add a TMB bar on top of the OncoPrint; log10-transform so 1-2 POLE-mutant samples don't saturate."

What the Agent Will Do

  1. Load MAF / variant table; map per-row Variant_Classification to alteration class.
  2. Optionally integrate CNV calls (GISTIC2 or per-gene Amp/HomDel calls).
  3. Pivot to gene-by-sample matrix with ;-separated alteration strings.
  4. Compute top N most-frequently-altered genes.
  5. Define alter_fun list (one render function per alteration class).
  6. Build HeatmapAnnotation for clinical metadata with CVD-safe palette.
  7. Render with oncoPrint(mat, alter_fun, col, top_annotation = ha); use default memoSort.
  8. Optionally compute somaticInteractions for mutex/co-occurrence and add as side annotation.
  9. Export PDF at 300 DPI; rasterize the cell layer for cohorts >500 samples.

Tips