Skip to contents

Runs t-SNE on the aligned cell factors (result from alignFactors), or unaligned cell factors (result from runIntegration)) to generate a 2D embedding for visualization. By default Rtsne (Barnes-Hut implementation of t-SNE) method is invoked, while alternative "fftRtsne" method (FFT-accelerated Interpolation-based t-SNE, using Kluger Lab implementation) is also supported. For very large datasets, it is recommended to use method = "fftRtsne" due to its efficiency and scalability.

Extra external installation steps are required for using "fftRtsne" method. Please consult detailed guide.

Usage

runTSNE(
  object,
  useRaw = NULL,
  useDims = NULL,
  nDims = 2,
  usePCA = FALSE,
  perplexity = 30,
  theta = 0.5,
  method = c("Rtsne", "fftRtsne"),
  dimredName = "TSNE",
  asDefault = NULL,
  fitsnePath = NULL,
  seed = 42,
  verbose = getOption("ligerVerbose", TRUE),
  k = nDims,
  use.raw = useRaw,
  dims.use = useDims,
  use.pca = usePCA,
  fitsne.path = fitsnePath,
  rand.seed = seed
)

Arguments

object

liger object with factorization results.

useRaw

Whether to use un-aligned cell factor loadings (\(H\) matrices). Default NULL search for aligned factor loadings first and un-aligned loadings then.

useDims

Index of factors to use for computing the embedding. Default NULL uses all factors.

nDims

Number of dimensions to reduce to. Default 2.

usePCA

Whether to perform initial PCA step for Rtsne. Default FALSE.

perplexity

Numeric 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

Choose from "Rtsne" or "fftRtsne". See Description. Default "Rtsne".

dimredName

Name of the variable in cellMeta slot to store the result matrix. Default "TSNE".

asDefault

Logical, whether to set the resulting dimRed as default for visualization. Default NULL will set it when no default is set.

fitsnePath

Path to the cloned FIt-SNE directory (i.e. '/path/to/dir/FIt-SNE'). Required only when first time using runTSNE with method = "fftRtsne". Default NULL.

seed

Random seed for reproducibility. Default 42.

verbose

Logical. Whether to show information of the progress. Default getOption("ligerVerbose") or TRUE if users have not set.

use.raw, dims.use, k, use.pca, fitsne.path, rand.seed

Deprecated. See Usage section for replacement.

Value

The object where a "TSNE" variable is updated in the cellMeta slot with the whole 2D embedding matrix.

See also

Examples

pbmc <- runTSNE(pbmcPlot)
#>  Generating TSNE (Rtsne) on aligned cell factor loadings
#>  Generating TSNE (Rtsne) on aligned cell factor loadings ... done
#> 
#> ! No rownames detected. Assume cells match to the same order as in the object.