alex.boxplots: Generate Box Plots of Gene Expression by Lesion Groups

View source: R/alex.boxplots.R

alex.boxplotsR Documentation

Generate Box Plots of Gene Expression by Lesion Groups

Description

Generates box plots of gene expression levels stratified by lesion groups for genes selected according to a user-specified q-value threshold from the Kruskal-Wallis lesion-expression association results.

Usage

alex.boxplots(
  out.dir,
  alex.data,
  alex.kw.results,
  q,
  gene.annotation
)

Arguments

out.dir

Path to an existing directory where the resulting PDF files containing the box plots will be saved. One PDF file is generated for each selected gene.

alex.data

Output from the alex.prep.lsn.expr function. A list containing "alex.expr" (expression data), "alex.lsn" (lesion-group data), and "alex.row.mtch" (matched Ensembl gene IDs). The expression and lesion data contain genes in rows and subjects in columns, with matching row and column order.

alex.kw.results

Kruskal-Wallis lesion-expression association results returned by KW.hit.express. The data frame must contain "gene" and "q.KW".

q

Numeric q-value threshold. Genes with q.KW < q are included in the output box plots.

gene.annotation

A gene annotation data frame containing at least "gene" (Ensembl gene ID) and "gene.name" (gene symbol). When a gene symbol is unavailable, the Ensembl gene ID is used to label the corresponding plot.

Details

For each gene with a Kruskal-Wallis q value below the specified threshold, expression values are grouped according to lesion status. Subjects are displayed as individual points together with a box plot showing the expression distribution within each lesion group.

Lesion groups are ordered according to their expression values using fct_reorder. One PDF file is generated for each selected gene and saved in out.dir.

Value

Generates one PDF file for each selected gene in out.dir. Each file contains a box plot showing gene expression across lesion groups.

Author(s)

Abdelrahman Elsayed abdelrahman.elsayed@stjude.org, 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

alex.prep.lsn.expr, KW.hit.express

Examples

data(expr_data)
data(lesion_data)
data(hg38_gene_annotation)

# Prepare expression and lesion data
alex.data <- alex.prep.lsn.expr(expr_data,
                                lesion_data,
                                hg38_gene_annotation,
                                min.expr = 5,
                                min.pts.lsn = 5)

# Run Kruskal-Wallis test
alex.kw.results <- KW.hit.express(alex.data,
                                  hg38_gene_annotation,
                                  min.grp.size = 5)

# Generate box plots for significant genes
dir.create(resultsFolder <- file.path(tempdir(), "temp.out"),
           showWarnings = FALSE)

alex.boxplots(out.dir = resultsFolder,
              alex.data = alex.data,
              alex.kw.results = alex.kw.results,
              q = 1e-15,
              gene.annotation = hg38_gene_annotation)

unlink(resultsFolder, recursive = TRUE)

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