grin.oncoprint.mtx: GRIN OncoPrint-Compatible Lesion Matrix

View source: R/grin.oncoprint.mtx.R

grin.oncoprint.mtxR Documentation

GRIN OncoPrint-Compatible Lesion Matrix

Description

Creates a gene-by-subject lesion matrix from GRIN analysis results for use with the oncoPrint() function from the ComplexHeatmap package. Each matrix cell contains the lesion type or lesion types affecting a selected gene in a given subject.

Usage

grin.oncoprint.mtx(grin.res, oncoprint.genes)

Arguments

grin.res

A GRIN results object, typically generated by grin.stats. The object must contain gene.lsn.data with the columns gene, ID, and lsn.type, and gene.data with the columns gene and gene.name.

oncoprint.genes

A character vector of Ensembl gene IDs specifying the genes to include in the OncoPrint. Genes are retained in the order supplied by the user when lesion records are available.

Details

The function filters grin.res$gene.lsn.data to the requested genes and constructs a gene-by-subject character matrix. Rows represent genes, columns represent subjects, and each matrix cell contains the lesion type or lesion types observed for that gene-subject combination. Multiple lesion types are separated by semicolons.

Gene symbols from grin.res$gene.data are used as row labels when available. If a gene symbol is missing or empty, the corresponding Ensembl gene ID is used instead. If multiple Ensembl gene IDs share the same gene symbol, row labels are made unique automatically.

Genes without lesion records in grin.res$gene.lsn.data are not included in the returned matrix.

The resulting matrix can be supplied directly to oncoPrint.

Value

A character matrix with genes as rows and subjects as columns. Matrix entries contain semicolon-separated lesion types for affected gene-subject combinations and empty strings for unaffected combinations. Row names contain gene symbols when available and otherwise Ensembl gene IDs.

Author(s)

Abdelrahman Elsayed abdelrahman.elsayed@stjude.org and Stanley Pounds stanley.pounds@stjude.org

References

Cao, X., Elsayed, A. H., & Pounds, S. B. (2023). Statistical Methods Inspired by Challenges in Pediatric Cancer Multi-omics.

See Also

grin.stats, oncoPrint

Examples

data(lesion_data)
data(hg38_gene_annotation)
data(hg38_chrom_size)

# Run GRIN analysis
grin.results <- grin.stats(
  lesion_data,
  hg38_gene_annotation,
  hg38_chrom_size
)

# Define genes to include in the OncoPrint
oncoprint.genes <- c(
  "ENSG00000148400",
  "ENSG00000171862",
  "ENSG00000171843",
  "ENSG00000156531"
)

# Generate an OncoPrint-compatible lesion matrix
oncoprint.mtx <- grin.oncoprint.mtx(
  grin.results,
  oncoprint.genes
)

# Genes can also be selected directly from GRIN results
genes.const <- grin.results$gene.hits[
  grin.results$gene.hits$q2.nsubj < 0.01,
]

selected.genes <- genes.const$gene

oncoprint.mtx <- grin.oncoprint.mtx(
  grin.results,
  selected.genes
)

GRIN2 documentation built on Aug. 22, 2026, 5:09 p.m.