plotGene: Plot gene expression on dimensional reduction (t-SNE)...

View source: R/rliger.R

plotGeneR Documentation

Plot gene expression on dimensional reduction (t-SNE) coordinates

Description

Generates plot of dimensional reduction coordinates (default t-SNE) colored by expression of specified gene. Data can be scaled by dataset or selected feature column from cell.data (or across all cells). Data plots can be split by feature.

Usage

plotGene(
  object,
  gene,
  use.raw = FALSE,
  use.scaled = FALSE,
  scale.by = "dataset",
  log2scale = NULL,
  methylation.indices = NULL,
  plot.by = "dataset",
  set.dr.lims = FALSE,
  pt.size = 0.1,
  min.clip = NULL,
  max.clip = NULL,
  clip.absolute = FALSE,
  points.only = FALSE,
  option = "plasma",
  cols.use = NULL,
  zero.color = "#F5F5F5",
  axis.labels = NULL,
  do.legend = TRUE,
  return.plots = FALSE,
  keep.scale = FALSE,
  raster = NULL
)

Arguments

object

liger object. Should call runTSNE before calling.

gene

Gene for which to plot expression.

use.raw

Plot raw UMI values instead of normalized, log-transformed data (default FALSE).

use.scaled

Plot values scaled across specified groups of cells (with log transformation) (default FALSE).

scale.by

Grouping of cells by which to scale gene (can be any factor column in cell.data or 'none' for scaling across all cells) (default 'dataset').

log2scale

Whether to show log2 transformed values or original normalized, raw, or scaled values (as stored in object). Default value is FALSE if use.raw = TRUE, otherwise TRUE.

methylation.indices

Indices of datasets in object with methylation data (this data is not log transformed and must use normalized values). (default NULL)

plot.by

How to group cells for plotting (can be any factor column in cell.data or 'none' for plotting all cells in a single plot). Note that this can result in large number of plots. Users are encouraged to use same value as for scale.by (default 'dataset').

set.dr.lims

Whether to keep dimensional reduction coordinates consistent when multiple plots created (default FALSE).

pt.size

Point size for plots (default 0.1).

min.clip

Minimum value for expression values plotted. Can pass in quantile (0-1) or absolute cutoff (set clip.absolute = TRUE). Can also pass in vector if expecting multiple plots; users are encouraged to pass in named vector (from levels of desired feature) to avoid mismatches in order (default NULL).

max.clip

Maximum value for expression values plotted. Can pass in quantile (0-1) or absolute cutoff (set clip.absolute = TRUE). Can also pass in vector if expecting multiple plots; users are encouraged to pass in named vector (from levels of desired feature) to avoid mismatches in order (default NULL).

clip.absolute

Whether to treat clip values as absolute cutoffs instead of quantiles (default FALSE).

points.only

Remove axes, background, and legend when plotting coordinates (default FALSE).

option

Colormap option to use for ggplot2's scale_color_viridis (default 'plasma').

cols.use

Vector of colors to form gradient over instead of viridis colormap (low to high). (default NULL).

zero.color

Color to use for zero values (no expression) (default '#F5F5F5').

axis.labels

Vector of two strings to use as x and y labels respectively. (default NULL)

do.legend

Display legend on plots (default TRUE).

return.plots

Return ggplot objects instead of printing directly (default FALSE).

keep.scale

Maintain min/max color scale across all plots when using plot.by (default FALSE)

raster

Rasterization of points (default NULL). Automatically convert to raster format if there are over 100,000 cells to plot.

Value

If returning single plot, returns ggplot object; if returning multiple plots; returns list of ggplot objects.

Examples

ligerex <- createLiger(list(ctrl = ctrl, stim = stim))
ligerex <- normalize(ligerex)
ligerex <- selectGenes(ligerex)
ligerex <- scaleNotCenter(ligerex)
ligerex <- optimizeALS(ligerex, k = 5, max.iter = 1)
ligerex <- quantile_norm(ligerex)
ligerex <- runTSNE(ligerex)
plotGene(ligerex, "CD74", pt.size = 1)

rliger documentation built on Nov. 9, 2023, 1:07 a.m.