prep.binary.lsn.mtx: Prepare Binary Lesion Matrix

View source: R/prep.binary.lsn.mtx.R

prep.binary.lsn.mtxR Documentation

Prepare Binary Lesion Matrix

Description

Constructs a binary lesion matrix representing the presence or absence of specific lesion types affecting individual genes across patients. Each row represents a gene-lesion type combination, and each column represents a patient.

Usage

prep.binary.lsn.mtx(ov.data,
                   min.ngrp = 0)

Arguments

ov.data

GRIN gene-lesion overlap results, typically the output from the find.gene.lsn.overlaps function.

min.ngrp

Optional integer specifying the minimum number of patients required in both the affected and unaffected groups for a gene-lesion type combination to be retained. The default is 0, which retains all observed gene-lesion type combinations.

Details

The function uses the gene-lesion overlaps in ov.data$gene.lsn.hits to construct a binary matrix with gene-lesion type combinations as rows and patients as columns.

Each row is labeled using the format gene_lesion.type (for example, ENSG00000118513_gain). For each gene-lesion type combination, a patient receives a value of 1 if affected by that lesion type in the corresponding gene and 0 otherwise.

When min.ngrp > 0, a row is retained only when both the affected group (1) and unaffected group (0) contain at least min.ngrp patients. This can be useful when the resulting binary matrix is used for downstream analyses that require a minimum number of patients in each comparison group.

Value

A numeric binary matrix in which:

  • Rows represent gene-lesion type combinations (gene_lesion.type).

  • Columns represent patient IDs.

  • Entries are 1 when the patient is affected by the specified lesion type in that gene and 0 otherwise.

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

prep.gene.lsn.data, find.gene.lsn.overlaps

Examples

data(lesion_data)
data(hg38_gene_annotation)

# 1) Prepare gene-lesion input data
prep.gene.lsn <- prep.gene.lsn.data(lesion_data,
                                    hg38_gene_annotation)

# 2) Identify gene-lesion overlaps
gene.lsn.overlap <- find.gene.lsn.overlaps(prep.gene.lsn)

# 3) Create a binary lesion matrix requiring at least 5 patients
# in both the affected and unaffected groups
lsn.binary.mtx <- prep.binary.lsn.mtx(gene.lsn.overlap,
                                      min.ngrp = 5)


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