spectral_tsne: Reduce dimensions of a matrix with pca and tSNE

Description Usage Arguments Value Examples

View source: R/spectral_tsne.R

Description

spectral_tsne() performs dimensionality reduction using the package Rtsne's wrapper for the C++ implementation of Barnes-Hut t-Distributed Stochastic Neighbor Embedding. If no prcomp_object is supplied, principal component analysis will be performed using an irlba algorithm for sparse data.

Usage

1
2
spectral_tsne(matrix, log_matrix = TRUE, prcomp_object = NULL,
  dims = 1:10, perplexity = 30)

Arguments

matrix

a matrix of values to perform dimensionality reduction on; by default, rows are genes and columns are cells

log_matrix

if log10 transformation is to be performed on the matrix; defaults to TRUE

dims

dimensions from the prinicpal component analysis to use; defaults to 1:10 (i.e. 1st to 10th principal components)

perplexity

numeric; perplexity parameter for tSNE; defaults to 30

prcomp_obj

a principal component analysis object produced by the prcomp or prcomp_irlba functions; if no object is supplied, sparse_pca will be run on the matrix to return 50 dimensions; defaults to NULL; if a prcomp object is supplied, matrix is not required

pca_version

PCA implementation to use. Possible values are "default" for sparse_pca() or "monocle" for the sparse_irlba_prcomp implemented in Monocle 3 alpha.

center

a logical value indicating whether the variables should be shifted to be zero centered. Alternately, if the "monocle" pca version is used, a centering vector of length equal the number of columns of x can be supplied.

scale

a logical value indicating whether the variables should be scaled to have unit variance before the analysis takes place. If the "default" pca version is used and center = TRUE, scaling will be also default to TRUE. Alternatively, if the "monocle" pca version is used, a vector of length equal the number of columns of x can be supplied.

Value

A matrix with two columns containing coordinates of each row for two dimensions respectively

Examples

1
spectral_tsne(matrix, log_matrix=TRUE, prcomp_object=NULL, dims=1:10, perplexity=30)

jacobheng/cellwrangler documentation built on Aug. 12, 2019, 6:49 a.m.