runTSNE: Perform t-SNE dimensionality reduction

View source: R/rliger.R

runTSNER Documentation

Perform t-SNE dimensionality reduction

Description

Runs t-SNE on the normalized cell factors (or raw cell factors) to generate a 2D embedding for visualization. Has option to run on subset of factors. Note that running multiple times will reset tsne.coords values.

Usage

runTSNE(
  object,
  use.raw = FALSE,
  dims.use = 1:ncol(object@H.norm),
  use.pca = FALSE,
  perplexity = 30,
  theta = 0.5,
  method = "Rtsne",
  fitsne.path = NULL,
  rand.seed = 42
)

Arguments

object

liger object. Should run quantile_norm before calling with defaults.

use.raw

Whether to use un-aligned cell factor loadings (H matrices) (default FALSE).

dims.use

Factors to use for computing tSNE embedding (default 1:ncol(H.norm)).

use.pca

Whether to perform initial PCA step for Rtsne (default FALSE).

perplexity

Parameter to pass to Rtsne (expected number of neighbors) (default 30).

theta

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

method

Supports two methods for estimating tSNE values: Rtsne (Barnes-Hut implementation of t-SNE) and fftRtsne (FFT-accelerated Interpolation-based t-SNE) (using Kluger Lab implementation). (default Rtsne)

fitsne.path

Path to the cloned FIt-SNE directory (ie. '/path/to/dir/FIt-SNE') (required for using fftRtsne – only first time runTSNE is called) (default NULL).

rand.seed

Random seed for reproducibility (default 42).

Details

In order to run fftRtsne (recommended for large datasets), you must first install FIt-SNE as detailed here. Include the path to the cloned FIt-SNE directory as the fitsne.path parameter, though this is only necessary for the first call to runTSNE. For more detailed FIt-SNE installation instructions, see the liger repo README.

Value

liger object with tsne.coords slot set.

Examples

ligerex <- createLiger(list(ctrl = ctrl, stim = stim))
ligerex <- normalize(ligerex)
ligerex <- selectGenes(ligerex)
ligerex <- scaleNotCenter(ligerex)
# Specification for minimal example run time, not converging
ligerex <- optimizeALS(ligerex, k = 5, max.iters = 1)
ligerex <- quantile_norm(ligerex)
ligerex <- runTSNE(ligerex)

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