lsn.transcripts.plot: Plot Genomic Lesions with Transcript Annotations

View source: R/lsn.transcripts.plot.R

lsn.transcripts.plotR Documentation

Plot Genomic Lesions with Transcript Annotations

Description

Creates an integrated genomic-region plot combining patient-level genomic lesions with optional transcript annotations, chromosome context, genomic coordinates, lesion-type legends, and gene-level GRIN2 statistics.

The function supports both gene-centered plots and user-defined genomic regions. Single-position lesions, or lesion types explicitly selected by the user, are drawn at their exact genomic coordinates with user-controlled marker size.

Usage

lsn.transcripts.plot(
  grin.res,
  gene = NULL,
  chrom = NULL,
  plot.start = NULL,
  plot.end = NULL,
  transTrack = TRUE,
  show.ideogram = TRUE,
  show.axis = TRUE,
  show.transcript.labels = FALSE,
  transcript.mode = c("all", "selected"),
  selected.transcript = NULL,
  lesion.grp = NULL,
  lsn.clrs = NULL,
  spec.lsn.clr = NULL,
  point.lesion.groups = NULL,
  point.size.mm = 0.8,
  expand = 0.0005,
  hg38.transcripts = NULL,
  hg38.cytoband = NULL,
  genome = "hg38",
  transcript.height = 0.31,
  draw = TRUE
)

Arguments

grin.res

A GRIN2 results object containing at least lsn.data. Gene-centered plots additionally require gene.data; gene-level recurrence and constellation statistics are displayed when gene.hits is available.

gene

Optional character scalar specifying the gene to plot. When supplied, genomic coordinates are obtained from grin.res[["gene.data"]].

chrom

Chromosome for a user-defined regional plot. Used only when gene = NULL. Values with or without the chr prefix are accepted.

plot.start, plot.end

Numeric start and end coordinates for a user-defined regional plot. Both are required when gene = NULL.

transTrack

Logical; whether to display transcript annotations.

show.ideogram

Logical; whether to display a chromosome ideogram.

show.axis

Logical; whether to display a genomic-coordinate axis.

show.transcript.labels

Logical; whether transcript or gene labels are displayed within the transcript track.

transcript.mode

Character string specifying which transcript annotations to display. Use "all" for all overlapping transcripts or "selected" for transcript IDs supplied through selected.transcript.

selected.transcript

Character vector of transcript IDs retained when transcript.mode = "selected". Version suffixes are ignored during matching, allowing identifiers such as ENST00000342505 and ENST00000342505.8 to match.

lesion.grp

Optional character vector specifying lesion types to plot.

lsn.clrs

Optional named character vector assigning colors to lesion types. Vector names must match the lesion-type values in grin.res[["lsn.data"]]$lsn.type. If an unnamed vector is supplied, it must contain exactly one color for each plotted lesion type. When lsn.clrs = NULL, colors are assigned automatically.

spec.lsn.clr

Optional color used when a single lesion type is selected through lesion.grp.

point.lesion.groups

Optional character vector specifying lesion types to display as point markers. When NULL, each lesion is classified from its genomic coordinates: lesions with identical start and end coordinates are displayed as circles, whereas lesions spanning multiple positions are displayed as intervals.

point.size.mm

Positive numeric scalar specifying the diameter, in millimeters, of lesions displayed as circles. The default is 0.8.

expand

Non-negative numeric proportion used to expand a gene-centered plotting interval upstream and downstream. It is ignored for user-defined regional plots, which use the supplied coordinates exactly.

hg38.transcripts

An EnsDb transcript-annotation object compatible with ensembldb::getGeneRegionTrackForGviz(). Required when transTrack = TRUE. A compatible GRCh38 transcript annotation can be obtained through AnnotationHub using the workflow shown in the examples.

hg38.cytoband

Cytoband annotation supplied to Gviz::IdeogramTrack(). Required when show.ideogram = TRUE. A GRCh38 cytoband annotation is provided with GRIN2 as hg38_cytoband and can be loaded using data(hg38_cytoband).

genome

Genome identifier passed to the Gviz annotation tracks.

transcript.height

