eztsne: tSNE plot of first two dimensions

View source: R/eztsne.R

eztsneR Documentation

tSNE plot of first two dimensions

Description

tSNE plot of first two dimensions using ggplot2.

Usage

eztsne(
  object,
  pheno.df,
  name = "tsne",
  check_duplicates = FALSE,
  pca = TRUE,
  perplexity = min(30, round(ncol(object)/5)),
  theta = 0.5,
  seed = 123,
  initial_dims = 50,
  max_iter = 1000,
  alpha = 1,
  all.size = NULL,
  facet = NULL,
  title = NULL,
  subtitle = NULL,
  rm.leg.title = FALSE,
  labels = FALSE,
  manual.color = NULL,
  manual.shape = NULL,
  plot = TRUE,
  ...
)

Arguments

object

Matrix-like object with features (e.g. genes) as rows and samples as columns.

pheno.df

Data frame with rows as samples and columns as phenotypes.

name

Name of file to create. Set to NA to plot to screen instead of to file.

check_duplicates

logical; Checks whether duplicates are present. It is best to make sure there are no duplicates present and set this option to FALSE, especially for large datasets (default: TRUE)

pca

logical; Whether an initial PCA step should be performed (default: TRUE)

perplexity

numeric; Perplexity parameter (should not be bigger than 3 * perplexity < nrow(X) - 1, see details for interpretation)

theta

numeric; Speed/accuracy trade-off (increase for less accuracy), set to 0.0 for exact TSNE (default: 0.5)

seed

Integer seed to set for reproducility if fun="mroast", since mroast uses random simulations. Ignored if fun="fry".

initial_dims

integer; the number of dimensions that should be retained in the initial PCA step (default: 50)

max_iter

integer; Number of iterations (default: 1000)

alpha

Transparency, passed to geom_point.

all.size

Passed to geom_point size parameter to give size for all points without appearing in legend. ggplot2 default is size=2.

facet

A formula with columns in pheno.df to facet by.

title

Title text; suppressed if it is NULL.

subtitle

Subtitle text; suppressed if it is NULL or title is NULL. If you'd like a subtitle but no title, set title = "".

rm.leg.title

Logical indicating if legend title should be removed.

labels

Logical, should sample labels be added next to points?

manual.color

Vector passed to scale_colour_manual for creating a discrete color scale. Vector length should be equal to number of levels in mapped variable.

manual.shape

Vector passed to scale_shape_manual for creating a discrete color scale. Vector length should be equal to number of levels in mapped variable.

plot

Logical; should plot be generated?

...

Passed to aes_string.

Details

object must have colnames, and if pheno.df is given, it is checked that colnames(object)==rownames(pheno.df).

Value

Invisibly, a ggplot object. Its data element contains the first two principal components appended to pheno.df.


jdreyf/ezlimmaplot documentation built on Feb. 8, 2025, 2:25 a.m.