
Chromosome plot for expression
get_expression_chromosome_plot.RdConvenience wrapper around get_chromosome_plot() for expression-based
colouring (optional group mean, rowData columns, or assay columns).
Usage
get_expression_chromosome_plot(
x,
txdb,
keytype = "GENEID",
id_column = NULL,
genes = NULL,
value_column = NULL,
value_from = c("rowdata", "assay"),
value_assay = "norm_counts",
facet_value_columns = FALSE,
group_value = NULL,
label_top_n = 20,
display_id = NULL,
line_length = 0.02,
line_width = 0.6,
filter_chrom = NULL,
log_transform = TRUE,
value_label = "log2(mean expr)"
)Arguments
- x
A
VISTAobject.- txdb
A TxDb object (e.g., from GenomicFeatures).
- keytype
Key type in the TxDb matching
id_column(default"GENEID").- id_column
Optional column in
rowData(x)used to match to TxDb keys. WhenNULL, rownames(x) are used as keys.- genes
Optional character vector of gene IDs to label (alternative to
label_top_n). When provided, all genes are plotted but only these are labeled. Defaults toNULL(no explicit label set).- value_column
Optional column in
rowData(x)used for colouring.- value_from
Source for
value_columndata:"rowdata"(default) or"assay". When"assay", the selected assay column is copied intorowDatatemporarily for colouring.- value_assay
Assay name to pull values from when
value_from = "assay". Default"norm_counts".- facet_value_columns
Ignored (kept for compatibility); multiple
value_columns are always arranged in a chromosome-by-column grid.- group_value
Optional group label (from
group_column); when supplied, uses mean expression for that group for colouring (assaynorm_counts).- label_top_n
Integer; number of genes with largest |value| (or random if no value) to label. Ignored when
genesis provided. Set to 0 to disable labels.- display_id
Optional column in
rowData(x)to use for point labels (fallback to gene_id/rownames).- line_length
Horizontal half-length (in megabases) of the tick used to mark each gene position. Default
0.02. Increase for longer ticks.- line_width
Line width of the tick marks. Default
0.6.- filter_chrom
Optional character vector of chromosomes to keep (e.g.,
c("chr1","chr2")). WhenNULL, all chromosomes returned by the TxDb are shown.- log_transform
Logical; when
group_valueis used (andvalue_columnisNULL), apply log2(x + 1) before coloring.- value_label
Optional legend title override for the colour scale.
Value
A ggplot2 object or a list of ggplot2 objects when multiple
value_columns are provided and patchwork is unavailable.
Details
If multiple
value_columns are supplied, one plot is produced per column with its own colour legend titled by that column. Chromosomes are laid out top-down in a single column: for each chromosome, plots for allvalue_columns appear sequentially. Legends for each column are shown on the first occurrence of that column. Requires patchwork; otherwise a list of plots is returned.Labels are kept consistent across
value_columns: ifgenesis provided it is used for all panels; otherwise the toplabel_top_n(by absolute value in the firstvalue_column) are used for all panels.When
value_from = "assay", the specified assay column is copied intorowDataon the fly so it can be used for colouring.When
group_valueis provided (and novalue_column), colouring is based on log2 mean expression for that group (assaynorm_counts), using a data-driven colour scale. Ignored whenvalue_columnis supplied.