runTSNE | R Documentation |
T-Stochastic Neighbour Embedding (t-SNE) algorithm is commonly
for 2D visualization of single-cell data. This function wraps the
Rtsne Rtsne
function.
With this funciton, users can create tSNE embedding directly from raw count matrix, with necessary preprocessing including normalization, scaling, dimension reduction all automated. Yet we still recommend having the PCA as input, so that the result can match with the clustering based on the same input PCA, and will be much faster.
runTSNE(
inSCE,
useReducedDim = "PCA",
useAssay = NULL,
useAltExp = NULL,
reducedDimName = "TSNE",
logNorm = TRUE,
useFeatureSubset = NULL,
nTop = 2000,
center = TRUE,
scale = TRUE,
pca = TRUE,
partialPCA = FALSE,
initialDims = 25,
theta = 0.5,
perplexity = 30,
nIterations = 1000,
numThreads = 1,
seed = 12345
)
runQuickTSNE(inSCE, useAssay = "counts", ...)
getTSNE(
inSCE,
useReducedDim = "PCA",
useAssay = NULL,
useAltExp = NULL,
reducedDimName = "TSNE",
logNorm = TRUE,
useFeatureSubset = NULL,
nTop = 2000,
center = TRUE,
scale = TRUE,
pca = TRUE,
partialPCA = FALSE,
initialDims = 25,
theta = 0.5,
perplexity = 30,
nIterations = 1000,
numThreads = 1,
seed = 12345
)
inSCE |
Input SingleCellExperiment object. |
useReducedDim |
The low dimension representation to use for UMAP
computation. Default |
useAssay |
Assay to use for tSNE computation. If |
useAltExp |
The subset to use for tSNE computation, usually for the
selected.variable features. Default |
reducedDimName |
a name to store the results of the dimension
reductions. Default |
logNorm |
Whether the counts will need to be log-normalized prior to
generating the tSNE via |
useFeatureSubset |
Subset of feature to use for dimension reduction. A
character string indicating a |
nTop |
Automatically detect this number of variable features to use for
dimension reduction. Ignored when using |
center |
Whether data should be centered before PCA is applied. Ignored
when using |
scale |
Whether data should be scaled before PCA is applied. Ignored
when using |
pca |
Whether an initial PCA step should be performed. Ignored when
using |
partialPCA |
Whether truncated PCA should be used to calculate principal
components (requires the irlba package). This is faster for large input
matrices. Ignored when using |
initialDims |
Number of dimensions from PCA to use as input in tSNE.
Default |
theta |
Numeric value for speed/accuracy trade-off (increase for less
accuracy), set to |
perplexity |
perplexity parameter. Should not be bigger than
|
nIterations |
maximum iterations. Default |
numThreads |
Integer, number of threads to use using OpenMP, Default
|
seed |
Random seed for reproducibility of tSNE results.
Default |
... |
Other parameters to be passed to |
A SingleCellExperiment object with tSNE computation
updated in reducedDim(inSCE, reducedDimName)
.
data(scExample, package = "singleCellTK")
sce <- subsetSCECols(sce, colData = "type != 'EmptyDroplet'")
# Run from raw counts
sce <- runQuickTSNE(sce)
## Not run:
# Run from PCA
sce <- scaterlogNormCounts(sce, "logcounts")
sce <- runModelGeneVar(sce)
sce <- setTopHVG(sce, method = "modelGeneVar", hvgNumber = 2000,
featureSubsetName = "HVG_modelGeneVar2000")
sce <- scaterPCA(sce, useAssay = "logcounts",
useFeatureSubset = "HVG_modelGeneVar2000", scale = TRUE)
sce <- runTSNE(sce, useReducedDim = "PCA")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.