Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plotByDatasetAndCluster

Plot t-SNE coordinates of cells across datasets


Description

Generates two plots of all cells across datasets, one colored by dataset and one colored by cluster. These are useful for visually examining the alignment and cluster distributions, respectively. If clusters have not been set yet (quantileAlignSNF not called), will plot by single color for second plot. It is also possible to pass in another clustering (as long as names match those of cells).

Usage

plotByDatasetAndCluster(
  object,
  clusters = NULL,
  title = NULL,
  pt.size = 0.3,
  text.size = 3,
  do.shuffle = TRUE,
  rand.seed = 1,
  axis.labels = NULL,
  do.legend = TRUE,
  legend.size = 5,
  reorder.idents = FALSE,
  new.order = NULL,
  return.plots = FALSE,
  legend.fonts.size = 12
)

Arguments

object

liger object. Should call runTSNE or runUMAP before calling.

clusters

Another clustering to use for coloring second plot (must have same names as clusters slot) (default NULL).

title

Plot titles (list or vector of length 2) (default NULL).

pt.size

Controls size of points representing cells (default 0.3).

text.size

Controls size of plot text (cluster center labels) (default 3).

do.shuffle

Randomly shuffle points so that points from same dataset are not plotted one after the other (default TRUE).

rand.seed

Random seed for reproducibility of point shuffling (default 1).

axis.labels

Vector of two strings to use as x and y labels respectively.

do.legend

Display legend on plots (default TRUE).

legend.size

Size of legend on plots (default 5).

reorder.idents

logical whether to reorder the datasets from default order before plotting (default FALSE).

new.order

new dataset factor order for plotting. must set reorder.idents = TRUE.

return.plots

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

legend.fonts.size

Controls the font size of the legend.

Value

List of ggplot plot objects (only if return.plots TRUE, otherwise prints plots to console).

Examples

## Not run: 
# ligerex (liger object), factorization complete
# get tsne.coords for normalized data
ligerex <- runTSNE(ligerex)
# plot to console
plotByDatasetAndCluster(ligerex)
# return list of plots
plots <- plotByDatasetAndCluster(ligerex, return.plots = TRUE)

## End(Not run)

rliger

Linked Inference of Genomic Experimental Relationships

v1.0.0
GPL-3
Authors
Joshua Welch [aut, ctb], Chao Gao [aut, ctb, cre], Jialin Liu [aut, ctb], Joshua Sodicoff [aut, ctb], Velina Kozareva [aut, ctb], Evan Macosko [aut, ctb], Paul Hoffman [ctb], Ilya Korsunsky [ctb], Robert Lee [ctb]
Initial release
2021-04-18

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.