Learn R Programming

rliger (version 1.0.0)

runTSNE: 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).

Value

liger object with tsne.coords slot set.

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.

Examples

Run this code
# NOT RUN {
# ligerex (liger object), factorization complete
# generate H.norm by quantile normalizig factor loadings
ligerex <- quantile_norm(ligerex)
# get tsne.coords for normalized data
ligerex <- runTSNE(ligerex)
# get tsne.coords for raw factor loadings
ligerex <- runTSNE(ligerex, use.raw = TRUE)
# }

Run the code above in your browser using DataLab