celdaTsne {celda} | R Documentation

## t-Distributed Stochastic Neighbor Embedding (t-SNE) dimension reduction for celda `sce` object

### Description

Embeds cells in two dimensions using Rtsne based on a celda model. For celda_C `sce` objects, PCA on the normalized counts is used to reduce the number of features before applying t-SNE. For celda_CG and celda_G `sce` objects, tSNE is run on module probabilities to reduce the number of features instead of using PCA. Module probabilities are square-root transformed before applying tSNE.

### Usage

    celdaTsne(sce, ...)

    ## S4 method for signature 'SingleCellExperiment'
    celdaTsne(
      sce,
      useAssay = "counts",
      altExpName = "featureSubset",
      maxCells = NULL,
      minClusterSize = 100,
      initialDims = 20,
      modules = NULL,
      perplexity = 20,
      maxIter = 2500,
      normalize = "proportion",
      scaleFactor = NULL,
      transformationFun = sqrt,
      seed = 12345
    )

### Arguments

`sce` | A SingleCellExperiment object returned by celda_C, celda_G, or celda_CG.
`...` | Ignored. Placeholder to prevent check warning.
`useAssay` | A string specifying which assay slot to use. Default "counts".
`altExpName` | The name for the altExp slot to use. Default "featureSubset".
`maxCells` | Integer. Maximum number of cells to plot. Cells will be randomly subsampled if `ncol(counts) > maxCells`. Larger numbers of cells requires more memory. If `NULL`, no subsampling will be performed. Default `NULL`.
`minClusterSize` | Integer. Do not subsample cell clusters below this threshold. Default 100.
`initialDims` | Integer. PCA will be used to reduce the dimensionality of the dataset. The top 'initialDims' principal components will be used for tSNE. Default 20.
`modules` | Integer vector. Determines which feature modules to use for tSNE. If `NULL`, all modules will be used. Default `NULL`.
`perplexity` | Numeric. Perplexity parameter for tSNE. Default 20.
`maxIter` | Integer. Maximum number of iterations in tSNE generation. Default 2500.
`normalize` | Character. Passed to normalizeCounts in normalization step. Divides counts by the library sizes for each cell. One of 'proportion', 'cpm', 'median', or 'mean'. 'proportion' uses the total counts for each cell as the library size. 'cpm' divides the library size of each cell by one million to produce counts per million. 'median' divides the library size of each cell by the median library size across all cells. 'mean' divides the library size of each cell by the mean library size across all cells.
`scaleFactor` | Numeric. Sets the scale factor for cell-level normalization. This scale factor is multiplied to each cell after the library size of each cell had been adjusted in `normalize`. Default `NULL` which means no scale factor is applied.
`transformationFun` | Function. Applys a transformation such as 'sqrt', 'log', 'log2', 'log10', or 'log1p'. If `NULL`, no transformation will be applied. Occurs after applying normalization and scale factor. Default `NULL`.
`seed` | Integer. Passed to with_seed. For reproducibility, a default value of 12345 is used. If NULL, no calls to with_seed are made.

### Value

`sce` with t-SNE coordinates (columns "celda_tSNE1" & "celda_tSNE2") added to `reducedDim(sce, "celda_tSNE")`.

### Examples

    data(sceCeldaCG)
    tsneRes <- celdaTsne(sceCeldaCG)

[Package celda version 1.6.1 Index]