plot_marker_express_ALL: Plot the top marker genes for ALL cell types

View source: R/plot_marker_express_ALL.R

plot_marker_express_ALLR Documentation

Plot the top marker genes for ALL cell types

Description

This function plots the top n marker genes for a all cell types based off of the stats table from get_mean_ratio() in a multi-page PDF file. The gene expression is plotted as violin plot with plot_gene_express() and adds annotations to each plot.

Usage

plot_marker_express_ALL(
  sce,
  stats,
  pdf_fn = NULL,
  n_genes = 10,
  rank_col = "MeanRatio.rank",
  anno_col = "MeanRatio.anno",
  gene_col = "gene",
  cellType_col = "cellType",
  color_pal = NULL,
  plot_points = FALSE
)

Arguments

sce

SummarizedExperiment-class object

stats

A data.frame() generated by get_mean_ratio() and/or findMarkers_1vAll().

pdf_fn

A character() of the pdf filename to plot to, if NULL returns all plots

n_genes

An integer(1) of number of markers you'd like to plot

rank_col

The character(1) name of column to rank genes by in stats.

anno_col

The character(1) name of column containing annotation in stats.

gene_col

The character(1) name of column containing gene name in stats should be the same syntax as rownames(sce).

cellType_col

The character(1) name of colData() column containing cell type for sce data. It should match cellType.target in stats.

color_pal

A named character(1) vector that contains a color pallet matching the cell_type values.

plot_points

A logical(1) indicating whether to plot points over the violin, defaults to FALSE as these often become over plotted and quite large (especially when saved as PDF).

Value

A PDF file with violin plots for the expression of top marker genes for all cell types.

See Also

Other expression plotting functions: plot_gene_express(), plot_marker_express(), plot_marker_express_List()

Examples

#' ## Fetch sce example data
if (!exists("sce_DLPFC_example")) sce_DLPFC_example <- fetch_deconvo_data("sce_DLPFC_example")

## load example marker stats
data("marker_test")

# Plot marker gene expression to PDF, one page per cell type in stats
pdf_file <- tempfile("test_marker_expression_ALL", fileext = ".pdf")

plot_marker_express_ALL(
    sce_DLPFC_example,
    cellType_col = "cellType_broad_hc",
    stat = marker_test,
    pdf_fn = pdf_file
)

if (interactive()) browseURL(pdf_file)

lahuuki/DeconvoBuddies documentation built on Nov. 2, 2024, 10:40 p.m.