Relative vertical space allocated to the transcript annotation track. Increasing this value provides additional space when many transcripts are displayed. This value is used only when transTrack = TRUE.

draw

Logical; if TRUE, draw the assembled plot on a new graphics page. The plot object is returned invisibly in either case.

Details

In gene mode, the displayed interval is derived from the matching entry in gene.data and can be expanded using expand. In regional mode, the exact interval specified by chrom, plot.start, and plot.end is used.

Transcript annotations can be shown in full or restricted to selected transcript IDs. Selected IDs are matched after removal of version suffixes. Unmatched IDs are reported in a warning when at least one requested transcript is available; the function stops with an informative error when none of the requested transcripts can be found.

Point-like lesions are plotted at their exact genomic start coordinates and use physical marker sizes measured in millimeters. Lesions are ordered first by lesion type and then by interval size, with source order used to break exact ties.

When transcript annotations are not displayed, the vertical space allocated to the ideogram and genomic-coordinate axis is reduced automatically so that the lesion panel occupies the available plotting area more efficiently.

For gene-centered plots, available lesion-specific subject counts and transformed p- and q-values are displayed together with ordered constellation statistics from gene.hits. Missing statistics are omitted rather than preventing plot construction.

Value

Invisibly returns a gtable/grob object representing the assembled figure. When draw = TRUE, the figure is also drawn.

See Also

grin.stats(), Gviz::GeneRegionTrack(), Gviz::GenomeAxisTrack(), Gviz::IdeogramTrack(), ensembldb::getGeneRegionTrackForGviz()

Examples

data("grin.results")
data("hg38_cytoband")


# Plot lesions across a user-defined genomic region without transcript
# annotations. This example uses only data included with GRIN2.
lsn.transcripts.plot(
  grin.res = grin.results,
  chrom = 9,
  plot.start = 19900000,
  plot.end = 25600000,
  transTrack = FALSE,
  show.ideogram = FALSE,
  lesion.grp = "loss",
  spec.lsn.clr = "blue"
)

# Plot all lesion types across a larger genomic region without transcript
# annotations.
lsn.transcripts.plot(
  grin.res = grin.results,
  chrom = 9,
  plot.start = 1,
  plot.end = 141000000,
  transTrack = FALSE,
  show.ideogram = FALSE,
  point.size.mm = 1
)


## Not run: 
# Transcript-track examples require an EnsDb annotation object retrieved
# through AnnotationHub and therefore require an internet connection.
ah <- AnnotationHub::AnnotationHub()

# Ensembl release 110 transcript annotations for human GRCh38.
hg38.transcripts <- ah[["AH113665"]]

# Define colors for the lesion types in the example dataset.
lesion.colors <- c(
  fusion = "black",
  gain = "red",
  loss = "blue",
  mutation = "olivedrab"
)

# Plot all transcripts and genomic lesions affecting JAK3.
lsn.transcripts.plot(
  grin.res = grin.results,
  gene = "JAK3",
  transcript.mode = "all",
  lsn.clrs = lesion.colors,
  hg38.transcripts = hg38.transcripts,
  hg38.cytoband = hg38_cytoband
)

# Display selected JAK1 transcripts and increase point-marker size.
lsn.transcripts.plot(
  grin.res = grin.results,
  gene = "JAK1",
  transcript.mode = "selected",
  selected.transcript = c(
    "ENST00000342505",
    "ENST00000672751"
  ),
  lsn.clrs = lesion.colors,
  point.size.mm = 0.7,
  transcript.height = 0.40,
  hg38.transcripts = hg38.transcripts,
  hg38.cytoband = hg38_cytoband
)

# Plot transcript annotations and genomic lesions across a user-defined
# region while displaying gene names in the transcript track.
lsn.transcripts.plot(
  grin.res = grin.results,
  chrom = 9,
  plot.start = 21900000,
  plot.end = 21990000,
  transcript.mode = "all",
  show.transcript.labels = TRUE,
  lsn.clrs = lesion.colors,
  transcript.height = 0.46,
  hg38.transcripts = hg38.transcripts,
  hg38.cytoband = hg38_cytoband
)

## End(Not run)


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