| Title: | Visualization and Integrated System for Transcriptomic Analysis |
|---|---|
| Description: | The VISTA (Visualization and Integrated System for Transcriptomic Analysis) platform streamlines differential expression workflows by wrapping DESeq2 and edgeR into a SummarizedExperiment-based container with consistent metadata. The package includes visualization utilities, MSigDB enrichment helpers, and optional deconvolution support to simplify interactive exploration of RNA-seq experiments. |
| Authors: | Chirag Parsania [aut, cre] |
| Maintainer: | Chirag Parsania <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1.0 |
| Built: | 2026-05-29 09:56:49 UTC |
| Source: | https://github.com/bioc/VISTA |
Convert a pre-existing SummarizedExperiment into a valid
VISTA object.
as_vista( se, assay_name = "norm_counts", group_column, comparisons = list(), deg_summary = list(), cutoffs = list(), group_palette = "Dark 3", validate = TRUE )as_vista( se, assay_name = "norm_counts", group_column, comparisons = list(), deg_summary = list(), cutoffs = list(), group_palette = "Dark 3", validate = TRUE )
se |
A |
assay_name |
Assay in |
group_column |
Grouping column in |
comparisons |
Optional named list of differential expression tables. |
deg_summary |
Optional named list of DEG summary tables. |
cutoffs |
Optional named list of threshold metadata. |
group_palette |
Palette name for group colors. |
validate |
Logical; run object validation before returning. |
A VISTA object.
mat <- matrix(rnorm(60), nrow = 10) rownames(mat) <- paste0("gene", seq_len(nrow(mat))) colnames(mat) <- paste0("sample", seq_len(ncol(mat))) se <- SummarizedExperiment::SummarizedExperiment( assays = list(norm_counts = mat), colData = S4Vectors::DataFrame( cond = rep(c("A", "B"), each = 3), row.names = colnames(mat) ), rowData = S4Vectors::DataFrame( gene_id = rownames(mat), row.names = rownames(mat) ) ) v <- as_vista(se, group_column = "cond") vmat <- matrix(rnorm(60), nrow = 10) rownames(mat) <- paste0("gene", seq_len(nrow(mat))) colnames(mat) <- paste0("sample", seq_len(ncol(mat))) se <- SummarizedExperiment::SummarizedExperiment( assays = list(norm_counts = mat), colData = S4Vectors::DataFrame( cond = rep(c("A", "B"), each = 3), row.names = colnames(mat) ), rowData = S4Vectors::DataFrame( gene_id = rownames(mat), row.names = rownames(mat) ) ) v <- as_vista(se, group_column = "cond") v
Run VISTA and direct DESeq2, edgeR, and limma pipelines with matched preprocessing, contrast definitions, and DEG thresholds, then compare the resulting tables, DEG calls, normalized matrices, and critical plot inputs.
benchmark_vista_equivalence( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, methods = c("deseq2", "edger", "limma"), min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "padj", covariates = NULL, design_formula = NULL, tolerance = 1e-08, return_plots = FALSE )benchmark_vista_equivalence( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, methods = c("deseq2", "edger", "limma"), min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "padj", covariates = NULL, design_formula = NULL, tolerance = 1e-08, return_plots = FALSE )
counts |
Raw counts (matrix/data.frame) with a gene-id column and sample columns. |
sample_info |
Data frame with sample metadata. |
column_geneid |
Column name in |
group_column |
Column in |
group_numerator |
Character vector of numerator groups for pairwise comparisons. |
group_denominator |
Character vector of denominator groups. |
methods |
Character vector of backends to benchmark. Any subset of
|
min_counts |
Minimum total counts per gene to retain. |
min_replicates |
Minimum samples per group meeting filtering criteria. |
log2fc_cutoff |
Absolute log2 fold-change threshold for DEG calling. |
pval_cutoff |
P-value (or adjusted p-value) threshold. |
p_value_type |
Either |
covariates |
Optional character vector of additional sample_info columns. |
design_formula |
Optional model formula (or formula string) including |
tolerance |
Numeric tolerance used for floating-point comparisons. |
return_plots |
Logical; if |
A list with fields valid, comparison_summary, visual_summary,
and methods. Each element of methods contains the VISTA object, direct
backend results, structural validation output, self-consistency checks, and
optional plot objects.
v <- example_vista() si <- as.data.frame(sample_info(v)) data("count_data", package = "VISTA") count_subset <- count_data[seq_len(500), c("gene_id", si$sample_names), drop = FALSE] bm <- benchmark_vista_equivalence( counts = count_subset, sample_info = si, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", methods = "limma", min_counts = 5, min_replicates = 1 ) bm$comparison_summary data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") target_groups <- c("control", "treatment1") sample_subset <- sample_metadata[sample_metadata$cond_long %in% target_groups, ] count_subset <- count_data[seq_len(150), c("gene_id", sample_subset$sample_names)] bm <- benchmark_vista_equivalence( counts = count_subset, sample_info = sample_subset, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", methods = c("deseq2", "edger"), min_counts = 5, min_replicates = 1 ) bm$comparison_summary bm$visual_summaryv <- example_vista() si <- as.data.frame(sample_info(v)) data("count_data", package = "VISTA") count_subset <- count_data[seq_len(500), c("gene_id", si$sample_names), drop = FALSE] bm <- benchmark_vista_equivalence( counts = count_subset, sample_info = si, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", methods = "limma", min_counts = 5, min_replicates = 1 ) bm$comparison_summary data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") target_groups <- c("control", "treatment1") sample_subset <- sample_metadata[sample_metadata$cond_long %in% target_groups, ] count_subset <- count_data[seq_len(150), c("gene_id", sample_subset$sample_names)] bm <- benchmark_vista_equivalence( counts = count_subset, sample_info = sample_subset, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", methods = c("deseq2", "edger"), min_counts = 5, min_replicates = 1 ) bm$comparison_summary bm$visual_summary
A count matrix derived from the Bioconductor airway dataset and formatted
for VISTA examples. The first column stores Ensembl gene IDs; the remaining
columns are sample-level counts.
data(count_data)data(count_data)
A tibble with 63,677 rows and 9 columns.
Character column storing Ensembl gene identifiers.
Numeric count values for airway sample SRR1039508.
Numeric count values for airway sample SRR1039509.
Numeric count values for airway sample SRR1039512.
Numeric count values for airway sample SRR1039513.
Numeric count values for airway sample SRR1039516.
Numeric count values for airway sample SRR1039517.
Numeric count values for airway sample SRR1039520.
Numeric count values for airway sample SRR1039521.
Derived from the airway Bioconductor dataset.
This wrapper performs differential expression (DE) analysis (DESeq2, edgeR, limma, or both)
and returns a fully initialized VISTA object. The object stores
expression matrices and annotations in the SummarizedExperiment core, while
all DE outputs and configuration live in metadata(vista):
$de_results: named SimpleList of per-contrast DE tables
$de_summary: named SimpleList of summary tables
$de_cutoffs: list of thresholds/method options
$group: list with column, palette, colors
create_vista( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, method = c("deseq2", "edger", "limma", "both"), min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "padj", covariates = NULL, design_formula = NULL, consensus_mode = c("intersection", "union"), consensus_log2fc = c("mean", "deseq2", "edger"), result_source = NULL, group_palette = "Dark 2", comparison_palette = "Dark 3", validate = TRUE )create_vista( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, method = c("deseq2", "edger", "limma", "both"), min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "padj", covariates = NULL, design_formula = NULL, consensus_mode = c("intersection", "union"), consensus_log2fc = c("mean", "deseq2", "edger"), result_source = NULL, group_palette = "Dark 2", comparison_palette = "Dark 3", validate = TRUE )
counts |
Raw counts (matrix/data.frame) with a gene-id column and sample columns. |
sample_info |
Data frame with sample metadata. Must contain |
column_geneid |
Column name in |
group_column |
Column in |
group_numerator |
Character vector of numerator groups for pairwise comparisons. |
group_denominator |
Character vector of denominator groups (same length/order as numerator). |
method |
|
min_counts |
Minimum total counts per gene to retain (default: 10). |
min_replicates |
Minimum samples per group meeting |
log2fc_cutoff |
Absolute LFC threshold for DEG calling (default: 1). |
pval_cutoff |
p-value (raw or adjusted) threshold (default: 0.05). |
p_value_type |
Which p-value column to use ( |
covariates |
Optional character vector of additional sample_info columns to adjust for. These are included as additive terms in the DE design. |
design_formula |
Optional model formula (or formula string) overriding automatic
construction from |
consensus_mode |
When |
consensus_log2fc |
When |
result_source |
Active DE source used in |
group_palette |
Qualitative palette name for |
comparison_palette |
Qualitative palette name used to assign colors per
comparison (stored in |
validate |
Logical; if |
Contrast names follow "numerator_VS_denominator".
Each DE table must have rownames identical to the final norm_counts rownames.
When method = "both", method-specific and consensus DE tables are stored in
metadata(v)$de_results_by_method and metadata(v)$de_summary_by_method,
and the active source is tracked in metadata(v)$de_active_source.
A VISTA object:
assays(v): norm_counts (matrix)
colData(v): sample_info (DataFrame)
rowData(v): row_data (DataFrame)
metadata(v): de_results, de_summary, de_cutoffs, group, comparison, provenance
as_vista, VISTA-class, qualitative_hcl
# Load example data data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") # Create VISTA object with DESeq2 (default method) vista <- create_vista( counts = count_data[seq_len(100), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", log2fc_cutoff = 0.6, pval_cutoff = 0.05 ) # Examine the VISTA object vista # Access comparisons names(comparisons(vista)) # View DEG summary deg_summary(vista) # View cutoffs used cutoffs(vista) # Multiple comparisons example vista_multi <- create_vista( counts = count_data, sample_info = sample_metadata, column_geneid = "gene_id", group_column = "cell", group_numerator = c("N052611", "N080611"), group_denominator = c("N61311", "N61311"), method = "edger", log2fc_cutoff = 1.0, pval_cutoff = 0.01 )# Load example data data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") # Create VISTA object with DESeq2 (default method) vista <- create_vista( counts = count_data[seq_len(100), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", log2fc_cutoff = 0.6, pval_cutoff = 0.05 ) # Examine the VISTA object vista # Access comparisons names(comparisons(vista)) # View DEG summary deg_summary(vista) # View cutoffs used cutoffs(vista) # Multiple comparisons example vista_multi <- create_vista( counts = count_data, sample_info = sample_metadata, column_geneid = "gene_id", group_column = "cell", group_numerator = c("N052611", "N080611"), group_denominator = c("N61311", "N61311"), method = "edger", log2fc_cutoff = 1.0, pval_cutoff = 0.01 )
derive_vista_metadata() creates a starter sample_info table from count
sample names. It is intended for projects where users have count columns but
do not yet have a separate metadata sheet. The derived table can be edited,
passed through read_vista_metadata(), and then aligned with
match_vista_inputs().
derive_vista_metadata( counts, column_geneid = NULL, sample_names = NULL, parser = c("auto", "split", "regex", "none"), split = "_", fields = NULL, pattern = NULL, sample_column = "sample_names", repair_sample_names = c("auto", "none"), return_type = c("data.frame", "template"), verbose = TRUE )derive_vista_metadata( counts, column_geneid = NULL, sample_names = NULL, parser = c("auto", "split", "regex", "none"), split = "_", fields = NULL, pattern = NULL, sample_column = "sample_names", repair_sample_names = c("auto", "none"), return_type = c("data.frame", "template"), verbose = TRUE )
counts |
Count input accepted by |
column_geneid |
Optional gene identifier column for raw tabular count
inputs. Ignored when |
sample_names |
Optional explicit sample names to derive metadata from.
When supplied, these override names extracted from |
parser |
Metadata parsing mode. |
split |
Delimiter used when |
fields |
Optional field names for parsed metadata columns. When omitted,
VISTA uses |
pattern |
Regular expression used when |
sample_column |
Name of the sample identifier column in the returned
metadata. Default is |
repair_sample_names |
Strategy passed to |
return_type |
Return |
verbose |
Logical; print an informational derivation summary. |
A data frame containing sample_names plus any parsed metadata
columns.
data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") counts_in <- count_data[seq_len(8), c("gene_id", sample_metadata$sample_names[seq_len(6)]), drop = FALSE] meta <- derive_vista_metadata( counts_in, column_geneid = "gene_id", parser = "regex", pattern = "SRR(\\d+)", fields = "run_id" ) head(meta)data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") counts_in <- count_data[seq_len(8), c("gene_id", sample_metadata$sample_names[seq_len(6)]), drop = FALSE] meta <- derive_vista_metadata( counts_in, column_geneid = "gene_id", parser = "regex", pattern = "SRR(\\d+)", fields = "run_id" ) head(meta)
This function performs ORA on a set of genes from a VISTA object. Gene
identifiers stored as “ENSG00000187634:SAMD11” will be split at the colon and
the appropriate part extracted based on from_type. Genes are then
optionally converted via orgdb to match the identifier type required by
the MSigDB gene sets.
enrichMsigDB( x, gene_list, from_type = "SYMBOL", orgdb, msigdb_category = "H", msigdb_subcategory = NULL, species = "Mus musculus", background = NULL, col_genetype = "GENETYPE", feature_type = "protein-coding", ... )enrichMsigDB( x, gene_list, from_type = "SYMBOL", orgdb, msigdb_category = "H", msigdb_subcategory = NULL, species = "Mus musculus", background = NULL, col_genetype = "GENETYPE", feature_type = "protein-coding", ... )
x |
A VISTA object. |
gene_list |
A non-empty character vector of gene identifiers. This
argument is required and must not be |
from_type |
Identifier type of the genes in |
orgdb |
An |
msigdb_category |
MSigDB category (e.g. |
msigdb_subcategory |
Optional MSigDB sub-collection (e.g. |
species |
Species name for MSigDB (default |
background |
Optional character vector of background gene IDs. If |
col_genetype |
Column name in |
feature_type |
Gene type to retain in the background when |
... |
Additional arguments to pass to |
A list containing a single enrichResult object named "enrich".
v <- example_vista() genes <- head(as.character(row_data(v)$gene_id), 20) if (requireNamespace('msigdbr', quietly = TRUE)) { out <- try(enrichMsigDB(v, gene_list = genes, from_type = 'ENSEMBL', msigdb_category = 'H'), silent = TRUE) if (!inherits(out, 'try-error')) out }v <- example_vista() genes <- head(as.character(row_data(v)$gene_id), 20) if (requireNamespace('msigdbr', quietly = TRUE)) { out <- try(enrichMsigDB(v, gene_list = genes, from_type = 'ENSEMBL', msigdb_category = 'H'), silent = TRUE) if (!inherits(out, 'try-error')) out }
Creates a lightweight VISTA object from built-in package datasets
(count_data and sample_metadata) for use in examples and tutorials.
The default call returns a precomputed object to keep examples and package
checks fast. Non-default argument combinations fall back to rebuilding the
object from the packaged example inputs.
example_vista(n_genes = 150, n_per_group = 3, method = "deseq2")example_vista(n_genes = 150, n_per_group = 3, method = "deseq2")
n_genes |
Number of genes to include (default |
n_per_group |
Number of samples per group ( |
method |
Differential expression backend passed to |
A VISTA object.
v <- example_vista() vv <- example_vista() v
Generates a standardized folder with selected VISTA plots, tabular outputs, and a manifest describing all saved files.
export_vista_assets( x, out_dir = "vista_assets", sample_comparison = NULL, display_id = NULL, include_plots = c("pca", "mds", "corr_heatmap", "deg_bar", "volcano", "ma", "expression_heatmap"), include_data = c("comparison", "norm_counts", "sample_info", "row_data", "deg_summary", "cutoffs"), plot_format = "png", width = 8, height = 6, heatmap_height = 10, units = "in", dpi = 300, top_n_labels = 50, heatmap_n_genes = 60, write_excel = FALSE, overwrite = TRUE )export_vista_assets( x, out_dir = "vista_assets", sample_comparison = NULL, display_id = NULL, include_plots = c("pca", "mds", "corr_heatmap", "deg_bar", "volcano", "ma", "expression_heatmap"), include_data = c("comparison", "norm_counts", "sample_info", "row_data", "deg_summary", "cutoffs"), plot_format = "png", width = 8, height = 6, heatmap_height = 10, units = "in", dpi = 300, top_n_labels = 50, heatmap_n_genes = 60, write_excel = FALSE, overwrite = TRUE )
x |
A |
out_dir |
Output directory for exported assets. |
sample_comparison |
Optional comparison to use for comparison-specific outputs. Defaults to the first available comparison. |
display_id |
Optional gene identifier column used in labeling for volcano/MA/heatmap plots. |
include_plots |
Character vector of plot keys to export. Supported:
|
include_data |
Character vector of data keys passed to
|
plot_format |
Plot format (e.g. |
width |
Base plot width. |
height |
Base plot height. |
heatmap_height |
Height used specifically for expression heatmap export. |
units |
Plot dimension units. |
dpi |
Raster resolution for plots. |
top_n_labels |
Number of top genes to annotate in MA plots. |
heatmap_n_genes |
Number of top genes used in exported expression heatmaps. |
write_excel |
Logical; if |
overwrite |
Logical; if |
Invisibly, a list with out_dir, sample_comparison, manifest,
plot_files, and data_files.
v <- example_vista() out_dir <- file.path(tempdir(), "vista_assets_example") res <- export_vista_assets( v, out_dir = out_dir, include_plots = "pca", include_data = "comparison" ) names(res)v <- example_vista() out_dir <- file.path(tempdir(), "vista_assets_example") res <- export_vista_assets( v, out_dir = out_dir, include_plots = "pca", include_data = "comparison" ) names(res)
Retrieve stored cell fraction estimates
get_cell_fractions(x)get_cell_fractions(x)
x |
A VISTA object. |
A data.frame of cell fraction estimates with samples in rows.
v <- example_vista() if (requireNamespace('xCell2', quietly = TRUE)) { vx <- try(run_cell_deconvolution(v, method = 'xCell2'), silent = TRUE) if (!inherits(vx, 'try-error')) head(get_cell_fractions(vx)) }v <- example_vista() if (requireNamespace('xCell2', quietly = TRUE)) { vx <- try(run_cell_deconvolution(v, method = 'xCell2'), silent = TRUE) if (!inherits(vx, 'try-error')) head(get_cell_fractions(vx)) }
Plot cell-type composition as stacked bars
get_celltype_barplot( x, group_column = NULL, sample_names = NULL, base_size = 12, cell_types = NULL, top_n = NULL, collapse_other = TRUE, normalize = c("sample", "none"), facet_by = c("group", "none") )get_celltype_barplot( x, group_column = NULL, sample_names = NULL, base_size = 12, cell_types = NULL, top_n = NULL, collapse_other = TRUE, normalize = c("sample", "none"), facet_by = c("group", "none") )
x |
A VISTA object. |
group_column |
Optional column in |
sample_names |
Optional character vector of sample names to include. |
base_size |
Base font size. |
cell_types |
Optional character vector of cell types to keep. |
top_n |
Optional top-N cell types by mean score (ignored when |
collapse_other |
Logical; collapse non-selected cell types into |
normalize |
One of |
facet_by |
Faceting mode: |
A ggplot object.
mat <- matrix(rpois(20, lambda = 20), nrow = 5) rownames(mat) <- paste0("gene", seq_len(5)) colnames(mat) <- paste0("sample", seq_len(4)) se <- SummarizedExperiment::SummarizedExperiment( assays = list(norm_counts = mat), colData = S4Vectors::DataFrame( cond = c("A", "A", "B", "B"), row.names = colnames(mat) ), rowData = S4Vectors::DataFrame( gene_id = rownames(mat), row.names = rownames(mat) ) ) v <- as_vista(se, group_column = "cond") md <- S4Vectors::metadata(v) md$cell_fractions <- data.frame( fibroblast = c(0.2, 0.3, 0.4, 0.5), epithelial = c(0.8, 0.7, 0.6, 0.5), row.names = colnames(mat) ) S4Vectors::metadata(v) <- md get_celltype_barplot(v, group_column = "cond")mat <- matrix(rpois(20, lambda = 20), nrow = 5) rownames(mat) <- paste0("gene", seq_len(5)) colnames(mat) <- paste0("sample", seq_len(4)) se <- SummarizedExperiment::SummarizedExperiment( assays = list(norm_counts = mat), colData = S4Vectors::DataFrame( cond = c("A", "A", "B", "B"), row.names = colnames(mat) ), rowData = S4Vectors::DataFrame( gene_id = rownames(mat), row.names = rownames(mat) ) ) v <- as_vista(se, group_column = "cond") md <- S4Vectors::metadata(v) md$cell_fractions <- data.frame( fibroblast = c(0.2, 0.3, 0.4, 0.5), epithelial = c(0.8, 0.7, 0.6, 0.5), row.names = colnames(mat) ) S4Vectors::metadata(v) <- md get_celltype_barplot(v, group_column = "cond")
Plot group-level deconvolution scores as dot plot
get_celltype_group_dotplot( x, group_column = NULL, cell_types = NULL, top_n = 12, summary_fun = c("mean", "median"), error = c("se", "sd", "none"), add_points = TRUE, point_size = 2.5, base_size = 12 )get_celltype_group_dotplot( x, group_column = NULL, cell_types = NULL, top_n = 12, summary_fun = c("mean", "median"), error = c("se", "sd", "none"), add_points = TRUE, point_size = 2.5, base_size = 12 )
x |
A VISTA object. |
group_column |
Column in |
cell_types |
Optional character vector of cell types to include. |
top_n |
Number of top cell types by mean score when |
summary_fun |
One of |
error |
Error-bar type: |
add_points |
Logical; overlay sample-level jittered points. |
point_size |
Point size for summary points. |
base_size |
Base font size. |
A ggplot object.
mat <- matrix(rpois(20, lambda = 20), nrow = 5) rownames(mat) <- paste0("gene", seq_len(5)) colnames(mat) <- paste0("sample", seq_len(4)) se <- SummarizedExperiment::SummarizedExperiment( assays = list(norm_counts = mat), colData = S4Vectors::DataFrame( cond = c("A", "A", "B", "B"), row.names = colnames(mat) ), rowData = S4Vectors::DataFrame( gene_id = rownames(mat), row.names = rownames(mat) ) ) v <- as_vista(se, group_column = "cond") md <- S4Vectors::metadata(v) md$cell_fractions <- data.frame( fibroblast = c(0.2, 0.3, 0.4, 0.5), epithelial = c(0.8, 0.7, 0.6, 0.5), row.names = colnames(mat) ) S4Vectors::metadata(v) <- md get_celltype_group_dotplot(v, group_column = "cond")mat <- matrix(rpois(20, lambda = 20), nrow = 5) rownames(mat) <- paste0("gene", seq_len(5)) colnames(mat) <- paste0("sample", seq_len(4)) se <- SummarizedExperiment::SummarizedExperiment( assays = list(norm_counts = mat), colData = S4Vectors::DataFrame( cond = c("A", "A", "B", "B"), row.names = colnames(mat) ), rowData = S4Vectors::DataFrame( gene_id = rownames(mat), row.names = rownames(mat) ) ) v <- as_vista(se, group_column = "cond") md <- S4Vectors::metadata(v) md$cell_fractions <- data.frame( fibroblast = c(0.2, 0.3, 0.4, 0.5), epithelial = c(0.8, 0.7, 0.6, 0.5), row.names = colnames(mat) ) S4Vectors::metadata(v) <- md get_celltype_group_dotplot(v, group_column = "cond")
Plot cell-type deconvolution heatmap
get_celltype_heatmap( x, group_column = NULL, sample_names = NULL, cell_types = NULL, top_n = 20, transform = c("none", "zscore", "log1p"), cluster_rows = TRUE, cluster_columns = TRUE, label = FALSE, base_size = 11, return_type = c("plot", "matrix", "both") )get_celltype_heatmap( x, group_column = NULL, sample_names = NULL, cell_types = NULL, top_n = 20, transform = c("none", "zscore", "log1p"), cluster_rows = TRUE, cluster_columns = TRUE, label = FALSE, base_size = 11, return_type = c("plot", "matrix", "both") )
x |
A VISTA object. |
group_column |
Optional grouping column from |
sample_names |
Optional character vector of sample names to include. |
cell_types |
Optional character vector of cell types to include. |
top_n |
Number of top cell types by mean score when |
transform |
One of |
cluster_rows |
Logical; hierarchical cluster cell types. |
cluster_columns |
Logical; hierarchical cluster samples. |
label |
Logical; overlay numeric values on tiles. |
base_size |
Base font size. |
return_type |
One of |
A ggplot object, matrix, or list depending on return_type.
mat <- matrix(rpois(20, lambda = 20), nrow = 5) rownames(mat) <- paste0("gene", seq_len(5)) colnames(mat) <- paste0("sample", seq_len(4)) se <- SummarizedExperiment::SummarizedExperiment( assays = list(norm_counts = mat), colData = S4Vectors::DataFrame( cond = c("A", "A", "B", "B"), row.names = colnames(mat) ), rowData = S4Vectors::DataFrame( gene_id = rownames(mat), row.names = rownames(mat) ) ) v <- as_vista(se, group_column = "cond") md <- S4Vectors::metadata(v) md$cell_fractions <- data.frame( fibroblast = c(0.2, 0.3, 0.4, 0.5), epithelial = c(0.8, 0.7, 0.6, 0.5), row.names = colnames(mat) ) S4Vectors::metadata(v) <- md get_celltype_heatmap(v, group_column = "cond")mat <- matrix(rpois(20, lambda = 20), nrow = 5) rownames(mat) <- paste0("gene", seq_len(5)) colnames(mat) <- paste0("sample", seq_len(4)) se <- SummarizedExperiment::SummarizedExperiment( assays = list(norm_counts = mat), colData = S4Vectors::DataFrame( cond = c("A", "A", "B", "B"), row.names = colnames(mat) ), rowData = S4Vectors::DataFrame( gene_id = rownames(mat), row.names = rownames(mat) ) ) v <- as_vista(se, group_column = "cond") md <- S4Vectors::metadata(v) md$cell_fractions <- data.frame( fibroblast = c(0.2, 0.3, 0.4, 0.5), epithelial = c(0.8, 0.7, 0.6, 0.5), row.names = colnames(mat) ) S4Vectors::metadata(v) <- md get_celltype_heatmap(v, group_column = "cond")
Plots sample-sample correlation matrix derived from normalized counts with optional clustering and annotations.
get_corr_heatmap( x, sample_group = NULL, group_column = NULL, genes = NULL, corr_method = "pearson", triangle = c("full", "lower", "upper"), cluster_by = c("correlation", "group", "input", "none"), show_diagonal = TRUE, label = TRUE, show_corr_values = NULL, label_color = "black", col_corr_values = NULL, label_size = 4, limits = NULL, base_size = 12, viridis_option = "viridis", viridis_direction = 1, viridis_begin = 0, viridis_end = 1 )get_corr_heatmap( x, sample_group = NULL, group_column = NULL, genes = NULL, corr_method = "pearson", triangle = c("full", "lower", "upper"), cluster_by = c("correlation", "group", "input", "none"), show_diagonal = TRUE, label = TRUE, show_corr_values = NULL, label_color = "black", col_corr_values = NULL, label_size = 4, limits = NULL, base_size = 12, viridis_option = "viridis", viridis_direction = 1, viridis_begin = 0, viridis_end = 1 )
x |
A |
sample_group |
Optional character vector of groups (referencing |
group_column |
Optional column name in |
genes |
Optional character vector of gene IDs to limit the matrix. |
corr_method |
Correlation method passed to |
triangle |
Either |
cluster_by |
Ordering strategy for samples: |
show_diagonal |
Logical; include the correlation diagonal when |
label |
Logical; overlay correlation coefficients as text. |
show_corr_values |
Deprecated alias for |
label_color |
Color for the text labels. |
col_corr_values |
Deprecated alias for |
label_size |
Numeric text size multiplier. |
limits |
Optional numeric vector of length two giving limits for the color scale. |
base_size |
Base theme size. |
viridis_option |
Character viridis palette name. |
viridis_direction |
Integer (1 or -1) controlling palette direction. |
viridis_begin, viridis_end
|
Palette endpoints between 0 and 1. |
An object returned by this function.
v <- example_vista() p <- get_corr_heatmap(v) print(p)v <- example_vista() p <- get_corr_heatmap(v) print(p)
Plot alluvial diagram showing gene regulation transitions across comparisons
get_deg_alluvial(x, sample_comparisons, show_other = FALSE)get_deg_alluvial(x, sample_comparisons, show_other = FALSE)
x |
A VISTA object (DE results in |
sample_comparisons |
Character vector of comparison names to include (>= 2). |
show_other |
Logical; include "Other" genes. Default FALSE. |
A ggplot object.
data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") si <- as.data.frame(sample_metadata[seq_len(8), ], stringsAsFactors = FALSE) trt_idx <- which(si$cond_long == "treatment1") si$cond_long[trt_idx] <- rep(c("treatment1", "treatment2"), length.out = length(trt_idx)) si$groups <- si$cond_long v <- create_vista( counts = count_data[seq_len(120), c("gene_id", si$sample_names)], sample_info = si, column_geneid = "gene_id", group_column = "cond_long", group_numerator = c("treatment1", "treatment2"), group_denominator = c("control", "control"), min_counts = 5, min_replicates = 1 ) if (requireNamespace('ggalluvial', quietly = TRUE)) { p <- get_deg_alluvial(v, sample_comparisons = names(comparisons(v))) print(p) }data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") si <- as.data.frame(sample_metadata[seq_len(8), ], stringsAsFactors = FALSE) trt_idx <- which(si$cond_long == "treatment1") si$cond_long[trt_idx] <- rep(c("treatment1", "treatment2"), length.out = length(trt_idx)) si$groups <- si$cond_long v <- create_vista( counts = count_data[seq_len(120), c("gene_id", si$sample_names)], sample_info = si, column_geneid = "gene_id", group_column = "cond_long", group_numerator = c("treatment1", "treatment2"), group_denominator = c("control", "control"), min_counts = 5, min_replicates = 1 ) if (requireNamespace('ggalluvial', quietly = TRUE)) { p <- get_deg_alluvial(v, sample_comparisons = names(comparisons(v))) print(p) }
Barplot of DEG counts (Up/Down) across comparisons
get_deg_count_barplot( x, sample_comparisons = NULL, label = TRUE, base_size = 12, colors = c(Up = "red4", Down = "blue4"), facet_by = c("none", "regulation", "comparison"), facet_scales = "fixed" )get_deg_count_barplot( x, sample_comparisons = NULL, label = TRUE, base_size = 12, colors = c(Up = "red4", Down = "blue4"), facet_by = c("none", "regulation", "comparison"), facet_scales = "fixed" )
x |
A |
sample_comparisons |
Optional character vector of comparison names to display. |
label |
Logical; overlay numeric counts above bars when |
base_size |
Numeric base font size for the plot. |
colors |
Named vector giving fill colors for |
facet_by |
Either |
facet_scales |
Scale option passed to |
An object returned by this function.
v <- example_vista() p <- get_deg_count_barplot(v) print(p)v <- example_vista() p <- get_deg_count_barplot(v) print(p)
Donut chart of DEG counts (Up/Down) across comparisons
get_deg_count_donutplot( x, sample_comparisons = NULL, label = c("both", "count", "percent", "none"), label_digits = 1, base_size = 12, colors = c(Up = "red4", Down = "blue4"), show_other = FALSE, other_color = "grey70", text_color = "black", facet_by = c("comparison", "none"), ncol = NULL )get_deg_count_donutplot( x, sample_comparisons = NULL, label = c("both", "count", "percent", "none"), label_digits = 1, base_size = 12, colors = c(Up = "red4", Down = "blue4"), show_other = FALSE, other_color = "grey70", text_color = "black", facet_by = c("comparison", "none"), ncol = NULL )
x |
A |
sample_comparisons |
Optional character vector of comparison names to display. |
label |
Label mode: |
label_digits |
Integer number of decimals used for percentage labels. |
base_size |
Numeric base font size for the plot. |
colors |
Named vector giving fill colors for |
show_other |
Logical; when |
other_color |
Fill colour used for the |
text_color |
Colour used for donut label text. |
facet_by |
Either |
ncol |
Optional number of columns when faceting. |
An object returned by this function.
v <- example_vista() p <- get_deg_count_donutplot(v) print(p)v <- example_vista() p <- get_deg_count_donutplot(v) print(p)
Pie chart of DEG counts (Up/Down) across comparisons
get_deg_count_pieplot( x, sample_comparisons = NULL, label = c("both", "count", "percent", "none"), label_digits = 1, base_size = 12, colors = c(Up = "red4", Down = "blue4"), show_other = FALSE, other_color = "grey70", text_color = "black", facet_by = c("comparison", "none"), ncol = NULL )get_deg_count_pieplot( x, sample_comparisons = NULL, label = c("both", "count", "percent", "none"), label_digits = 1, base_size = 12, colors = c(Up = "red4", Down = "blue4"), show_other = FALSE, other_color = "grey70", text_color = "black", facet_by = c("comparison", "none"), ncol = NULL )
x |
A |
sample_comparisons |
Optional character vector of comparison names to display. |
label |
Label mode: |
label_digits |
Integer number of decimals used for percentage labels. |
base_size |
Numeric base font size for the plot. |
colors |
Named vector giving fill colors for |
show_other |
Logical; when |
other_color |
Fill colour used for the |
text_color |
Colour used for pie label text. |
facet_by |
Either |
ncol |
Optional number of columns when faceting. |
An object returned by this function.
v <- example_vista() p <- get_deg_count_pieplot(v) print(p)v <- example_vista() p <- get_deg_count_pieplot(v) print(p)
Visualizes overlaps between DEG sets for two to four comparisons.
get_deg_venn_diagram( x, sample_comparisons, regulation = "Up", palette = "Set 2", auto_scale = FALSE, show_percentage = TRUE, ... )get_deg_venn_diagram( x, sample_comparisons, regulation = "Up", palette = "Set 2", auto_scale = FALSE, show_percentage = TRUE, ... )
x |
A |
sample_comparisons |
Character vector of 2–4 comparison names to include in the Venn diagram. |
regulation |
One of |
palette |
Qualitative palette name passed to |
auto_scale |
Logical; pass through to |
show_percentage |
Logical; request percentage labels from |
... |
Additional arguments forwarded to |
An object returned by this function.
v <- example_vista() comps <- names(comparisons(v)) if (length(comps) >= 2) { p <- get_deg_venn_diagram(v, sample_comparisons = comps[seq_len(2)]) print(p) }v <- example_vista() comps <- names(comparisons(v)) if (length(comps) >= 2) { p <- get_deg_venn_diagram(v, sample_comparisons = comps[seq_len(2)]) print(p) }
Draws a chord diagram linking genes to the enriched pathways they belong to. Chords can be coloured by fold-change, regulation direction, or source pathway.
get_enrichment_chord( x, vista = NULL, sample_comparison = NULL, pathways = NULL, top_n = 8, pathway_column = c("Description", "ID"), gene_column = c("auto", "geneID", "core_enrichment"), gene_sep = "/", min_pathways = 1, max_genes = 50, gene_order_by = c("none", "foldchange", "abs_foldchange"), gene_id_column = NULL, display_id = NULL, color_by = c("foldchange", "regulation", "pathway"), up_color = "#D73027", down_color = "#1A9850", other_color = "grey70", pathway_colors = NULL, transparency = 0.4, gap_degree = 2, label_cex = 0.7, title = NULL )get_enrichment_chord( x, vista = NULL, sample_comparison = NULL, pathways = NULL, top_n = 8, pathway_column = c("Description", "ID"), gene_column = c("auto", "geneID", "core_enrichment"), gene_sep = "/", min_pathways = 1, max_genes = 50, gene_order_by = c("none", "foldchange", "abs_foldchange"), gene_id_column = NULL, display_id = NULL, color_by = c("foldchange", "regulation", "pathway"), up_color = "#D73027", down_color = "#1A9850", other_color = "grey70", pathway_colors = NULL, transparency = 0.4, gap_degree = 2, label_cex = 0.7, title = NULL )
x |
An |
vista |
Optional |
sample_comparison |
Character scalar naming the DE comparison in |
pathways |
Optional character vector of pathway names to include.
Matches against |
top_n |
Number of top pathways to display when |
pathway_column |
Column in the enrichment result to match pathway names:
|
gene_column |
Column storing gene members: |
gene_sep |
Delimiter separating genes in |
min_pathways |
Minimum number of pathways a gene must appear in to be
shown. Set to |
max_genes |
Maximum number of genes to display (default |
gene_order_by |
Order of gene sectors in the chord plot:
|
gene_id_column |
Column in |
display_id |
Column in |
color_by |
How to colour chords: |
up_color |
Colour for up-regulated genes (default |
down_color |
Colour for down-regulated genes (default |
other_color |
Colour for non-significant genes (default |
pathway_colors |
Optional named vector of colours for pathway sectors.
When |
transparency |
Chord transparency, 0–1 (default |
gap_degree |
Gap between sectors in degrees (default |
label_cex |
Text size for sector labels (default |
title |
Optional plot title. |
The plot reveals hub genes (those driving multiple enriched terms) and
pathway redundancy (terms sharing many genes).
This complements get_enrichment_plot() (which shows significance) and
get_pathway_heatmap() (which shows expression patterns).
Invisibly returns a list with:
Tibble of genes with pathway membership and (optionally) fold-change values.
Character vector of genes appearing in two or more pathways.
The chord diagram is drawn as a side effect.
v <- example_vista() msig <- get_msigdb_enrichment( v, sample_comparison = names(comparisons(v))[1], regulation = "Both", msigdb_category = "H", from_type = "ENSEMBL" ) get_enrichment_chord(msig, top_n = 5) data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) msig <- get_msigdb_enrichment( vista, sample_comparison = names(comparisons(vista))[1], regulation = "Up", from_type = "ENSEMBL" ) # Simple: pathway-coloured chords get_enrichment_chord(msig) # With fold-change colouring get_enrichment_chord( msig, vista = vista, sample_comparison = names(comparisons(vista))[1], color_by = "foldchange" ) # Hub genes only (shared across 2+ pathways) pw_long <- get_pathway_genes(msig, return_type = "long") if (any(table(pw_long$gene) >= 2)) { get_enrichment_chord(msig, min_pathways = 2) }v <- example_vista() msig <- get_msigdb_enrichment( v, sample_comparison = names(comparisons(v))[1], regulation = "Both", msigdb_category = "H", from_type = "ENSEMBL" ) get_enrichment_chord(msig, top_n = 5) data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) msig <- get_msigdb_enrichment( vista, sample_comparison = names(comparisons(vista))[1], regulation = "Up", from_type = "ENSEMBL" ) # Simple: pathway-coloured chords get_enrichment_chord(msig) # With fold-change colouring get_enrichment_chord( msig, vista = vista, sample_comparison = names(comparisons(vista))[1], color_by = "foldchange" ) # Hub genes only (shared across 2+ pathways) pw_long <- get_pathway_genes(msig, return_type = "long") if (any(table(pw_long$gene) >= 2)) { get_enrichment_chord(msig, min_pathways = 2) }
Generates a dot plot of enrichment results for enrichResult, gseaResult,
or compareClusterResult objects (including those returned by
enrichMsigDB()). Points are sized by gene/set count and coloured by
-log10(FDR). For compareCluster results, the plot is faceted by cluster with
top terms selected per cluster.
get_enrichment_plot(x, top_n = 10, title = NULL)get_enrichment_plot(x, top_n = 10, title = NULL)
x |
An object of class |
top_n |
Integer; number of top terms to plot (per cluster for compareCluster). |
title |
Optional plot title. |
A ggplot2 object.
## Not run: v <- example_vista() com <- names(comparisons(v))[1] if (requireNamespace('msigdbr', quietly = TRUE)) { ms <- try(get_msigdb_enrichment(v, sample_comparison = com, regulation = 'Up', from_type = 'ENSEMBL'), silent = TRUE) if (!inherits(ms, 'try-error') && !is.null(ms$enrich)) print(get_enrichment_plot(ms$enrich)) } ## End(Not run)## Not run: v <- example_vista() com <- names(comparisons(v))[1] if (requireNamespace('msigdbr', quietly = TRUE)) { ms <- try(get_msigdb_enrichment(v, sample_comparison = com, regulation = 'Up', from_type = 'ENSEMBL'), silent = TRUE) if (!inherits(ms, 'try-error') && !is.null(ms$enrich)) print(get_enrichment_plot(ms$enrich)) } ## End(Not run)
Displays selected genes as grouped summary bars or individual sample-level
bars. By default, expression is summarized per group with mean ± SD bars.
With by = "sample", each sample is drawn separately.
get_expression_barplot( x, genes, sample_group = NULL, group_column = NULL, log_transform = TRUE, stats_group = FALSE, facet_scale = "free_y", facet_scales = facet_scale, facet_nrow = NULL, facet_ncol = NULL, p.label = "p.signif", comparisons = NULL, display_id = NULL, display_from = NULL, display_orgdb = NULL, by = c("group", "sample"), sample_order = c("input", "group", "expression"), fill_by = NULL, facet_by = c("auto", "gene", "none") )get_expression_barplot( x, genes, sample_group = NULL, group_column = NULL, log_transform = TRUE, stats_group = FALSE, facet_scale = "free_y", facet_scales = facet_scale, facet_nrow = NULL, facet_ncol = NULL, p.label = "p.signif", comparisons = NULL, display_id = NULL, display_from = NULL, display_orgdb = NULL, by = c("group", "sample"), sample_order = c("input", "group", "expression"), fill_by = NULL, facet_by = c("auto", "gene", "none") )
x |
A |
genes |
Character vector (<=25 genes) to plot. |
sample_group |
Optional character vector of groups (from |
group_column |
Optional column name in |
log_transform |
Logical; log2-transform expression before plotting. |
stats_group |
Logical; add statistical comparisons between groups when |
facet_scale |
Scaling option passed to |
facet_scales |
Facet scales argument passed to |
facet_nrow, facet_ncol
|
Optional layout passed to |
p.label |
Label format for |
comparisons |
Optional list of specific group comparisons for |
display_id |
Optional ID/column name to use for labels/facets. If supplied
and present in |
display_from |
Optional source ID type for mapping (used when |
display_orgdb |
Optional |
by |
One of |
sample_order |
Ordering used when |
fill_by |
Fill mapping for |
facet_by |
Faceting mode: |
A ggplot2 object.
# Create VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) # Plot expression for select genes genes <- rownames(vista)[seq_len(3)] get_expression_barplot(vista, genes = genes) # With statistics get_expression_barplot(vista, genes = genes, stats_group = TRUE) # Without log transformation get_expression_barplot(vista, genes = genes, log_transform = FALSE)# Create VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) # Plot expression for select genes genes <- rownames(vista)[seq_len(3)] get_expression_barplot(vista, genes = genes) # With statistics get_expression_barplot(vista, genes = genes, stats_group = TRUE) # Without log transformation get_expression_barplot(vista, genes = genes, log_transform = FALSE)
Displays per-sample or per-group distributions for selected genes using
normalized counts. The x-axis unit is controlled by by, and faceting is
controlled explicitly by facet_by.
get_expression_boxplot( x, genes = NULL, sample_group = NULL, group_column = NULL, log_transform = TRUE, display_id = NULL, display_from = NULL, display_orgdb = NULL, facet_scales = "free_y", facet_nrow = NULL, facet_ncol = NULL, stats_group = FALSE, p.label = "p.signif", comparisons = NULL, pool_genes = FALSE, by = "group", facet_by = "auto", fill_by = NULL, sample_order = c("input", "group", "expression") )get_expression_boxplot( x, genes = NULL, sample_group = NULL, group_column = NULL, log_transform = TRUE, display_id = NULL, display_from = NULL, display_orgdb = NULL, facet_scales = "free_y", facet_nrow = NULL, facet_ncol = NULL, stats_group = FALSE, p.label = "p.signif", comparisons = NULL, pool_genes = FALSE, by = "group", facet_by = "auto", fill_by = NULL, sample_order = c("input", "group", "expression") )
x |
A |
genes |
Optional character vector of genes to display (<=20). Defaults to all genes. |
sample_group |
Optional character vector specifying which groups (as defined by |
group_column |
Optional column name in |
log_transform |
Logical; apply log2(x + 1) transform before plotting. |
display_id |
Optional column in |
display_from |
Optional source ID type for mapping (used when |
display_orgdb |
Optional |
facet_scales |
Facet scales argument passed to |
facet_nrow, facet_ncol
|
Optional layout passed to |
stats_group |
Logical; add statistical comparisons between groups when
|
p.label |
Label format for |
comparisons |
Optional list of specific group comparisons for |
pool_genes |
Logical; when |
by |
When |
facet_by |
Faceting control: for pooled genes, |
fill_by |
Fill mapping. Special values are |
sample_order |
Ordering used when sample names are shown on the x-axis:
|
An object returned by this function.
v <- example_vista() genes <- head(rownames(v), 3) p <- get_expression_boxplot(v, genes = genes) print(p)v <- example_vista() genes <- head(rownames(v), 3) p <- get_expression_boxplot(v, genes = genes) print(p)
Convenience wrapper around get_chromosome_plot() for expression-based
colouring (optional group mean, rowData columns, or assay columns).
get_expression_chromosome_plot( x, txdb, keytype = "GENEID", id_column = NULL, genes = NULL, sample_group = NULL, group_column = NULL, value_column = NULL, value_from = c("rowdata", "assay"), value_assay = "norm_counts", facet_value_columns = FALSE, side_by_side_groups = FALSE, paginate = TRUE, panels_per_page = 24, summarise_replicates = FALSE, summarise_method = c("mean", "median"), group_value = NULL, label_n = 20, label_genes = c("top", "all", "none"), display_id = NULL, line_length = 0.02, line_width = 0.6, filter_chrom = NULL, log_transform = TRUE, value_label = "log2(mean expr)" )get_expression_chromosome_plot( x, txdb, keytype = "GENEID", id_column = NULL, genes = NULL, sample_group = NULL, group_column = NULL, value_column = NULL, value_from = c("rowdata", "assay"), value_assay = "norm_counts", facet_value_columns = FALSE, side_by_side_groups = FALSE, paginate = TRUE, panels_per_page = 24, summarise_replicates = FALSE, summarise_method = c("mean", "median"), group_value = NULL, label_n = 20, label_genes = c("top", "all", "none"), display_id = NULL, line_length = 0.02, line_width = 0.6, filter_chrom = NULL, log_transform = TRUE, value_label = "log2(mean expr)" )
x |
A |
txdb |
A TxDb object (e.g., from GenomicFeatures). |
keytype |
Key type in the TxDb matching |
id_column |
Optional column in |
genes |
Optional character vector of gene IDs to label (alternative to
|
sample_group |
Optional character vector of groups (from |
group_column |
Optional column name in |
value_column |
Optional column in |
value_from |
Source for |
value_assay |
Assay name to pull values from when |
facet_value_columns |
Ignored (kept for compatibility); multiple
|
side_by_side_groups |
Logical; when plotting multiple |
paginate |
Logical; when |
panels_per_page |
Maximum number of panels per page when |
summarise_replicates |
Logical; when |
summarise_method |
|
group_value |
Optional group label (from |
label_n |
Integer; number of genes with the largest absolute values to
label when |
label_genes |
One of |
display_id |
Optional column in |
line_length |
Horizontal half-length (in megabases) of the tick used to
mark each gene position. Default |
line_width |
Line width of the tick marks. Default |
filter_chrom |
Optional character vector of chromosomes to keep (e.g.,
|
log_transform |
Logical; when |
value_label |
Optional legend title override for the colour scale. |
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 all
value_columns appear sequentially. Legends for each column are shown only
on the first occurrence (at the bottom) to avoid overlap. Requires
patchwork; otherwise a list of plots is returned.
Set side_by_side_groups = TRUE to place selected groups/samples in
separate columns for each chromosome (same-row comparison).
paginate = TRUE automatically splits large panel collections into a list
of patchwork pages, which prevents "viewport too small" rendering errors in
IDE plot panes.
For value_from = "assay", colours follow the VISTA ecosystem: group
colours are used when summarise_replicates = TRUE, while sample colours
are derived from group colours when plotting individual replicates.
For value_from = "assay" with value_column = NULL, all selected
assay columns are used (samples after sample_group filtering, or groups
after replicate summarisation).
Labels are kept consistent across value_columns: if genes is provided
it is used for all panels; otherwise the top label_n (by absolute
value in the first value_column) are used for all panels.
When value_from = "assay", the specified assay column is copied into
rowData on the fly so it can be used for colouring.
When group_value is provided (and no value_column), colouring is based
on log2 mean expression for that group (assay norm_counts), using a
data-driven colour scale. Ignored when value_column is supplied.
A ggplot2 object or a list of ggplot2 objects when multiple
value_columns are provided and patchwork is unavailable.
v <- example_vista() p <- try(get_expression_chromosome_plot(v), silent = TRUE) if (!inherits(p, 'try-error')) print(p)v <- example_vista() p <- try(get_expression_chromosome_plot(v), silent = TRUE) if (!inherits(p, 'try-error')) print(p)
Shows expression distributions pooled across the selected genes, coloured by group (or sample), with optional faceting by group or sample.
get_expression_density( x, genes = NULL, sample_group = NULL, group_column = NULL, log_transform = TRUE, facet_scales = "free", facet_nrow = NULL, facet_ncol = NULL, alpha = 0.4, adjust = 1, color_by = c("group", "sample"), facet_by = c("none", "group", "sample"), sample_order = c("input", "group", "expression"), palette = NULL, colors = NULL )get_expression_density( x, genes = NULL, sample_group = NULL, group_column = NULL, log_transform = TRUE, facet_scales = "free", facet_nrow = NULL, facet_ncol = NULL, alpha = 0.4, adjust = 1, color_by = c("group", "sample"), facet_by = c("none", "group", "sample"), sample_order = c("input", "group", "expression"), palette = NULL, colors = NULL )
x |
A |
genes |
Optional character vector of genes to display. Defaults to all genes. |
sample_group |
Optional character vector specifying which groups (as defined by |
group_column |
Optional column name in |
log_transform |
Logical; apply log2(x + 1) transform before plotting. |
facet_scales |
Facet scales argument passed to |
facet_nrow, facet_ncol
|
Optional layout passed to |
alpha |
Numeric transparency for density fill. |
adjust |
Bandwidth adjustment factor passed to |
color_by |
Either |
facet_by |
One of |
sample_order |
Ordering for sample-level display: |
palette |
Optional qualitative palette name used when generating colours. |
colors |
Optional named character vector of manual colours overriding
|
A ggplot2 object.
v <- example_vista() genes <- head(rownames(v), 3) p <- get_expression_density(v, genes = genes) print(p)v <- example_vista() genes <- head(rownames(v), 3) p <- get_expression_density(v, genes = genes) print(p)
Summarizes expression for selected genes/groups via ComplexHeatmap
with optional transformations and annotations. With only a VISTA
object, the function will plot the top variable genes across all samples.
get_expression_heatmap( x, genes = NULL, top_n = 50, sample_group = NULL, group_column = NULL, value_transform = c("zscore", "log2", "raw"), summarise_replicates = TRUE, summarise_method = c("mean", "median"), convert_rowmeans = FALSE, display_id = NULL, display_from = NULL, display_orgdb = NULL, repair_genes = FALSE, show_row_names = NULL, label_size = 10, label_specific_rows = NULL, label_specific_rows_gp = grid::gpar(fontsize = 5), show_column_names = TRUE, cluster_rows = TRUE, show_row_dend = TRUE, cluster_columns = TRUE, kmeans_k = NULL, annotate_columns = FALSE, cluster_by = NULL, column_anno_palette = "Dark 3", column_anno_colors = NULL, color_default = TRUE, col = NULL, heatmap_name = NULL, show_heatmap_legend = TRUE, return_type = c("heatmap", "clusters", "both"), ... )get_expression_heatmap( x, genes = NULL, top_n = 50, sample_group = NULL, group_column = NULL, value_transform = c("zscore", "log2", "raw"), summarise_replicates = TRUE, summarise_method = c("mean", "median"), convert_rowmeans = FALSE, display_id = NULL, display_from = NULL, display_orgdb = NULL, repair_genes = FALSE, show_row_names = NULL, label_size = 10, label_specific_rows = NULL, label_specific_rows_gp = grid::gpar(fontsize = 5), show_column_names = TRUE, cluster_rows = TRUE, show_row_dend = TRUE, cluster_columns = TRUE, kmeans_k = NULL, annotate_columns = FALSE, cluster_by = NULL, column_anno_palette = "Dark 3", column_anno_colors = NULL, color_default = TRUE, col = NULL, heatmap_name = NULL, show_heatmap_legend = TRUE, return_type = c("heatmap", "clusters", "both"), ... )
x |
A |
genes |
Optional character vector of gene identifiers to display. When omitted, VISTA selects the top variable genes across the included samples. |
top_n |
Integer number of genes to select automatically when
|
sample_group |
Character vector of group labels specifying which samples to include (based on the selected grouping column). |
group_column |
Optional column name in |
value_transform |
One of |
summarise_replicates |
Logical; average replicates per group before plotting when |
summarise_method |
|
convert_rowmeans |
Logical; subtract row means prior to plotting. |
display_id |
Optional ID/column name to use for row labels. If supplied |
display_from |
Optional source ID type for mapping (used when |
display_orgdb |
Optional |
repair_genes |
Logical; if |
show_row_names |
Logical; display row names (genes) beside the heatmap.
When |
label_size |
Numeric font size for row names. |
label_specific_rows |
Optional character vector of row names to highlight via |
label_specific_rows_gp |
|
show_column_names |
Logical; draw column names when |
cluster_rows |
Logical; cluster rows when drawing the heatmap. |
show_row_dend |
Logical; display the row dendrogram. |
cluster_columns |
Logical; cluster columns. |
kmeans_k |
Optional integer specifying the number of k-means clusters to compute for rows. |
annotate_columns |
Logical or character vector. |
cluster_by |
Optional annotation column used to split/cluster columns.
Defaults to the first annotation column when |
column_anno_palette |
Qualitative palette name used for the column annotation. |
column_anno_colors |
Optional named list of annotation color vectors. Each element should be a named character vector keyed by the levels of one annotation column. |
color_default |
Logical; use the default blue-white-red palette when |
col |
Optional |
heatmap_name |
Optional legend title. |
show_heatmap_legend |
Logical; display the heatmap legend. |
return_type |
|
... |
Additional arguments passed to |
An object returned by this function.
A ComplexHeatmap object, a cluster data frame, or a list containing
both depending on return_type.
v <- example_vista() genes <- head(rownames(v), 20) if (requireNamespace('ComplexHeatmap', quietly = TRUE) && requireNamespace('circlize', quietly = TRUE)) { hm <- get_expression_heatmap( v, genes = genes, sample_group = unique(as.character(sample_info(v)$cond_long)), return_type = 'heatmap' ) ComplexHeatmap::draw(hm) } v <- example_vista() if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("circlize", quietly = TRUE)) { hm <- get_expression_heatmap(v, return_type = "heatmap") ComplexHeatmap::draw(hm) }v <- example_vista() genes <- head(rownames(v), 20) if (requireNamespace('ComplexHeatmap', quietly = TRUE) && requireNamespace('circlize', quietly = TRUE)) { hm <- get_expression_heatmap( v, genes = genes, sample_group = unique(as.character(sample_info(v)$cond_long)), return_type = 'heatmap' ) ComplexHeatmap::draw(hm) } v <- example_vista() if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("circlize", quietly = TRUE)) { hm <- get_expression_heatmap(v, return_type = "heatmap") ComplexHeatmap::draw(hm) }
Shows per-group (or per-sample) expression distributions pooled across the selected genes using ridge (joy) plots. Genes are pooled; no faceting to keep shapes comparable.
get_expression_joyplot( x, genes = NULL, sample_group = NULL, group_column = NULL, log_transform = TRUE, alpha = 0.7, scale = 1.2, y_by = c("group", "sample"), color_by = c("group", "sample"), sample_order = c("input", "group", "expression"), palette = NULL, colors = NULL )get_expression_joyplot( x, genes = NULL, sample_group = NULL, group_column = NULL, log_transform = TRUE, alpha = 0.7, scale = 1.2, y_by = c("group", "sample"), color_by = c("group", "sample"), sample_order = c("input", "group", "expression"), palette = NULL, colors = NULL )
x |
A |
genes |
Optional character vector of genes to display. Defaults to all genes. |
sample_group |
Optional character vector specifying which groups (as defined by |
group_column |
Optional column name in |
log_transform |
Logical; apply log2(x + 1) transform before plotting. |
alpha |
Numeric transparency for fills. |
scale |
Numeric scaling factor for ridges (passed to |
y_by |
Either |
color_by |
Either |
sample_order |
Ordering for sample-level display: |
palette |
Optional qualitative palette name used when generating colours. |
colors |
Optional named character vector of manual colours overriding
|
A ggplot2 object.
v <- example_vista() genes <- head(rownames(v), 3) p <- get_expression_joyplot(v, genes = genes) print(p)v <- example_vista() genes <- head(rownames(v), 3) p <- get_expression_joyplot(v, genes = genes) print(p)
Plots normalized expression for selected genes across samples or summarized groups with optional transformations and group faceting.
get_expression_lineplot( x, genes = NULL, sample_group = NULL, group_column = NULL, log_transform = TRUE, display_id = NULL, display_from = NULL, display_orgdb = NULL, facet_scales = "free_y", facet_nrow = NULL, facet_ncol = NULL, stats_group = FALSE, p.label = "p.signif", comparisons = NULL, pool_genes = FALSE, by = c("sample", "group"), facet_by = c("auto", "group", "gene", "none"), fill_by = NULL, sample_order = c("input", "group", "expression"), value_transform = NULL, palette = NULL, colors = NULL, line_width = 1, point_size = 2, base_size = 12 )get_expression_lineplot( x, genes = NULL, sample_group = NULL, group_column = NULL, log_transform = TRUE, display_id = NULL, display_from = NULL, display_orgdb = NULL, facet_scales = "free_y", facet_nrow = NULL, facet_ncol = NULL, stats_group = FALSE, p.label = "p.signif", comparisons = NULL, pool_genes = FALSE, by = c("sample", "group"), facet_by = c("auto", "group", "gene", "none"), fill_by = NULL, sample_order = c("input", "group", "expression"), value_transform = NULL, palette = NULL, colors = NULL, line_width = 1, point_size = 2, base_size = 12 )
x |
A |
genes |
Character vector of gene identifiers to plot. |
sample_group |
Optional character vector specifying which groups (values taken from |
group_column |
Optional column name in |
log_transform |
Logical; log2-transform expression values before plotting. |
display_id |
Optional ID/column name to use for gene labels. If supplied
and present in |
display_from |
Optional source ID type for mapping (reserved for compatibility with other expression plotting APIs). |
display_orgdb |
Optional |
facet_scales |
Scaling option passed to |
facet_nrow, facet_ncol
|
Optional layout passed to |
stats_group |
Logical retained for API consistency. Statistical overlays
are not currently added by |
p.label |
Label format retained for API consistency with other expression plots. |
comparisons |
Optional list of comparisons retained for API consistency. |
pool_genes |
Logical; when |
by |
Plot unit: |
facet_by |
Faceting mode: |
fill_by |
Argument retained for API consistency; ignored because line plots use colour rather than fill. |
sample_order |
Ordering used for sample-level plots: |
value_transform |
Deprecated compatibility alias for transformation
choice; one of |
palette |
Optional qualitative palette name used for gene colours. |
colors |
Optional named character vector of manual gene colours. |
line_width |
Line width. |
point_size |
Point size. |
base_size |
Base theme size. |
An object returned by this function.
v <- example_vista() genes <- head(rownames(v), 3) p <- get_expression_lineplot(v, genes = genes) print(p)v <- example_vista() genes <- head(rownames(v), 3) p <- get_expression_lineplot(v, genes = genes) print(p)
Displays selected genes as stem-and-dot (lollipop) plots. By default,
expression is summarized per group (mean across replicates). With
by = "sample", the plot shows individual samples.
get_expression_lollipop( x, genes, sample_group = NULL, group_column = NULL, by = c("group", "sample"), sample_order = c("input", "group", "expression"), facet_by = c("auto", "gene", "none"), log_transform = TRUE, facet_scale = "free_y", facet_nrow = NULL, facet_ncol = NULL, point_size = 6, line_size = 1.2, label = TRUE, label_digits = 1, display_id = NULL, display_from = NULL, display_orgdb = NULL )get_expression_lollipop( x, genes, sample_group = NULL, group_column = NULL, by = c("group", "sample"), sample_order = c("input", "group", "expression"), facet_by = c("auto", "gene", "none"), log_transform = TRUE, facet_scale = "free_y", facet_nrow = NULL, facet_ncol = NULL, point_size = 6, line_size = 1.2, label = TRUE, label_digits = 1, display_id = NULL, display_from = NULL, display_orgdb = NULL )
x |
A |
genes |
Character vector (<=15 genes) to plot. |
sample_group |
Optional character vector of groups (from |
group_column |
Optional column name in |
by |
One of |
sample_order |
Ordering used when |
facet_by |
Faceting mode: |
log_transform |
Logical; log2-transform expression before plotting. |
facet_scale |
Scaling option passed to |
facet_nrow, facet_ncol
|
Optional layout passed to |
point_size |
Numeric size of the dots. |
line_size |
Numeric size of the stems. |
label |
Logical; draw numeric labels above the dots. |
label_digits |
Integer; digits to show in labels when |
display_id |
Optional ID/column name to use for labels/facets. If supplied
and present in |
display_from |
Optional source ID type for mapping (used when |
display_orgdb |
Optional |
An object returned by this function.
A ggplot2 object.
v <- example_vista() genes <- head(rownames(v), 5) p <- get_expression_lollipop(v, genes = genes) print(p) data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) genes <- rownames(vista)[seq_len(3)] get_expression_lollipop(vista, genes = genes) get_expression_lollipop(vista, genes = genes[seq_len(2)], by = "sample")v <- example_vista() genes <- head(rownames(v), 5) p <- get_expression_lollipop(v, genes = genes) print(p) data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) genes <- rownames(vista)[seq_len(3)] get_expression_lollipop(vista, genes = genes) get_expression_lollipop(vista, genes = genes[seq_len(2)], by = "sample")
Returns the specified assay (default "norm_counts") with optional gene/sample
subsetting, replicate summarization by group, and simple transformations.
get_expression_matrix( x, assay_name = "norm_counts", genes = NULL, sample_names = NULL, group_column = NULL, summarise = FALSE, transform = c("none", "log2", "zscore") )get_expression_matrix( x, assay_name = "norm_counts", genes = NULL, sample_names = NULL, group_column = NULL, summarise = FALSE, transform = c("none", "log2", "zscore") )
x |
A |
assay_name |
Assay to extract (default: |
genes |
Optional character vector of gene IDs to keep. |
sample_names |
Optional character vector of sample IDs (or group labels when
|
group_column |
Optional column in |
summarise |
Logical; if |
transform |
One of |
A numeric matrix with genes in rows and samples (or groups) in columns.
v <- example_vista() m <- get_expression_matrix(v) dim(m)v <- example_vista() m <- get_expression_matrix(v) dim(m)
Uses ggrain::geom_rain() to combine a half-violin, boxplot, and jittered
points per sample/group to show distribution, summary, and individual values.
get_expression_raincloud( x, genes = NULL, sample_group = NULL, group_column = NULL, by = "group", value_transform = c("log2", "zscore", "none"), summarise = FALSE, facet_by = c("auto", "gene", "none"), fill_by = NULL, facet_nrow = NULL, facet_ncol = NULL, sample_order = c("input", "group", "expression"), rain_side = c("r", "l", "f", "f1x1", "f2x2"), id.long.var = NULL, alpha = 0.5, point_size = 1.5, p.label = "p.signif", stats_group = FALSE, stats_method = "t.test", label = FALSE, label_column = "gene", label_size = 3, label_max_overlaps = 50, display_id = NULL, display_from = NULL, display_orgdb = NULL )get_expression_raincloud( x, genes = NULL, sample_group = NULL, group_column = NULL, by = "group", value_transform = c("log2", "zscore", "none"), summarise = FALSE, facet_by = c("auto", "gene", "none"), fill_by = NULL, facet_nrow = NULL, facet_ncol = NULL, sample_order = c("input", "group", "expression"), rain_side = c("r", "l", "f", "f1x1", "f2x2"), id.long.var = NULL, alpha = 0.5, point_size = 1.5, p.label = "p.signif", stats_group = FALSE, stats_method = "t.test", label = FALSE, label_column = "gene", label_size = 3, label_max_overlaps = 50, display_id = NULL, display_from = NULL, display_orgdb = NULL )
x |
A |
genes |
Optional character vector of gene IDs to include; defaults to all genes selected by the plotting mode. |
sample_group |
Optional subset of groups (values of |
group_column |
Grouping column in |
by |
Plot unit. Violin plots currently support only |
value_transform |
Deprecated compatibility alias. |
summarise |
Logical; when |
facet_by |
Faceting mode. Uses the same argument pattern as
|
fill_by |
Fill mapping. Uses the same values as
|
facet_nrow, facet_ncol
|
Optional layout passed to |
sample_order |
Ordering for sample-level display before values are grouped into violins. |
rain_side |
Side specification passed to |
id.long.var |
Optional column name passed to |
alpha |
Alpha for jittered points. |
point_size |
Point size for jittered points. |
p.label |
Label type passed to |
stats_group |
Logical; add pairwise statistical tests when |
stats_method |
Statistical method passed to |
label |
Logical; add text labels to points using |
label_column |
Column name in the plotting data used for labels.
Defaults to |
label_size |
Text size for point labels. |
label_max_overlaps |
Maximum overlaps passed to |
display_id |
Optional ID/column name to use for labels. If supplied and
present in |
display_from |
Optional source ID type for mapping (used when
|
display_orgdb |
Optional |
id.long.var controls which repeated unit is connected by lines in
ggrain::geom_rain().
Recommended usage for expression raincloud plots:
id.long.var = NULL (default): best for clean distribution summaries.
id.long.var = "gene": best when plotting a small number of genes and
showing gene-level trajectories across x levels.
id.long.var = "<subject_id_column>": best for paired/repeated-measure
designs when a subject ID exists in sample_info.
id.long.var = "sample" or the grouping variable is usually less
informative and can over-connect points.
Point labels (label = TRUE) work best with facet_by = "none" or
a small number of genes.
For identifier display consistency with other VISTA plotting functions, set
display_id (for example, "SYMBOL"). When provided, genes can be given
in that ID space, and default point labels use the mapped display IDs.
A ggplot2 object.
v <- example_vista() genes <- head(rownames(v), 5) p <- get_expression_raincloud(v, genes = genes, summarise = TRUE) print(p)v <- example_vista() genes <- head(rownames(v), 5) p <- get_expression_raincloud(v, genes = genes, summarise = TRUE) print(p)
Plots gene-level expression for two selected samples or group means, colours points by local density (viridis), labels the most divergent genes, and reports Pearson/Spearman correlation.
get_expression_scatter( x, sample_x, sample_y, by = c("sample", "group"), group_column = NULL, genes = NULL, log_transform = TRUE, label_n = 20, label_size = 3, method = c("pearson", "spearman"), display_id = NULL )get_expression_scatter( x, sample_x, sample_y, by = c("sample", "group"), group_column = NULL, genes = NULL, log_transform = TRUE, label_n = 20, label_size = 3, method = c("pearson", "spearman"), display_id = NULL )
x |
A |
sample_x |
First sample or group to plot (character scalar). |
sample_y |
Second sample or group to plot (character scalar). |
by |
One of |
group_column |
Column in |
genes |
Optional character vector of genes to include; defaults to all. |
log_transform |
Logical; apply log2(x + 1) transform. Default |
label_n |
Integer; number of most divergent genes to label (ranked by |x - y|). Set to 0 to disable labels. |
label_size |
Numeric size for labeled genes. |
method |
Correlation method for the subtitle; |
display_id |
Optional column in |
A ggplot2 object.
v <- example_vista() si <- as.data.frame(sample_info(v)) genes <- head(rownames(v), 50) p <- get_expression_scatter( v, sample_x = si$sample_names[1], sample_y = si$sample_names[2], genes = genes ) print(p)v <- example_vista() si <- as.data.frame(sample_info(v)) genes <- head(rownames(v), 50) p <- get_expression_scatter( v, sample_x = si$sample_names[1], sample_y = si$sample_names[2], genes = genes ) print(p)
Mirrors the main user-facing arguments of get_expression_boxplot() so the
two geoms can be swapped with minimal code changes. Violin plots currently
keep group-based semantics (by = "group") because a violin requires
replicate-level distributions within groups rather than one value per sample.
get_expression_violinplot( x, genes = NULL, sample_group = NULL, group_column = NULL, log_transform = TRUE, display_id = NULL, display_from = NULL, display_orgdb = NULL, facet_scales = "free_y", facet_nrow = NULL, facet_ncol = NULL, stats_group = FALSE, p.label = "p.signif", comparisons = NULL, pool_genes = FALSE, by = "group", facet_by = c("auto", "gene", "none"), fill_by = NULL, sample_order = c("input", "group", "expression"), value_transform = NULL, summarise = FALSE )get_expression_violinplot( x, genes = NULL, sample_group = NULL, group_column = NULL, log_transform = TRUE, display_id = NULL, display_from = NULL, display_orgdb = NULL, facet_scales = "free_y", facet_nrow = NULL, facet_ncol = NULL, stats_group = FALSE, p.label = "p.signif", comparisons = NULL, pool_genes = FALSE, by = "group", facet_by = c("auto", "gene", "none"), fill_by = NULL, sample_order = c("input", "group", "expression"), value_transform = NULL, summarise = FALSE )
x |
A |
genes |
Optional character vector of gene IDs to include; defaults to all genes selected by the plotting mode. |
sample_group |
Optional subset of groups (values of |
group_column |
Grouping column in |
log_transform |
Logical; log2-transform expression values before plotting. |
display_id |
Optional ID/column name to use for labels/facets. If
supplied and present in |
display_from |
Optional source ID type for mapping (reserved for
compatibility with |
display_orgdb |
Optional |
facet_scales |
Scaling option passed to |
facet_nrow, facet_ncol
|
Optional layout passed to |
stats_group |
Logical; add statistical comparisons between groups when |
p.label |
Label format for |
comparisons |
Optional list of specific group comparisons for |
pool_genes |
Logical; pool all selected genes into one violin per group. |
by |
Plot unit. Violin plots currently support only |
facet_by |
Faceting mode. Uses the same argument pattern as
|
fill_by |
Fill mapping. Uses the same values as
|
sample_order |
Ordering for sample-level display before values are grouped into violins. |
value_transform |
Deprecated compatibility alias. |
summarise |
Logical retained for compatibility. Violin plots always use
replicate-level values, so |
A ggplot2 object.
v <- example_vista() genes <- head(rownames(v), 4) p <- get_expression_violinplot(v, genes = genes) print(p)v <- example_vista() genes <- head(rownames(v), 4) p <- get_expression_violinplot(v, genes = genes) print(p)
Plots log2 fold changes for selected genes across one or more comparisons.
facet_by controls per-gene or per-comparison layout explicitly.
get_foldchange_barplot( x, genes, sample_comparisons = NULL, coord_flip = FALSE, display_id = NULL, display_from = NULL, display_orgdb = NULL, sort_by = c("input", "log2fc", "abs_log2fc"), facet_scales = "free_y", facet_nrow = NULL, facet_ncol = NULL, facet_by = c("auto", "gene", "comparison", "none") )get_foldchange_barplot( x, genes, sample_comparisons = NULL, coord_flip = FALSE, display_id = NULL, display_from = NULL, display_orgdb = NULL, sort_by = c("input", "log2fc", "abs_log2fc"), facet_scales = "free_y", facet_nrow = NULL, facet_ncol = NULL, facet_by = c("auto", "gene", "comparison", "none") )
x |
A |
genes |
Character vector of gene IDs to plot. |
sample_comparisons |
Optional character vector of comparison names to include; defaults to all available. |
coord_flip |
Logical; flip axes when |
display_id |
Optional column in |
display_from |
Optional source ID type for mapping when |
display_orgdb |
Optional |
sort_by |
How to order genes when faceting: |
facet_scales |
Facet scales argument passed to |
facet_nrow, facet_ncol
|
Optional layout passed to |
facet_by |
Faceting mode: |
An object returned by this function.
A ggplot2 object.
v <- example_vista() comp <- names(comparisons(v))[1] genes <- head(as.character(comparisons(v)[[comp]]$gene_id), 10) p <- get_foldchange_barplot(v, sample_comparison = comp, genes = genes) print(p) data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) genes <- rownames(vista)[seq_len(3)] get_foldchange_barplot(vista, genes = genes) get_foldchange_barplot(vista, genes = genes, facet_by = "gene")v <- example_vista() comp <- names(comparisons(v))[1] genes <- head(as.character(comparisons(v)[[comp]]$gene_id), 10) p <- get_foldchange_barplot(v, sample_comparison = comp, genes = genes) print(p) data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) genes <- rownames(vista)[seq_len(3)] get_foldchange_barplot(vista, genes = genes) get_foldchange_barplot(vista, genes = genes, facet_by = "gene")
Builds boxplots of log2 fold changes for selected genes and comparisons, optionally adding statistics.
get_foldchange_boxplot( x, genes = NULL, sample_comparisons = NULL, display_id = NULL, display_from = NULL, display_orgdb = NULL, facet_scales = "free_x", facet_nrow = NULL, facet_ncol = NULL, facet_by = c("auto", "comparison", "none"), p.label = "p.signif", stats_group = FALSE, stats_method = "t.test" )get_foldchange_boxplot( x, genes = NULL, sample_comparisons = NULL, display_id = NULL, display_from = NULL, display_orgdb = NULL, facet_scales = "free_x", facet_nrow = NULL, facet_ncol = NULL, facet_by = c("auto", "comparison", "none"), p.label = "p.signif", stats_group = FALSE, stats_method = "t.test" )
x |
A |
genes |
Optional character vector of gene IDs to include. |
sample_comparisons |
Optional character vector of comparison names to plot. |
display_id |
Optional ID/column name used to interpret |
display_from |
Optional source ID type for mapping when |
display_orgdb |
Optional |
facet_scales |
Facet scales argument passed to |
facet_nrow, facet_ncol
|
Optional layout passed to |
facet_by |
Faceting mode: |
p.label |
Label type passed to |
stats_group |
Logical; add pairwise statistical tests when |
stats_method |
Statistical method passed to |
An object returned by this function.
v <- example_vista() comp <- names(comparisons(v))[1] genes <- head(as.character(comparisons(v)[[comp]]$gene_id), 10) p <- get_foldchange_boxplot(v, sample_comparison = comp, genes = genes) print(p)v <- example_vista() comp <- names(comparisons(v))[1] genes <- head(as.character(comparisons(v)[[comp]]$gene_id), 10) p <- get_foldchange_boxplot(v, sample_comparison = comp, genes = genes) print(p)
Convenience wrapper around get_chromosome_plot() for fold-change colouring.
When multiple comparisons are supplied, panels are facetted by comparison
with log2FC clipped to +/-2.
get_foldchange_chromosome_plot( x, txdb, keytype = "GENEID", id_column = NULL, genes = NULL, sample_comparison = NULL, value_column = NULL, label_n = 20, display_id = NULL, display_from = NULL, display_orgdb = NULL, line_length = 0.02, line_width = 0.6, filter_chrom = NULL )get_foldchange_chromosome_plot( x, txdb, keytype = "GENEID", id_column = NULL, genes = NULL, sample_comparison = NULL, value_column = NULL, label_n = 20, display_id = NULL, display_from = NULL, display_orgdb = NULL, line_length = 0.02, line_width = 0.6, filter_chrom = NULL )
x |
A |
txdb |
A TxDb object (e.g., from GenomicFeatures). |
keytype |
Key type in the TxDb matching |
id_column |
Optional column in |
genes |
Optional character vector of gene IDs to label (alternative to
|
sample_comparison |
Optional comparison name (or vector of names) used for fold-change colouring. |
value_column |
Optional column in |
label_n |
Integer; number of genes with the largest absolute fold-change
to label when |
display_id |
Optional column in |
display_from |
Optional source ID type for mapping when |
display_orgdb |
Optional |
line_length |
Horizontal half-length (in megabases) of the tick used to
mark each gene position. Default |
line_width |
Line width of the tick marks. Default |
filter_chrom |
Optional character vector of chromosomes to keep (e.g.,
|
A ggplot2 object.
v <- example_vista() p <- try(get_foldchange_chromosome_plot(v, sample_comparison = names(comparisons(v))[1]), silent = TRUE) if (!inherits(p, 'try-error')) print(p)v <- example_vista() p <- try(get_foldchange_chromosome_plot(v, sample_comparison = names(comparisons(v))[1]), silent = TRUE) if (!inherits(p, 'try-error')) print(p)
Visualizes log2 fold-change matrices across comparisons with
ComplexHeatmap, supporting clustering and annotations. With only a
VISTA object, the function will plot the top DE genes across the stored
comparisons.
get_foldchange_heatmap( x, sample_comparisons = NULL, genes = NULL, top_n = 10, display_id = NULL, display_from = NULL, display_orgdb = NULL, repair_genes = FALSE, show_row_names = NULL, label_size = 10, label_specific_rows = NULL, label_specific_rows_gp = grid::gpar(fontsize = 5), show_column_names = TRUE, cluster_rows = TRUE, show_row_dend = TRUE, cluster_columns = TRUE, kmeans_k = NULL, annotate_columns = FALSE, column_anno_palette = "Set2", color_default = TRUE, col = NULL, heatmap_name = NULL, show_heatmap_legend = TRUE, return_type = c("heatmap", "clusters", "both"), ... )get_foldchange_heatmap( x, sample_comparisons = NULL, genes = NULL, top_n = 10, display_id = NULL, display_from = NULL, display_orgdb = NULL, repair_genes = FALSE, show_row_names = NULL, label_size = 10, label_specific_rows = NULL, label_specific_rows_gp = grid::gpar(fontsize = 5), show_column_names = TRUE, cluster_rows = TRUE, show_row_dend = TRUE, cluster_columns = TRUE, kmeans_k = NULL, annotate_columns = FALSE, column_anno_palette = "Set2", color_default = TRUE, col = NULL, heatmap_name = NULL, show_heatmap_legend = TRUE, return_type = c("heatmap", "clusters", "both"), ... )
x |
A |
sample_comparisons |
Optional character vector of comparison names to include. Defaults to all available comparisons. |
genes |
Optional character vector of gene identifiers to display. When omitted, VISTA selects the top DE genes from each comparison by absolute log2 fold-change. |
top_n |
Integer number of genes to select per comparison when
|
display_id |
Optional ID/column name to use for plot labels. If supplied |
display_from |
Optional source ID type for mapping (used when |
display_orgdb |
Optional |
repair_genes |
Logical; attempt to simplify |
show_row_names |
Logical; draw row (gene) names. When |
label_size |
Numeric font size for row names. |
label_specific_rows |
Optional character vector of genes to highlight with |
label_specific_rows_gp |
|
show_column_names |
Logical; draw column labels. |
cluster_rows |
Logical; cluster rows. |
show_row_dend |
Logical; display the row dendrogram. |
cluster_columns |
Logical; cluster columns. |
kmeans_k |
Optional integer specifying the number of k-means clusters for rows. |
annotate_columns |
Logical; add annotation bars keyed to the sample grouping column. |
column_anno_palette |
Qualitative palette name used for column annotations. |
color_default |
Logical; use the default diverging palette when |
col |
Optional |
heatmap_name |
Optional legend title. |
show_heatmap_legend |
Logical; display the heatmap legend. |
return_type |
|
... |
Additional arguments forwarded to |
An object returned by this function.
A ComplexHeatmap object, a cluster data frame, or a list containing
both depending on return_type.
v <- example_vista() comp <- names(comparisons(v))[1] genes <- unique(stats::na.omit(as.character(comparisons(v)[[comp]]$gene_id)))[seq_len(20)] if (requireNamespace('ComplexHeatmap', quietly = TRUE) && requireNamespace('circlize', quietly = TRUE)) { hm <- get_foldchange_heatmap( v, sample_comparisons = comp, genes = genes, return_type = 'heatmap' ) ComplexHeatmap::draw(hm) } v <- example_vista() if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("circlize", quietly = TRUE)) { hm <- get_foldchange_heatmap(v, return_type = "heatmap") ComplexHeatmap::draw(hm) }v <- example_vista() comp <- names(comparisons(v))[1] genes <- unique(stats::na.omit(as.character(comparisons(v)[[comp]]$gene_id)))[seq_len(20)] if (requireNamespace('ComplexHeatmap', quietly = TRUE) && requireNamespace('circlize', quietly = TRUE)) { hm <- get_foldchange_heatmap( v, sample_comparisons = comp, genes = genes, return_type = 'heatmap' ) ComplexHeatmap::draw(hm) } v <- example_vista() if (requireNamespace("ComplexHeatmap", quietly = TRUE) && requireNamespace("circlize", quietly = TRUE)) { hm <- get_foldchange_heatmap(v, return_type = "heatmap") ComplexHeatmap::draw(hm) }
Plots log2 fold-change trajectories for selected genes across multiple comparisons, optionally clustering genes.
get_foldchange_lineplot( x, sample_comparisons, genes = NULL, display_id = NULL, display_from = NULL, display_orgdb = NULL, km = NULL, facet_by = c("none", "cluster"), facet_scales = "fixed", facet_nrow = NULL, facet_ncol = NULL, alpha = 0.5, palette = NULL, show_summary = TRUE, summary_color = NULL, summary_linewidth = 1, summary_fun = c("median", "mean"), base_size = 14 )get_foldchange_lineplot( x, sample_comparisons, genes = NULL, display_id = NULL, display_from = NULL, display_orgdb = NULL, km = NULL, facet_by = c("none", "cluster"), facet_scales = "fixed", facet_nrow = NULL, facet_ncol = NULL, alpha = 0.5, palette = NULL, show_summary = TRUE, summary_color = NULL, summary_linewidth = 1, summary_fun = c("median", "mean"), base_size = 14 )
x |
A |
sample_comparisons |
Character vector of comparison names to include. |
genes |
Optional character vector of gene identifiers to plot. Defaults to all genes. |
display_id |
Optional ID/column name used to interpret |
display_from |
Optional source ID type for mapping when |
display_orgdb |
Optional |
km |
Optional integer specifying the number of k-means clusters to compute; |
facet_by |
Faceting mode: |
facet_scales |
Facet scales argument passed to |
facet_nrow, facet_ncol
|
Optional layout passed to |
alpha |
Numeric alpha applied to individual gene lines. |
palette |
Optional named or unnamed color vector used for cluster lines. |
show_summary |
Logical; overlay a summary line per cluster when |
summary_color |
Color used for the summary line. When |
summary_linewidth |
Numeric line width for the summary line. |
summary_fun |
Character string selecting |
base_size |
Numeric base theme size. |
An object returned by this function.
A list with plot (the ggplot2 object) and clustered_data
(gene-to-cluster assignments).
v <- example_vista() comp <- names(comparisons(v))[1] genes <- head(as.character(comparisons(v)[[comp]]$gene_id), 5) p <- get_foldchange_lineplot(v, sample_comparison = comp, genes = genes) print(p)v <- example_vista() comp <- names(comparisons(v))[1] genes <- head(as.character(comparisons(v)[[comp]]$gene_id), 5) p <- get_foldchange_lineplot(v, sample_comparison = comp, genes = genes) print(p)
One-stop doc for fold-change plots:
get_foldchange_barplot(): log2FC by comparison (bars).
get_foldchange_boxplot(): log2FC distributions per comparison (boxes).
get_foldchange_lollipop(): log2FC stems/dots; supports 1–2 comparisons.
get_foldchange_lineplot(): log2FC trajectories across comparisons (optional clustering).
get_foldchange_lollipop( x, sample_comparison, genes = NULL, sort_by = c("input", "log2fc", "abs_log2fc"), palette = NULL, point_size = 6, line_size = 1.2, label = TRUE, label_digits = 2, display_id = NULL, display_from = NULL, display_orgdb = NULL, dodge_width = 0.5, facet_scales = "free_y", facet_nrow = NULL, facet_ncol = NULL, facet_by = c("auto", "gene", "comparison", "none") )get_foldchange_lollipop( x, sample_comparison, genes = NULL, sort_by = c("input", "log2fc", "abs_log2fc"), palette = NULL, point_size = 6, line_size = 1.2, label = TRUE, label_digits = 2, display_id = NULL, display_from = NULL, display_orgdb = NULL, dodge_width = 0.5, facet_scales = "free_y", facet_nrow = NULL, facet_ncol = NULL, facet_by = c("auto", "gene", "comparison", "none") )
x |
A |
sample_comparison |
Character vector of length 1 or 2 naming the
comparison(s) to plot (must exist in |
genes |
Optional character vector of gene IDs to include. When |
sort_by |
How to sort genes on the y-axis: |
palette |
For a single comparison, named vector of colors for |
point_size |
Numeric size of dots. |
line_size |
Numeric size of stems (linewidth). |
label |
Logical; draw numeric labels next to the dots. |
label_digits |
Integer; digits to show in labels when |
display_id |
Optional column in |
display_from |
Optional source ID type for mapping when |
display_orgdb |
Optional |
dodge_width |
Horizontal separation between comparisons when plotting two comparisons on the same axis. |
facet_scales |
Facet scales argument passed to |
facet_nrow, facet_ncol
|
Optional layout passed to |
facet_by |
Faceting mode: |
Shared arguments: x (VISTA with DE results), sample_comparisons/sample_comparison,
genes, display_id for label mapping, sort_by (where supported),
faceting controls (facet_*), and comparison colours pulled from
Plot log2 fold changes as a lollipop chart (one or two comparisons)
Extracts log2 fold changes from stored differential expression results and plots them as stems and dots, with labels and a zero reference line. You can optionally provide two comparisons; in that case both comparisons are drawn side-by-side, coloured by comparison.
An object returned by this function.
A ggplot2 object.
v <- example_vista() comp <- names(comparisons(v))[1] genes <- head(as.character(comparisons(v)[[comp]]$gene_id), 10) p <- get_foldchange_lollipop(v, sample_comparison = comp, genes = genes) print(p) vista <- example_vista() comp_name <- names(comparisons(vista))[1] genes <- rownames(vista)[seq_len(3)] get_foldchange_lollipop(vista, sample_comparison = comp_name, genes = genes)v <- example_vista() comp <- names(comparisons(v))[1] genes <- head(as.character(comparisons(v)[[comp]]$gene_id), 10) p <- get_foldchange_lollipop(v, sample_comparison = comp, genes = genes) print(p) vista <- example_vista() comp_name <- names(comparisons(vista))[1] genes <- rownames(vista)[seq_len(3)] get_foldchange_lollipop(vista, sample_comparison = comp_name, genes = genes)
Returns a gene-by-comparison matrix of log2 fold changes stored in a VISTA object.
get_foldchange_matrix(x, sample_comparisons = NULL, genes = NULL)get_foldchange_matrix(x, sample_comparisons = NULL, genes = NULL)
x |
A VISTA object containing differential expression results. |
sample_comparisons |
Optional character vector of comparison names. Defaults to all available comparisons. |
genes |
Optional character vector of gene identifiers. When omitted, all genes present in |
A numeric matrix with genes in rows and comparisons in columns.
v <- example_vista() mat <- get_foldchange_matrix(v) dim(mat)v <- example_vista() mat <- get_foldchange_matrix(v) dim(mat)
Uses ggrain::geom_rain() to display log2 fold-change distributions for
selected comparisons, with optional statistical testing across comparisons.
get_foldchange_raincloud( x, genes = NULL, sample_comparisons = NULL, facet_scales = "free_x", facet_nrow = NULL, facet_ncol = NULL, facet_by = c("auto", "comparison", "none"), rain_side = c("r", "l", "f", "f1x1", "f2x2"), id.long.var = NULL, alpha = 0.5, point_size = 1.5, p.label = "p.signif", stats_group = FALSE, stats_method = "t.test", label = FALSE, label_column = "gene_id", label_size = 3, label_max_overlaps = 50, display_id = NULL, display_from = NULL, display_orgdb = NULL )get_foldchange_raincloud( x, genes = NULL, sample_comparisons = NULL, facet_scales = "free_x", facet_nrow = NULL, facet_ncol = NULL, facet_by = c("auto", "comparison", "none"), rain_side = c("r", "l", "f", "f1x1", "f2x2"), id.long.var = NULL, alpha = 0.5, point_size = 1.5, p.label = "p.signif", stats_group = FALSE, stats_method = "t.test", label = FALSE, label_column = "gene_id", label_size = 3, label_max_overlaps = 50, display_id = NULL, display_from = NULL, display_orgdb = NULL )
x |
A |
genes |
Optional character vector of gene IDs to include. |
sample_comparisons |
Optional character vector of comparison names to plot. |
facet_scales |
Facet scales argument passed to |
facet_nrow, facet_ncol
|
Optional layout passed to |
facet_by |
Faceting mode: |
rain_side |
Side specification passed to |
id.long.var |
Optional column name passed to |
alpha |
Alpha for jittered points. |
point_size |
Point size for jittered points. |
p.label |
Label type passed to |
stats_group |
Logical; add pairwise statistical tests when |
stats_method |
Statistical method passed to |
label |
Logical; add text labels to points using |
label_column |
Column name in the plotting data used for labels.
Defaults to |
label_size |
Text size for point labels. |
label_max_overlaps |
Maximum overlaps passed to |
display_id |
Optional ID/column name to use for labels. If supplied and
present in |
display_from |
Optional source ID type for mapping (used when
|
display_orgdb |
Optional |
id.long.var controls which repeated unit is connected by lines in
ggrain::geom_rain().
Recommended usage for fold-change raincloud plots:
id.long.var = NULL (default): best for clean distribution summaries.
id.long.var = "gene_id": most useful option; connects each gene
across comparisons.
id.long.var = "comparison" is generally not useful because
comparison is already on the x-axis.
Continuous value columns (e.g. log2FoldChange) are not suitable
identifiers for line connections.
Point labels (label = TRUE) work best with facet_by = "none"
unless only a small set of genes is shown.
For identifier display consistency with other VISTA plotting functions, set
display_id (for example, "SYMBOL"). When provided, genes can be given
in that ID space, and default point labels use the mapped display IDs.
A ggplot2 object.
v <- example_vista() comp <- names(comparisons(v))[1] genes <- head(as.character(comparisons(v)[[comp]]$gene_id), 20) p <- get_foldchange_raincloud(v, sample_comparison = comp, genes = genes) print(p)v <- example_vista() comp <- names(comparisons(v))[1] genes <- head(as.character(comparisons(v)[[comp]]$gene_id), 20) p <- get_foldchange_raincloud(v, sample_comparison = comp, genes = genes) print(p)
Plots log2 fold changes from two stored comparisons against each other, with
points coloured by concordant/discordant regulation based on the cutoffs
saved in the VISTA object.
get_foldchange_scatter( x, sample_comparisons, genes = NULL, display_id = NULL, display_from = NULL, display_orgdb = NULL, label_n = 0, alpha = 0.5, geometry = c("point", "hex"), method = c("pearson", "spearman"), colors = c(`Up/Up` = "#1b9e77", `Down/Down` = "#7570b3", `Up/Down` = "#d95f02", `Down/Up` = "#e7298a", Other = "grey70"), point_size = 1.5, label_size = 3, base_size = 12 )get_foldchange_scatter( x, sample_comparisons, genes = NULL, display_id = NULL, display_from = NULL, display_orgdb = NULL, label_n = 0, alpha = 0.5, geometry = c("point", "hex"), method = c("pearson", "spearman"), colors = c(`Up/Up` = "#1b9e77", `Down/Down` = "#7570b3", `Up/Down` = "#d95f02", `Down/Up` = "#e7298a", Other = "grey70"), point_size = 1.5, label_size = 3, base_size = 12 )
x |
A |
sample_comparisons |
Character vector of length 2 naming the comparisons. |
genes |
Optional character vector of gene identifiers used to subset the comparison overlap before plotting. |
display_id |
Optional ID/column name used to interpret |
display_from |
Optional source ID type for mapping when |
display_orgdb |
Optional |
label_n |
Integer; number of most extreme points to label (by |log2FC1| + |log2FC2|). |
alpha |
Point transparency. |
geometry |
Geometry used for the data layer: |
method |
Correlation method for the subtitle; |
colors |
Named vector of concordance colours. |
point_size |
Point size used when |
label_size |
Text size for labeled genes. |
base_size |
Base theme size. |
Points are coloured by concordance status using fixed colours:
Up/Up = #1b9e77
Down/Down = #7570b3
Up/Down = #d95f02
Down/Up = #e7298a
Other = grey70
Regulation is derived from the log2fc and pval cutoffs stored in
cutoffs(x) (and p_value_type from the same list, defaulting to "padj").
A ggplot2 object.
## Not run: data('count_data', package = 'VISTA') data('sample_metadata', package = 'VISTA') cell_levels <- unique(sample_metadata$cell) if (length(cell_levels) >= 3) { v <- create_vista(count_data[seq_len(150), ], sample_metadata, column_geneid = 'gene_id', group_column = 'cell', group_numerator = cell_levels[2:3], group_denominator = rep(cell_levels[1], 2), min_counts = 5, min_replicates = 1) comp_names <- names(comparisons(v))[seq_len(2)] p <- get_foldchange_scatter(v, sample_comparisons = comp_names) print(p) } ## End(Not run)## Not run: data('count_data', package = 'VISTA') data('sample_metadata', package = 'VISTA') cell_levels <- unique(sample_metadata$cell) if (length(cell_levels) >= 3) { v <- create_vista(count_data[seq_len(150), ], sample_metadata, column_geneid = 'gene_id', group_column = 'cell', group_numerator = cell_levels[2:3], group_denominator = rep(cell_levels[1], 2), min_counts = 5, min_replicates = 1) comp_names <- names(comparisons(v))[seq_len(2)] p <- get_foldchange_scatter(v, sample_comparisons = comp_names) print(p) } ## End(Not run)
Extract gene IDs by regulation class from selected comparisons in a VISTA object.
get_genes_by_regulation( x, sample_comparisons, regulation = "Both", top_n = NULL, display_id = NULL, return_type = c("list", "table") )get_genes_by_regulation( x, sample_comparisons, regulation = "Both", top_n = NULL, display_id = NULL, return_type = c("list", "table") )
x |
A VISTA object. |
sample_comparisons |
Character vector of comparison names to include. |
regulation |
One of "Up", "Down", "Both", or "All" (default: "Both"). |
top_n |
Optional integer limiting each comparison to the top DE genes ranked by absolute log2 fold change after regulation filtering. |
display_id |
Optional column name in |
return_type |
Either |
A named list of character vectors (one per comparison) when
return_type = "list", or a named list of data frames when
return_type = "table".
v <- example_vista() comp <- names(comparisons(v))[1] genes <- get_genes_by_regulation(v, sample_comparisons = comp, regulation = 'Up', top_n = 20) str(genes, max.level = 1)v <- example_vista() comp <- names(comparisons(v))[1] genes <- get_genes_by_regulation(v, sample_comparisons = comp, regulation = 'Up', top_n = 20) str(genes, max.level = 1)
Run GO enrichment directly from a VISTA comparison
get_go_enrichment( x, sample_comparison, regulation = c("Up", "Down", "Both", "All"), ont = c("BP", "MF", "CC"), from_type = "SYMBOL", orgdb = NULL, species = "Mus musculus", background = NULL, ... )get_go_enrichment( x, sample_comparison, regulation = c("Up", "Down", "Both", "All"), ont = c("BP", "MF", "CC"), from_type = "SYMBOL", orgdb = NULL, species = "Mus musculus", background = NULL, ... )
x |
A |
sample_comparison |
Comparison name to use. |
regulation |
One of |
ont |
GO ontology: |
from_type |
Identifier type in the DE tables (default |
orgdb |
OrgDb object; defaults to mouse/human based on |
species |
Species name to infer default OrgDb. |
background |
Optional background gene set; default uses all features. |
... |
Passed to |
A list with enrich containing an enrichResult.
## Not run: v <- example_vista() comp <- names(comparisons(v))[1] if (requireNamespace('org.Mm.eg.db', quietly = TRUE)) { out <- try(get_go_enrichment(v, sample_comparison = comp, ont = 'BP', from_type = 'ENSEMBL', orgdb = org.Mm.eg.db::org.Mm.eg.db), silent = TRUE) if (!inherits(out, 'try-error')) out } ## End(Not run)## Not run: v <- example_vista() comp <- names(comparisons(v))[1] if (requireNamespace('org.Mm.eg.db', quietly = TRUE)) { out <- try(get_go_enrichment(v, sample_comparison = comp, ont = 'BP', from_type = 'ENSEMBL', orgdb = org.Mm.eg.db::org.Mm.eg.db), silent = TRUE) if (!inherits(out, 'try-error')) out } ## End(Not run)
Gene set enrichment analysis (GSEA) from a VISTA comparison
get_gsea( x, sample_comparison, set_type = c("msigdb", "go", "kegg"), from_type = "SYMBOL", orgdb = NULL, species = "Mus musculus", msigdb_category = "H", msigdb_subcategory = NULL, ... )get_gsea( x, sample_comparison, set_type = c("msigdb", "go", "kegg"), from_type = "SYMBOL", orgdb = NULL, species = "Mus musculus", msigdb_category = "H", msigdb_subcategory = NULL, ... )
x |
A |
sample_comparison |
Comparison name to use. |
set_type |
One of |
from_type |
Identifier type in the DE tables (default |
orgdb |
OrgDb object; defaults to mouse/human based on |
species |
Species name to infer default OrgDb. |
msigdb_category, msigdb_subcategory
|
Passed to |
... |
Additional arguments forwarded to the underlying GSEA function:
|
An object returned by this function.
## Not run: v <- example_vista() comp <- names(comparisons(v))[1] if (requireNamespace('msigdbr', quietly = TRUE)) { out <- try(get_gsea(v, sample_comparison = comp, set_type = 'msigdb', from_type = 'ENSEMBL', species = 'Homo sapiens'), silent = TRUE) if (!inherits(out, 'try-error')) out } ## End(Not run)## Not run: v <- example_vista() comp <- names(comparisons(v))[1] if (requireNamespace('msigdbr', quietly = TRUE)) { out <- try(get_gsea(v, sample_comparison = comp, set_type = 'msigdb', from_type = 'ENSEMBL', species = 'Homo sapiens'), silent = TRUE) if (!inherits(out, 'try-error')) out } ## End(Not run)
Run KEGG enrichment directly from a VISTA comparison
get_kegg_enrichment( x, sample_comparison, regulation = c("Up", "Down", "Both", "All"), from_type = "SYMBOL", orgdb = NULL, species = "Mus musculus", kegg_species = NULL, background = NULL, ... )get_kegg_enrichment( x, sample_comparison, regulation = c("Up", "Down", "Both", "All"), from_type = "SYMBOL", orgdb = NULL, species = "Mus musculus", kegg_species = NULL, background = NULL, ... )
x |
A |
sample_comparison |
Comparison name to use. |
regulation |
One of |
from_type |
Identifier type in the DE tables (default |
orgdb |
OrgDb object; defaults to mouse/human based on |
species |
Species name to infer default OrgDb. |
kegg_species |
KEGG organism code (e.g., |
background |
Optional background gene set; default uses all features. |
... |
Passed to |
An object returned by this function.
v <- example_vista() comp <- names(comparisons(v))[1] if (requireNamespace('org.Mm.eg.db', quietly = TRUE)) { out <- try(get_kegg_enrichment(v, sample_comparison = comp, from_type = 'ENSEMBL', orgdb = org.Mm.eg.db::org.Mm.eg.db), silent = TRUE) if (!inherits(out, 'try-error')) out }v <- example_vista() comp <- names(comparisons(v))[1] if (requireNamespace('org.Mm.eg.db', quietly = TRUE)) { out <- try(get_kegg_enrichment(v, sample_comparison = comp, from_type = 'ENSEMBL', orgdb = org.Mm.eg.db::org.Mm.eg.db), silent = TRUE) if (!inherits(out, 'try-error')) out }
Create an MA plot (log2 fold change vs mean expression) for a selected comparison contained in a VISTA object. Genes are coloured by their regulation class and the top results can be optionally labeled with gene IDs.
get_ma_plot( x, sample_comparison, point_size = 1.2, alpha = 0.6, colors = c(Up = "#a40000", Down = "#16317d", Other = "gray70"), label_n = 0, label_size = 3, repair_genes = FALSE, display_id = NULL, display_from = NULL, display_orgdb = NULL )get_ma_plot( x, sample_comparison, point_size = 1.2, alpha = 0.6, colors = c(Up = "#a40000", Down = "#16317d", Other = "gray70"), label_n = 0, label_size = 3, repair_genes = FALSE, display_id = NULL, display_from = NULL, display_orgdb = NULL )
x |
A VISTA object. |
sample_comparison |
Character scalar naming the comparison to plot. Must match
one of |
point_size |
Numeric point size. Default: 1.2. |
alpha |
Numeric transparency (0-1). Default: 0.6. |
colors |
Named character vector of colors for |
label_n |
Integer number of genes to label. Default: 0. |
label_size |
Text size for labels. Default: 3. |
repair_genes |
Logical; if |
display_id |
Optional ID/column name to use for labels. If supplied and
present in |
display_from |
Optional source ID type for mapping (used when
|
display_orgdb |
Optional |
A ggplot MA plot.
v <- example_vista() p <- get_ma_plot(v, sample_comparison = names(comparisons(v))[1]) print(p)v <- example_vista() p <- get_ma_plot(v, sample_comparison = names(comparisons(v))[1]) print(p)
Runs classical multidimensional scaling on normalized counts, optionally restricting to groups or genes.
get_mds_plot( x, sample_group = NULL, group_column = NULL, genes = NULL, top_n_genes = NULL, label = FALSE, label_size = 3, point_size = 10, shape_by = NULL, shape_values = NULL, color_by = NULL, use_vista_colors = NULL, palette = NULL, colors = NULL, use_group_colors = TRUE )get_mds_plot( x, sample_group = NULL, group_column = NULL, genes = NULL, top_n_genes = NULL, label = FALSE, label_size = 3, point_size = 10, shape_by = NULL, shape_values = NULL, color_by = NULL, use_vista_colors = NULL, palette = NULL, colors = NULL, use_group_colors = TRUE )
x |
A |
sample_group |
Optional character vector of groups to include (based on the column specified by |
group_column |
Optional column name in |
genes |
Optional character vector of gene identifiers to restrict the matrix. |
top_n_genes |
Optional integer selecting the top variable genes to include. |
label |
Logical; draw sample labels when |
label_size |
Numeric size of sample labels when |
point_size |
Numeric size for points. |
shape_by |
Optional column name in |
shape_values |
Optional vector of shapes passed to |
color_by |
Optional column name in |
use_vista_colors |
Deprecated alias for |
palette |
Optional qualitative palette name used when generating colours for non-group metadata levels. |
colors |
Optional named character vector of manual colours overriding
both |
use_group_colors |
Logical; when |
An object returned by this function.
v <- example_vista() p <- get_mds_plot(v) print(p)v <- example_vista() p <- get_mds_plot(v) print(p)
Convenience wrapper that pulls regulated genes from a stored differential
expression comparison in a VISTA object and runs enrichMsigDB() on them.
get_msigdb_enrichment( x, sample_comparison, regulation = c("Up", "Down", "Both", "All"), from_type = "SYMBOL", orgdb, msigdb_category = "H", msigdb_subcategory = NULL, species = "Mus musculus", background = NULL, col_genetype = "GENETYPE", feature_type = "protein-coding", ... )get_msigdb_enrichment( x, sample_comparison, regulation = c("Up", "Down", "Both", "All"), from_type = "SYMBOL", orgdb, msigdb_category = "H", msigdb_subcategory = NULL, species = "Mus musculus", background = NULL, col_genetype = "GENETYPE", feature_type = "protein-coding", ... )
x |
A |
sample_comparison |
Character scalar naming the comparison to use. |
regulation |
One of |
from_type |
Identifier type of the genes in the DE table (passed to
|
orgdb |
An |
msigdb_category |
MSigDB category (e.g., |
msigdb_subcategory |
Optional MSigDB sub-collection. Default |
species |
Species name for MSigDB (default |
background |
Optional background gene set (passed to |
col_genetype |
Column in |
feature_type |
Gene type to retain in the background when filtering. Default |
... |
Additional arguments forwarded to |
A list with enrich containing an enrichResult.
if (requireNamespace("msigdbr", quietly = TRUE)) { vista <- example_vista() comp <- names(comparisons(vista))[1] msig <- get_msigdb_enrichment( vista, sample_comparison = comp, regulation = "Both", msigdb_category = "H", from_type = "ENSEMBL" ) class(msig$enrich) } # Create VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) comp <- names(comparisons(vista))[1] # Run MSigDB enrichment on upregulated genes msig_up <- get_msigdb_enrichment( vista, sample_comparison = comp, regulation = "Up", msigdb_category = "H", # Hallmark gene sets from_type = "ENSEMBL" ) if (!is.null(msig_up$enrich)) { # View results head(msig_up$enrich) # Visualize enrichment get_enrichment_plot(msig_up$enrich) } # Enrichment for downregulated genes msig_down <- get_msigdb_enrichment( vista, sample_comparison = comp, regulation = "Down", msigdb_category = "C2" # Curated gene sets )if (requireNamespace("msigdbr", quietly = TRUE)) { vista <- example_vista() comp <- names(comparisons(vista))[1] msig <- get_msigdb_enrichment( vista, sample_comparison = comp, regulation = "Both", msigdb_category = "H", from_type = "ENSEMBL" ) class(msig$enrich) } # Create VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) comp <- names(comparisons(vista))[1] # Run MSigDB enrichment on upregulated genes msig_up <- get_msigdb_enrichment( vista, sample_comparison = comp, regulation = "Up", msigdb_category = "H", # Hallmark gene sets from_type = "ENSEMBL" ) if (!is.null(msig_up$enrich)) { # View results head(msig_up$enrich) # Visualize enrichment get_enrichment_plot(msig_up$enrich) } # Enrichment for downregulated genes msig_down <- get_msigdb_enrichment( vista, sample_comparison = comp, regulation = "Down", msigdb_category = "C2" # Curated gene sets )
Uses GGally::ggpairs on normalized expression to display correlations among samples from selected groups/genes.
get_pairwise_corr_plot( x, sample_group = NULL, group_column = NULL, genes = NULL, sample_order = c("input", "group"), value_transform = c("log2", "none"), title = "Pairwise Sample Correlations" )get_pairwise_corr_plot( x, sample_group = NULL, group_column = NULL, genes = NULL, sample_order = c("input", "group"), value_transform = c("log2", "none"), title = "Pairwise Sample Correlations" )
x |
A |
sample_group |
Optional character vector of groups (from the column specified by |
group_column |
Optional column name in |
genes |
Optional character vector of gene IDs to include; defaults to all genes. |
sample_order |
Ordering for selected samples: |
value_transform |
Value transformation: |
title |
Plot title. |
An object returned by this function.
v <- example_vista() p <- get_pairwise_corr_plot(v) print(p)v <- example_vista() p <- get_pairwise_corr_plot(v) print(p)
Parses pathway-level gene members from an enrichment result and returns either a long table, pathway-indexed list, or a unique vector of genes.
get_pathway_genes( x, pathways = NULL, top_n = 10, pathway_column = c("Description", "ID"), gene_column = c("auto", "geneID", "core_enrichment"), gene_sep = "/", return_type = c("long", "list", "vector") )get_pathway_genes( x, pathways = NULL, top_n = 10, pathway_column = c("Description", "ID"), gene_column = c("auto", "geneID", "core_enrichment"), gene_sep = "/", return_type = c("long", "list", "vector") )
x |
An |
pathways |
Optional character vector of pathway names to keep. Matches
against |
top_n |
Number of top pathways to use when |
pathway_column |
Which enrichment column to match pathway names against:
|
gene_column |
Which column stores pathway members. |
gene_sep |
Delimiter used in pathway gene strings (default |
return_type |
One of |
Depending on return_type:
"long": data frame with pathway_id, pathway, and gene.
"list": named list of character vectors (genes per pathway).
"vector": unique character vector of genes.
if (requireNamespace("msigdbr", quietly = TRUE)) { vista <- example_vista() msig <- get_msigdb_enrichment( vista, sample_comparison = names(comparisons(vista))[1], regulation = "Both", msigdb_category = "H", from_type = "ENSEMBL" ) pathway_tbl <- get_pathway_genes(msig, top_n = 5, return_type = "long") head(pathway_tbl) } data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data, sample_info = sample_metadata, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) msig <- get_msigdb_enrichment( vista, sample_comparison = names(comparisons(vista))[1], regulation = "Up", species = "Homo sapiens", from_type = "ENSEMBL" ) pathway_tbl <- get_pathway_genes(msig, top_n = 5, return_type = "long") head(pathway_tbl)if (requireNamespace("msigdbr", quietly = TRUE)) { vista <- example_vista() msig <- get_msigdb_enrichment( vista, sample_comparison = names(comparisons(vista))[1], regulation = "Both", msigdb_category = "H", from_type = "ENSEMBL" ) pathway_tbl <- get_pathway_genes(msig, top_n = 5, return_type = "long") head(pathway_tbl) } data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data, sample_info = sample_metadata, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) msig <- get_msigdb_enrichment( vista, sample_comparison = names(comparisons(vista))[1], regulation = "Up", species = "Homo sapiens", from_type = "ENSEMBL" ) pathway_tbl <- get_pathway_genes(msig, top_n = 5, return_type = "long") head(pathway_tbl)
This wrapper bridges enrichment results and expression heatmaps. It extracts
genes from selected pathways (via get_pathway_genes()), maps them to the
VISTA feature IDs, and forwards to get_expression_heatmap().
get_pathway_heatmap( x, enrichment, sample_group = NULL, pathways = NULL, top_n = 5, pathway_column = c("Description", "ID"), gene_column = c("auto", "geneID", "core_enrichment"), gene_sep = "/", gene_mode = c("union", "intersection"), gene_id_column = NULL, max_genes = NULL, return_type = c("heatmap", "both", "genes"), ... )get_pathway_heatmap( x, enrichment, sample_group = NULL, pathways = NULL, top_n = 5, pathway_column = c("Description", "ID"), gene_column = c("auto", "geneID", "core_enrichment"), gene_sep = "/", gene_mode = c("union", "intersection"), gene_id_column = NULL, max_genes = NULL, return_type = c("heatmap", "both", "genes"), ... )
x |
A |
enrichment |
An |
sample_group |
Character vector of group labels to include (same semantics as
|
pathways |
Optional pathway names to include. When |
top_n |
Number of top pathways used when |
pathway_column |
Pathway matching column, |
gene_column |
Pathway gene-member column. |
gene_sep |
Delimiter used to parse pathway gene strings (default |
gene_mode |
How to combine pathway genes for plotting: |
gene_id_column |
Optional column in |
max_genes |
Optional cap on the number of genes passed to the heatmap. |
return_type |
One of |
... |
Additional arguments passed to |
Depending on return_type:
"heatmap": a ComplexHeatmap object from get_expression_heatmap().
"both": list with heatmap, genes, and pathway_genes.
"genes": character vector of mapped genes selected for plotting.
if (requireNamespace("msigdbr", quietly = TRUE)) { vista <- example_vista() msig <- get_msigdb_enrichment( vista, sample_comparison = names(comparisons(vista))[1], regulation = "Both", msigdb_category = "H", from_type = "ENSEMBL" ) genes <- get_pathway_heatmap( vista, enrichment = msig, sample_group = c("control", "treatment1"), top_n = 3, return_type = "genes" ) head(genes) } data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data, sample_info = sample_metadata, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) msig <- get_msigdb_enrichment( vista, sample_comparison = names(comparisons(vista))[1], regulation = "Up", species = "Homo sapiens", from_type = "ENSEMBL" ) get_pathway_heatmap( vista, enrichment = msig, sample_group = c("control", "treatment1"), top_n = 3, value_transform = "zscore", annotate_columns = TRUE, summarise_replicates = FALSE )if (requireNamespace("msigdbr", quietly = TRUE)) { vista <- example_vista() msig <- get_msigdb_enrichment( vista, sample_comparison = names(comparisons(vista))[1], regulation = "Both", msigdb_category = "H", from_type = "ENSEMBL" ) genes <- get_pathway_heatmap( vista, enrichment = msig, sample_group = c("control", "treatment1"), top_n = 3, return_type = "genes" ) head(genes) } data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data, sample_info = sample_metadata, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) msig <- get_msigdb_enrichment( vista, sample_comparison = names(comparisons(vista))[1], regulation = "Up", species = "Homo sapiens", from_type = "ENSEMBL" ) get_pathway_heatmap( vista, enrichment = msig, sample_group = c("control", "treatment1"), top_n = 3, value_transform = "zscore", annotate_columns = TRUE, summarise_replicates = FALSE )
Uses normalized counts to compute principal components and plot samples, optionally restricting to selected groups or genes.
get_pca_plot( x, sample_group = NULL, group_column = NULL, genes = NULL, top_n_genes = NULL, label = FALSE, label_size = 3, point_size = 10, shape_by = NULL, shape_values = NULL, sample.seed = 123, show_clusters = FALSE, color_by = NULL, use_vista_colors = NULL, palette = NULL, colors = NULL, use_group_colors = TRUE )get_pca_plot( x, sample_group = NULL, group_column = NULL, genes = NULL, top_n_genes = NULL, label = FALSE, label_size = 3, point_size = 10, shape_by = NULL, shape_values = NULL, sample.seed = 123, show_clusters = FALSE, color_by = NULL, use_vista_colors = NULL, palette = NULL, colors = NULL, use_group_colors = TRUE )
x |
A |
sample_group |
Optional character vector of group labels (taken from the column specified by
|
group_column |
Optional column name in |
genes |
Optional character vector of gene identifiers to restrict the PCA input matrix.
When |
top_n_genes |
Optional integer selecting the top most variable genes to include. Ignored
when |
label |
Logical; if |
label_size |
Numeric size of sample labels when |
point_size |
Numeric size of the plotted points. |
shape_by |
Optional column name in |
shape_values |
Optional vector of shapes passed to |
sample.seed |
Deprecated/unused; retained for backward compatibility. |
show_clusters |
Logical; add normal ellipses per group when |
color_by |
Optional column name in |
use_vista_colors |
Deprecated alias for |
palette |
Optional qualitative palette name used when generating colours for non-group metadata levels. |
colors |
Optional named character vector of manual colours overriding
both |
use_group_colors |
Logical; when |
A ggplot object showing the first two PCs.
# Create VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) # Basic PCA plot get_pca_plot(vista) # With sample labels get_pca_plot(vista, label = TRUE) # Using top variable genes get_pca_plot(vista, top_n_genes = 100) # With confidence ellipses get_pca_plot(vista, show_clusters = TRUE)# Create VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(200), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) # Basic PCA plot get_pca_plot(vista) # With sample labels get_pca_plot(vista, label = TRUE) # Using top variable genes get_pca_plot(vista, top_n_genes = 100) # With confidence ellipses get_pca_plot(vista, show_clusters = TRUE)
Runs UMAP on normalized counts, optionally restricting to selected groups or genes. UMAP is intended for exploratory sample-level structure.
get_umap_plot( x, sample_group = NULL, group_column = NULL, color_by = NULL, genes = NULL, top_n_genes = NULL, label = FALSE, label_size = 3, point_size = 10, shape_by = NULL, shape_values = NULL, n_neighbors = 15, min_dist = 0.1, metric = "euclidean", seed = 123, use_vista_colors = NULL, palette = NULL, colors = NULL, use_group_colors = TRUE )get_umap_plot( x, sample_group = NULL, group_column = NULL, color_by = NULL, genes = NULL, top_n_genes = NULL, label = FALSE, label_size = 3, point_size = 10, shape_by = NULL, shape_values = NULL, n_neighbors = 15, min_dist = 0.1, metric = "euclidean", seed = 123, use_vista_colors = NULL, palette = NULL, colors = NULL, use_group_colors = TRUE )
x |
A |
sample_group |
Optional character vector of groups to include (based on
|
group_column |
Optional column name in |
color_by |
Optional column name in |
genes |
Optional character vector of gene identifiers to restrict the matrix. |
top_n_genes |
Optional integer selecting top variable genes to include. |
label |
Logical; draw sample labels when |
label_size |
Numeric label size when |
point_size |
Numeric point size. |
shape_by |
Optional column name in |
shape_values |
Optional vector passed to |
n_neighbors |
UMAP |
min_dist |
UMAP |
metric |
UMAP distance metric. |
seed |
Integer random seed passed to UMAP. |
use_vista_colors |
Deprecated alias for |
palette |
Optional qualitative palette name used when generating colours for non-group metadata levels. |
colors |
Optional named character vector of manual colours overriding
both |
use_group_colors |
Logical; when |
A ggplot object with UMAP1/UMAP2 coordinates.
if (requireNamespace("uwot", quietly = TRUE)) { vista <- example_vista() get_umap_plot(vista, top_n_genes = 50) }if (requireNamespace("uwot", quietly = TRUE)) { vista <- example_vista() get_umap_plot(vista, top_n_genes = 50) }
Wraps EnhancedVolcano to visualize log2FC vs p-values for a selected comparison.
get_volcano_plot( x, sample_comparison, log2fc_cutoff = 1, pval_cutoff = 0.05, label_genes = NULL, label_size = 3, point_size = 1, colors = c(Up = "#a40000", Down = "#007e2f", Other = "grey"), repair_genes = TRUE, display_id = NULL, display_from = NULL, display_orgdb = NULL, ... )get_volcano_plot( x, sample_comparison, log2fc_cutoff = 1, pval_cutoff = 0.05, label_genes = NULL, label_size = 3, point_size = 1, colors = c(Up = "#a40000", Down = "#007e2f", Other = "grey"), repair_genes = TRUE, display_id = NULL, display_from = NULL, display_orgdb = NULL, ... )
x |
A |
sample_comparison |
Character scalar naming the comparison to display. |
log2fc_cutoff |
Numeric absolute log2 fold-change threshold used to color significant points. |
pval_cutoff |
Numeric p-value threshold used to color significant points. |
label_genes |
Optional character vector of gene identifiers to force-label. |
label_size |
Numeric label text size. |
point_size |
Numeric point size. |
colors |
Named colour vector with entries for |
repair_genes |
Logical; when |
display_id |
Optional ID/column name to use for plot labels. If supplied
and present in |
display_from |
Optional source ID type for mapping (used when |
display_orgdb |
Optional |
... |
Additional parameters forwarded to |
A ggplot2 object.
vista <- example_vista() comps <- names(comparisons(vista)) get_volcano_plot(vista, sample_comparison = comps[1]) # Create VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data, sample_info = sample_metadata, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) # Basic volcano plot comps <- names(comparisons(vista)) get_volcano_plot(vista, sample_comparison = comps[1]) # With custom thresholds get_volcano_plot( vista, sample_comparison = comps[1], log2fc_cutoff = 1.5, pval_cutoff = 0.01 ) # Highlight specific genes genes_of_interest <- rownames(vista)[seq_len(5)] get_volcano_plot( vista, sample_comparison = comps[1], label_genes = genes_of_interest )vista <- example_vista() comps <- names(comparisons(vista)) get_volcano_plot(vista, sample_comparison = comps[1]) # Create VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data, sample_info = sample_metadata, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) # Basic volcano plot comps <- names(comparisons(vista)) get_volcano_plot(vista, sample_comparison = comps[1]) # With custom thresholds get_volcano_plot( vista, sample_comparison = comps[1], log2fc_cutoff = 1.5, pval_cutoff = 0.01 ) # Highlight specific genes genes_of_interest <- rownames(vista)[seq_len(5)] get_volcano_plot( vista, sample_comparison = comps[1], label_genes = genes_of_interest )
match_vista_inputs() aligns standardized counts and sample metadata so they
can be passed directly to create_vista(). It accepts the raw output from
read_vista_counts() or a count data frame/matrix plus sample metadata.
match_vista_inputs( counts, sample_info, column_geneid = NULL, sample_column = NULL, reorder = TRUE, drop_unmatched = FALSE, verbose = TRUE )match_vista_inputs( counts, sample_info, column_geneid = NULL, sample_column = NULL, reorder = TRUE, drop_unmatched = FALSE, verbose = TRUE )
counts |
Standardized counts from |
sample_info |
Sample metadata from |
column_geneid |
Optional gene identifier column for raw tabular counts.
Ignored when |
sample_column |
Optional sample identifier column in |
reorder |
Logical; if |
drop_unmatched |
Logical; if |
verbose |
Logical; print an informational alignment summary. |
A list with standardized counts, aligned sample_info,
column_geneid, sample_names, sample_name_map, row_data, and a small report.
data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") cnt <- read_vista_counts( count_data[seq_len(25), ], format = "matrix", gene_id_column = "gene_id", verbose = FALSE ) si <- read_vista_metadata( sample_metadata[sample_metadata$sample_names %in% cnt$sample_names, ], verbose = FALSE ) matched <- match_vista_inputs(cnt, si, verbose = FALSE) matched$column_geneid identical(matched$sample_info$sample_names, colnames(matched$counts)[-1])data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") cnt <- read_vista_counts( count_data[seq_len(25), ], format = "matrix", gene_id_column = "gene_id", verbose = FALSE ) si <- read_vista_metadata( sample_metadata[sample_metadata$sample_names %in% cnt$sample_names, ], verbose = FALSE ) matched <- match_vista_inputs(cnt, si, verbose = FALSE) matched$column_geneid identical(matched$sample_info$sample_names, colnames(matched$counts)[-1])
Forwards to SummarizedExperiment's show() so the output is identical to a
plain SE. Invisibly returns x.
## S3 method for class 'VISTA' print(x, ...)## S3 method for class 'VISTA' print(x, ...)
x |
A VISTA object. |
... |
Ignored. |
The input object x, returned invisibly.
v <- example_vista() print(v)v <- example_vista() print(v)
read_vista_counts() helps standardize common RNA-seq count inputs into a
count table that can be passed directly to create_vista(). It supports
plain matrices/data frames, featureCounts outputs, STAR gene counts,
HTSeq-count outputs, tximport-like lists, and RSEM gene result files.
read_vista_counts( x, format = c("auto", "matrix", "featurecounts", "star", "htseq", "tximport", "rsem"), gene_id_column = NULL, sample_columns = NULL, sample_names = NULL, annotation_columns = NULL, count_column = NULL, tx2gene = NULL, counts_from = c("counts", "abundance", "length"), drop_technical = TRUE, remove_special_rows = TRUE, make_unique_ids = FALSE, repair_sample_names = c("auto", "none"), return_type = c("list", "data.frame", "matrix"), verbose = TRUE )read_vista_counts( x, format = c("auto", "matrix", "featurecounts", "star", "htseq", "tximport", "rsem"), gene_id_column = NULL, sample_columns = NULL, sample_names = NULL, annotation_columns = NULL, count_column = NULL, tx2gene = NULL, counts_from = c("counts", "abundance", "length"), drop_technical = TRUE, remove_special_rows = TRUE, make_unique_ids = FALSE, repair_sample_names = c("auto", "none"), return_type = c("list", "data.frame", "matrix"), verbose = TRUE )
x |
Count input. Supported values depend on |
format |
Input format. One of |
gene_id_column |
Optional gene identifier column in tabular inputs.
When omitted, VISTA uses common names such as |
sample_columns |
Optional character vector of sample count columns to retain from tabular inputs. |
sample_names |
Optional sample names to use when |
annotation_columns |
Optional feature annotation columns to retain in the
returned |
count_column |
Optional count column selector for formats that expose
multiple count choices. For STAR, use one of |
tx2gene |
Optional two-column mapping used to summarize transcript-level tximport-like inputs to genes. The first column should contain transcript IDs and the second column gene IDs. |
counts_from |
Which matrix to extract from a tximport-like input:
|
drop_technical |
Logical; when |
remove_special_rows |
Logical; alias for |
make_unique_ids |
Logical; if |
repair_sample_names |
Strategy for repairing sample column names.
Repaired names are only applied when they remain non-empty and unique.
Otherwise VISTA keeps the original count column names and records the
unchanged mapping in |
return_type |
Return |
verbose |
Logical; print an informational import summary. |
Internally, VISTA uses a format-specific importer for each supported input type, then normalizes the result into a common structure with:
a count table with a gene_id column plus sample columns
optional feature metadata in row_data
sample names inferred from columns or file names
an auditable sample_name_map showing original and repaired names
If return_type = "list", a list with:
A standardized count table with gene_id plus sample columns.
Feature metadata aligned to the count table.
Always "gene_id" for the standardized output.
Sample columns in the standardized count table.
A two-column mapping of original and repaired sample names.
Resolved import format.
Basic import summary.
If return_type = "data.frame", returns the standardized count table. If
return_type = "matrix", returns a numeric matrix with gene IDs as rownames.
data("count_data", package = "VISTA") cnt <- read_vista_counts( count_data[seq_len(25), ], format = "matrix", gene_id_column = "gene_id" ) head(cnt$counts[, seq_len(4)]) cnt$sample_namesdata("count_data", package = "VISTA") cnt <- read_vista_counts( count_data[seq_len(25), ], format = "matrix", gene_id_column = "gene_id" ) head(cnt$counts[, seq_len(4)]) cnt$sample_names
read_vista_metadata() standardizes a sample sheet for use as
sample_info in create_vista(). It infers or creates the required
sample_names column using the same conventions VISTA already accepts in the
constructor.
read_vista_metadata( x, sample_column = NULL, required_columns = NULL, drop_empty = TRUE, standardize_names = TRUE, verbose = TRUE )read_vista_metadata( x, sample_column = NULL, required_columns = NULL, drop_empty = TRUE, standardize_names = TRUE, verbose = TRUE )
x |
Sample metadata as a data frame or file path. |
sample_column |
Optional column to use as |
required_columns |
Optional character vector of columns that must be present after import. |
drop_empty |
Logical; if |
standardize_names |
Logical; if |
verbose |
Logical; print an informational import summary. |
A data frame suitable for use as sample_info in create_vista().
data("sample_metadata", package = "VISTA") si <- read_vista_metadata(sample_metadata[seq_len(6), ]) head(si$sample_names)data("sample_metadata", package = "VISTA") si <- read_vista_metadata(sample_metadata[seq_len(6), ]) head(si$sample_names)
Estimates cell-type proportions in bulk RNA-seq using single-cell reference or xCell2.
run_cell_deconvolution( x, method = c("xCell2"), single_cell_reference = NULL, reference_labels = NULL, gene_id_type = c("auto", "symbol", "ensembl", "ensembl_symbol"), xcell2_reference = NULL, xcell2_min_shared_genes = NULL, transform = c("log2", "raw"), ... )run_cell_deconvolution( x, method = c("xCell2"), single_cell_reference = NULL, reference_labels = NULL, gene_id_type = c("auto", "symbol", "ensembl", "ensembl_symbol"), xcell2_reference = NULL, xcell2_min_shared_genes = NULL, transform = c("log2", "raw"), ... )
x |
A VISTA object. |
method |
Deconvolution method. Currently only |
single_cell_reference |
Reserved for future reference-based methods (ignored). |
reference_labels |
Reserved for future reference-based methods (ignored). |
gene_id_type |
Type of gene identifiers: |
xcell2_reference |
Optional xCell2 reference object or dataset name
(e.g., |
xcell2_min_shared_genes |
Optional numeric shortcut for xCell2's
|
transform |
Expression transformation: "log2" or "raw". |
... |
Additional arguments passed to the specific method. |
VISTA object with cell_fractions added to metadata.
v <- example_vista() if (requireNamespace('xCell2', quietly = TRUE)) { out <- try(run_cell_deconvolution(v, method = 'xCell2'), silent = TRUE) if (!inherits(out, 'try-error')) out }v <- example_vista() if (requireNamespace('xCell2', quietly = TRUE)) { out <- try(run_cell_deconvolution(v, method = 'xCell2'), silent = TRUE) if (!inherits(out, 'try-error')) out }
These functions encapsulate the standard RNA-seq analysis workflow using
DESeq2 (run_deseq_analysis), edgeR (run_edger_analysis), or
limma-voom (run_limma_analysis), including:
gene filtering, design matrix setup, normalization, model fitting, differential testing,
DEG classification ("Up", "Down", "Other"), and result formatting.
Both methods return output in a harmonized structure ready for downstream use in create_vista or standalone DEG summaries.
run_deseq_analysis( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, covariates = NULL, design_formula = NULL, min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "padj" ) run_edger_analysis( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, covariates = NULL, design_formula = NULL, min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "FDR" ) run_limma_analysis( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, covariates = NULL, design_formula = NULL, min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "FDR" )run_deseq_analysis( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, covariates = NULL, design_formula = NULL, min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "padj" ) run_edger_analysis( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, covariates = NULL, design_formula = NULL, min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "FDR" ) run_limma_analysis( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, covariates = NULL, design_formula = NULL, min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "FDR" )
counts |
A data frame or matrix of raw counts with one gene per row.
Must include a column defined by |
sample_info |
A data frame with sample metadata. Must contain |
column_geneid |
A string identifying the column name containing gene identifiers. |
group_column |
The name of the column in |
group_numerator |
A character vector of numerator group(s) for fold-change comparisons. |
group_denominator |
A character vector of denominator group(s) for fold-change comparisons. |
covariates |
Optional character vector of additional sample_info columns to adjust for. |
design_formula |
Optional model formula (or formula string). When provided,
it overrides automatic design construction from |
min_counts |
Minimum total read count across all samples to retain a gene. Default: |
min_replicates |
Minimum number of replicates within each group that must exceed |
log2fc_cutoff |
Absolute log2 fold-change threshold to define DEGs. Default: |
pval_cutoff |
P-value or adjusted p-value cutoff for significance. Default: |
p_value_type |
For DESeq2: one of |
Perform differential expression (DE) analysis across multiple group comparisons
using DESeq2, edgeR, or limma-voom. These functions process raw count data,
normalize it, execute pairwise group-level tests, and return standardized DEG outputs
compatible with VISTA-based visualization and analysis.
For DESeq2, normalization is performed via DESeq, and DE testing uses results.
For edgeR, normalization uses calcNormFactors, and testing uses glmLRT.
For limma, normalization uses calcNormFactors + voom, and testing uses eBayes.
Low-abundance filtering is applied before model fitting.
Gene regulation status is determined via .categorize_deg_results() based on user thresholds.
All output comparison results are internally standardized via .tidy_de_results() to ensure
a uniform column schema compatible with VISTA plotting tools.
A named list with components:
norm_counts: Matrix of normalized expression values
(CPM for edgeR/limma, DESeq2-normalized counts).
sample_info: Updated sample metadata.
row_data: Gene-level metadata, including mean expression.
comparisons: Named list of DEG result tibbles (one per comparison), each containing
standardized columns: gene_id, log2fc, pvalue, p.adj, and regulation.
deg_summary: List of summary tables showing DEG regulation counts.
create_vista, DESeq, glmLRT, voom
v <- example_vista() si <- as.data.frame(sample_info(v)) data("count_data", package = "VISTA") counts_small <- count_data[seq_len(200), c("gene_id", si$sample_names), drop = FALSE] limma_results <- run_limma_analysis( counts = counts_small, sample_info = si, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", min_counts = 5, min_replicates = 1 ) names(limma_results$comparisons)v <- example_vista() si <- as.data.frame(sample_info(v)) data("count_data", package = "VISTA") counts_small <- count_data[seq_len(200), c("gene_id", si$sample_names), drop = FALSE] limma_results <- run_limma_analysis( counts = counts_small, sample_info = si, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", min_counts = 5, min_replicates = 1 ) names(limma_results$comparisons)
Builds a VISTA object (or uses a precomputed one), computes a comprehensive
single-comparison analysis panel, exports publication assets, and renders an
automated Quarto HTML/PDF report from YAML-driven parameters.
run_vista_report(config, output_file = "vista-report.html")run_vista_report(config, output_file = "vista-report.html")
config |
Path to a YAML config file (see template at
|
output_file |
Optional output filename overriding |
The report focuses on one differential comparison (primary_comparison) and
includes:
QC plots (PCA, MDS, correlation heatmap),
DE plots (volcano, MA, DEG bar/pie/donut summaries),
expression-focused views (boxplot, fold-change barplot, expression heatmap),
enrichment outputs (MSigDB/GO/KEGG when available),
downloadable artifacts (tables + plots + optional zip bundle),
interactive HTML tables via DT when installed.
Invisibly, the normalized output report path.
## Not run: data('count_data', package = 'VISTA') data('sample_metadata', package = 'VISTA') cfg <- list( counts = count_data[seq_len(100), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = 'gene_id', group_column = 'cond_long', group_numerator = 'treatment1', group_denominator = 'control', include_msigdb = FALSE, include_go = FALSE, include_kegg = FALSE ) if (requireNamespace('quarto', quietly = TRUE)) { out <- tempfile(fileext = '.html') try(run_vista_report(cfg, output_file = out), silent = TRUE) } ## End(Not run)## Not run: data('count_data', package = 'VISTA') data('sample_metadata', package = 'VISTA') cfg <- list( counts = count_data[seq_len(100), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = 'gene_id', group_column = 'cond_long', group_numerator = 'treatment1', group_denominator = 'control', include_msigdb = FALSE, include_go = FALSE, include_kegg = FALSE ) if (requireNamespace('quarto', quietly = TRUE)) { out <- tempfile(fileext = '.html') try(run_vista_report(cfg, output_file = out), silent = TRUE) } ## End(Not run)
Metadata describing each column in count_data, including friendly sample
names and the experimental group assignment used throughout the vignettes and
tests.
data(sample_metadata)data(sample_metadata)
A tibble with 8 rows and 13 columns:
Character identifiers matching the column names in
count_data.
Group labels used in examples ("control", "treatment1").
Long-form condition labels ("control", "treatment1").
Short-form condition labels ("CTRL", "TREAT1").
Original sample label from the airway colData.
Original airway treatment labels ("untrt"/"trt").
Donor/cell-line identifiers from airway.
Original airway albuterol indicator.
SRA run identifier (also copied into sample_names).
Average transcript length metadata from airway.
SRA experiment accession from airway.
SRA sample accession from airway.
NCBI BioSample accession from airway.
Derived from the airway Bioconductor dataset.
Exports selected data components from a VISTA object to CSV/TSV/RDS/XLSX.
save_vista_data( x, what = c("comparison", "comparisons", "norm_counts", "sample_info", "row_data", "deg_summary", "cutoffs"), file, sample_comparison = NULL, format = NULL, include_rownames = TRUE )save_vista_data( x, what = c("comparison", "comparisons", "norm_counts", "sample_info", "row_data", "deg_summary", "cutoffs"), file, sample_comparison = NULL, format = NULL, include_rownames = TRUE )
x |
A |
what |
Character vector specifying which object(s) to export. Supported
values are |
file |
Output file path. |
sample_comparison |
Optional comparison name used when |
format |
Output format. One of |
include_rownames |
Logical; include meaningful row identifiers (e.g., gene IDs or sample names) as explicit columns where applicable. |
Invisibly, the normalized output file path.
v <- example_vista() save_vista_data(v, what = "comparison", file = tempfile(fileext = ".csv"), format = "csv")v <- example_vista() save_vista_data(v, what = "comparison", file = tempfile(fileext = ".csv"), format = "csv")
Saves plot objects returned by VISTA plotting functions to file. Supports
both ggplot-like objects (saved via ggplot2::ggsave()) and
ComplexHeatmap objects (Heatmap / HeatmapList) saved via graphics
devices.
save_vista_plot( plot, file, width = 8, height = 6, units = "in", dpi = 300, device = NULL, ... )save_vista_plot( plot, file, width = 8, height = 6, units = "in", dpi = 300, device = NULL, ... )
plot |
A plot object. Typically |
file |
Output file path. |
width |
Plot width. |
height |
Plot height. |
units |
Units for |
dpi |
Resolution for raster outputs. |
device |
Optional graphics device (e.g. |
... |
Additional arguments passed to |
Invisibly, the normalized output file path.
v <- example_vista() p <- get_pca_plot(v) out_file <- tempfile(fileext = ".pdf") save_vista_plot(p, file = out_file, width = 7, height = 5, units = "in")v <- example_vista() p <- get_pca_plot(v) out_file <- tempfile(fileext = ".pdf") save_vista_plot(p, file = out_file, width = 7, height = 5, units = "in")
Switches the DE result source used by all downstream VISTA plotting and accessor functions that read the active metadata slots.
set_de_source( object, source = c("deseq2", "edger", "limma", "consensus", "active") )set_de_source( object, source = c("deseq2", "edger", "limma", "consensus", "active") )
object |
A |
source |
One of |
A modified VISTA object with updated active DE source.
v <- example_vista(method = "both") v <- set_de_source(v, "edger") names(comparisons(v, source = "active"))v <- example_vista(method = "both") v <- set_de_source(v, "edger") names(comparisons(v, source = "active"))
Accepts a data.frame/tibble/DataFrame of gene-level annotations, aligns it to
the VISTA row order, and stores it in rowData(x). Rows are matched by a
key column (default: tries gene_id or rownames); Ensembl version suffixes
can be stripped for matching.
set_rowdata( x, annotations = NULL, orgdb = NULL, key_col = NULL, keytype = NULL, columns = c("SYMBOL", "GENENAME", "ENSEMBL", "ENTREZID", "TXCHROM", "TXSTART", "TXEND"), drop_version = TRUE, overwrite = FALSE )set_rowdata( x, annotations = NULL, orgdb = NULL, key_col = NULL, keytype = NULL, columns = c("SYMBOL", "GENENAME", "ENSEMBL", "ENTREZID", "TXCHROM", "TXSTART", "TXEND"), drop_version = TRUE, overwrite = FALSE )
x |
A |
annotations |
Optional data.frame/tibble/DataFrame with one row per gene
and a column containing the gene IDs to match against |
orgdb |
Optional |
key_col |
Name of the column in |
keytype |
Key type for |
columns |
Character vector of OrgDb columns to retrieve when using
|
drop_version |
Logical; if |
overwrite |
Logical; if |
OrgDb packages rarely include full genomic coordinates; the default
TXCHROM/TXSTART/TXEND columns may therefore be NA unless your OrgDb
provides them. For reliable coordinates, fetch them from an EnsDb/TxDb
(via genes() or biomaRt/AnnotationHub), build an annotation table keyed
on your gene IDs, and supply that via the annotations argument. When
fetching from an OrgDb, only columns available in that database will be
filled.
The updated VISTA object with rowData populated/appended.
vista <- example_vista() custom_annot <- data.frame( gene_id = rownames(vista)[seq_len(10)], custom_info = paste0("Info_", seq_len(10)) ) vista2 <- set_rowdata(vista, annotations = custom_annot, key_col = "gene_id") head(SummarizedExperiment::rowData(vista2)$custom_info) # Load example VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(100), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) # Add annotations from OrgDb (human) if (requireNamespace("org.Hs.eg.db", quietly = TRUE)) { vista <- set_rowdata( vista, orgdb = org.Hs.eg.db::org.Hs.eg.db, columns = c("SYMBOL", "GENENAME", "ENTREZID") ) # View updated rowData head(SummarizedExperiment::rowData(vista)) } # Or provide custom annotations custom_annot <- data.frame( gene_id = rownames(vista)[seq_len(10)], custom_info = paste0("Info_", seq_len(10)) ) vista <- set_rowdata(vista, annotations = custom_annot, key_col = "gene_id")vista <- example_vista() custom_annot <- data.frame( gene_id = rownames(vista)[seq_len(10)], custom_info = paste0("Info_", seq_len(10)) ) vista2 <- set_rowdata(vista, annotations = custom_annot, key_col = "gene_id") head(SummarizedExperiment::rowData(vista2)$custom_info) # Load example VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(100), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) # Add annotations from OrgDb (human) if (requireNamespace("org.Hs.eg.db", quietly = TRUE)) { vista <- set_rowdata( vista, orgdb = org.Hs.eg.db::org.Hs.eg.db, columns = c("SYMBOL", "GENENAME", "ENTREZID") ) # View updated rowData head(SummarizedExperiment::rowData(vista)) } # Or provide custom annotations custom_annot <- data.frame( gene_id = rownames(vista)[seq_len(10)], custom_info = paste0("Info_", seq_len(10)) ) vista <- set_rowdata(vista, annotations = custom_annot, key_col = "gene_id")
Updates metadata(x)$comparison$colors using a user-supplied named color
vector. Comparison colors are used in fold-change and comparison-level plots.
The color map must include all currently active comparisons.
set_vista_comparison_colors(object, color_map)set_vista_comparison_colors(object, color_map)
object |
A |
color_map |
Named character vector of colors, with names equal to
comparison names (for example |
A modified VISTA object with updated comparison colors.
v <- example_vista() comps <- names(comparisons(v)) if (length(comps)) { cmap <- stats::setNames(rep('#1b9e77', length(comps)), comps) set_vista_comparison_colors(v, cmap) }v <- example_vista() comps <- names(comparisons(v)) if (length(comps)) { cmap <- stats::setNames(rep('#1b9e77', length(comps)), comps) set_vista_comparison_colors(v, cmap) }
Updates metadata(x)$group$colors using a user-supplied named color vector.
This controls group-level coloring across VISTA plots that use group mapping
(for example PCA, MDS, and expression plots). The color map must include all
groups currently present in the object.
set_vista_group_colors(object, color_map)set_vista_group_colors(object, color_map)
object |
A |
color_map |
Named character vector of colors, with names equal to group labels. |
A modified VISTA object with updated group colors.
v <- example_vista() groups <- unique(as.character(sample_info(v)$cond_long)) gmap <- stats::setNames(c('#1b9e77', '#d95f02')[seq_along(groups)], groups) set_vista_group_colors(v, gmap)v <- example_vista() groups <- unique(as.character(sample_info(v)$cond_long)) gmap <- stats::setNames(c('#1b9e77', '#d95f02')[seq_along(groups)], groups) set_vista_group_colors(v, gmap)
Performs structural and metadata contract checks on a VISTA object.
Use level = "core" for invariants that all VISTA objects must satisfy,
or level = "full" to additionally validate method-specific metadata used
by advanced workflows.
validate_vista(x, level = c("core", "full"), error = TRUE)validate_vista(x, level = c("core", "full"), error = TRUE)
x |
A |
level |
Validation depth. One of |
error |
Logical; if |
Invisibly returns a list with fields valid, level, and issues.
mat <- matrix(rnorm(60), nrow = 10) rownames(mat) <- paste0("gene", seq_len(nrow(mat))) colnames(mat) <- paste0("sample", seq_len(ncol(mat))) se <- SummarizedExperiment::SummarizedExperiment( assays = list(norm_counts = mat), colData = S4Vectors::DataFrame( cond = rep(c("A", "B"), each = 3), row.names = colnames(mat) ), rowData = S4Vectors::DataFrame( gene_id = rownames(mat), row.names = rownames(mat) ) ) v <- as_vista(se, group_column = "cond") validate_vista(v)mat <- matrix(rnorm(60), nrow = 10) rownames(mat) <- paste0("gene", seq_len(nrow(mat))) colnames(mat) <- paste0("sample", seq_len(ncol(mat))) se <- SummarizedExperiment::SummarizedExperiment( assays = list(norm_counts = mat), colData = S4Vectors::DataFrame( cond = rep(c("A", "B"), each = 3), row.names = colnames(mat) ), rowData = S4Vectors::DataFrame( gene_id = rownames(mat), row.names = rownames(mat) ) ) v <- as_vista(se, group_column = "cond") validate_vista(v)
This validator combines validate_vista() with backend-to-backend numerical
equivalence checks against standalone DESeq2, edgeR, and limma runs.
validate_vista_deep( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, methods = c("deseq2", "edger", "limma"), min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "padj", covariates = NULL, design_formula = NULL, tolerance = 1e-08, return_plots = FALSE, error = TRUE )validate_vista_deep( counts, sample_info, column_geneid, group_column, group_numerator, group_denominator, methods = c("deseq2", "edger", "limma"), min_counts = 10, min_replicates = 1, log2fc_cutoff = 1, pval_cutoff = 0.05, p_value_type = "padj", covariates = NULL, design_formula = NULL, tolerance = 1e-08, return_plots = FALSE, error = TRUE )
counts |
Raw counts (matrix/data.frame) with a gene-id column and sample columns. |
sample_info |
Data frame with sample metadata. |
column_geneid |
Column name in |
group_column |
Column in |
group_numerator |
Character vector of numerator groups for pairwise comparisons. |
group_denominator |
Character vector of denominator groups. |
methods |
Character vector of backends to benchmark. Any subset of
|
min_counts |
Minimum total counts per gene to retain. |
min_replicates |
Minimum samples per group meeting filtering criteria. |
log2fc_cutoff |
Absolute log2 fold-change threshold for DEG calling. |
pval_cutoff |
P-value (or adjusted p-value) threshold. |
p_value_type |
Either |
covariates |
Optional character vector of additional sample_info columns. |
design_formula |
Optional model formula (or formula string) including |
tolerance |
Numeric tolerance used for floating-point comparisons. |
return_plots |
Logical; if |
error |
Logical; if |
Invisibly returns the full benchmark report.
v <- example_vista() si <- as.data.frame(sample_info(v)) data("count_data", package = "VISTA") count_subset <- count_data[seq_len(500), c("gene_id", si$sample_names), drop = FALSE] report <- validate_vista_deep( counts = count_subset, sample_info = si, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", methods = "limma", min_counts = 5, min_replicates = 1, error = FALSE ) report$valid data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") target_groups <- c("control", "treatment1") sample_subset <- sample_metadata[sample_metadata$cond_long %in% target_groups, ] count_subset <- count_data[seq_len(150), c("gene_id", sample_subset$sample_names)] validate_vista_deep( counts = count_subset, sample_info = sample_subset, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", methods = c("deseq2", "edger"), min_counts = 5, min_replicates = 1 )v <- example_vista() si <- as.data.frame(sample_info(v)) data("count_data", package = "VISTA") count_subset <- count_data[seq_len(500), c("gene_id", si$sample_names), drop = FALSE] report <- validate_vista_deep( counts = count_subset, sample_info = si, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", methods = "limma", min_counts = 5, min_replicates = 1, error = FALSE ) report$valid data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") target_groups <- c("control", "treatment1") sample_subset <- sample_metadata[sample_metadata$cond_long %in% target_groups, ] count_subset <- count_data[seq_len(150), c("gene_id", sample_subset$sample_names)] validate_vista_deep( counts = count_subset, sample_info = sample_subset, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", methods = c("deseq2", "edger"), min_counts = 5, min_replicates = 1 )
These accessor functions expose the analysis components stored in a VISTA object.
Core expression matrices and annotations live in the underlying
SummarizedExperiment, while differential expression results, summaries, and
configuration details are kept inside metadata(x).
## S4 method for signature 'VISTA' comparisons(object, source = "active") ## S4 method for signature 'VISTA' deg_summary(object, source = "active") ## S4 method for signature 'VISTA' cutoffs(object) ## S4 method for signature 'VISTA' norm_counts(object, summarise = FALSE) ## S4 method for signature 'VISTA' sample_info(object) ## S4 method for signature 'VISTA' row_data(object) ## S4 method for signature 'VISTA' group_colors(object) ## S4 method for signature 'VISTA' group_palette(object)## S4 method for signature 'VISTA' comparisons(object, source = "active") ## S4 method for signature 'VISTA' deg_summary(object, source = "active") ## S4 method for signature 'VISTA' cutoffs(object) ## S4 method for signature 'VISTA' norm_counts(object, summarise = FALSE) ## S4 method for signature 'VISTA' sample_info(object) ## S4 method for signature 'VISTA' row_data(object) ## S4 method for signature 'VISTA' group_colors(object) ## S4 method for signature 'VISTA' group_palette(object)
object |
An object of class |
source |
Which DE result source to use for |
summarise |
Logical. If TRUE, returns mean-normalized counts grouped by the grouping column
stored in the |
The content of the respective slot or processed data:
A named list of differential expression tables stored in metadata(x)$de_results.
A named list of DEG summary tables stored in metadata(x)$de_summary.
A list of analysis thresholds held in metadata(x)$de_cutoffs (empty list if absent).
A matrix of normalized counts, optionally averaged by group.
A DataFrame of sample metadata.
A DataFrame of gene-level annotation (e.g., baseMean, gene ID).
A named character vector of colours from metadata(x)$group$colors.
The qualitative palette name stored in metadata(x)$group$palette.
create_vista(), as_vista(), run_deseq_analysis()
# Create example VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(100), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) # Access differential expression comparisons comps <- comparisons(vista) names(comps) comparisons(vista, source = "active") # View DEG summary statistics deg_summary(vista) # Get analysis cutoffs cutoffs(vista) # Access normalized counts nc <- norm_counts(vista) head(nc) # Get group-summarized counts nc_summary <- norm_counts(vista, summarise = TRUE) head(nc_summary) # Access sample metadata sample_info(vista) # Access gene-level annotations head(row_data(vista)) # Get group colors group_colors(vista) # Get palette name group_palette(vista) # For method = "both", inspect method-specific outputs vista_both <- create_vista( counts = count_data, sample_info = sample_metadata, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", method = "both", result_source = "consensus" ) comparisons(vista_both, source = "deseq2") comparisons(vista_both, source = "edger") vista_both <- set_de_source(vista_both, "edger")# Create example VISTA object data("count_data", package = "VISTA") data("sample_metadata", package = "VISTA") vista <- create_vista( counts = count_data[seq_len(100), ], sample_info = sample_metadata[seq_len(6), ], column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control" ) # Access differential expression comparisons comps <- comparisons(vista) names(comps) comparisons(vista, source = "active") # View DEG summary statistics deg_summary(vista) # Get analysis cutoffs cutoffs(vista) # Access normalized counts nc <- norm_counts(vista) head(nc) # Get group-summarized counts nc_summary <- norm_counts(vista, summarise = TRUE) head(nc_summary) # Access sample metadata sample_info(vista) # Access gene-level annotations head(row_data(vista)) # Get group colors group_colors(vista) # Get palette name group_palette(vista) # For method = "both", inspect method-specific outputs vista_both <- create_vista( counts = count_data, sample_info = sample_metadata, column_geneid = "gene_id", group_column = "cond_long", group_numerator = "treatment1", group_denominator = "control", method = "both", result_source = "consensus" ) comparisons(vista_both, source = "deseq2") comparisons(vista_both, source = "edger") vista_both <- set_de_source(vista_both, "edger")
The VISTA class extends SummarizedExperiment. All analysis
metadata (DE results, summaries, cutoffs, grouping info, etc.) is stored in
the metadata() slot of the object.
Core elements stored in metadata(v):
$de_results: named SimpleList of DE result tables.
$de_summary: named SimpleList of DEG summary tables.
$de_cutoffs: named list of thresholds (log2FC, p-value type/cutoff, method settings).
$group: list with column, palette, colors describing the grouping/fill scheme.
$provenance: list with constructor version, timestamp, session info.
$vista_schema_version: metadata schema tag used for compatibility checks.
Feature-level annotations live in rowData(v), sample metadata in
colData(v), and normalized counts (and any additional assays) in
assay(v, "norm_counts") by default. Use create_vista() as the
primary end-user constructor. Advanced users can convert an existing
SummarizedExperiment with as_vista().
A VISTA S4 object.
create_vista, as_vista, validate_vista
methods::showClass('VISTA')methods::showClass('VISTA')