knitr::opts_chunk$set(warning = FALSE)
````{=html}
## Introduction Non-linear 2D embedding algorithms can be run through Single-Cell Toolkit (SCTK) using both interactive shiny application and R console. For the interactive analysis, the toolkit offers a streamlined workflow to both compute the embedding and then visualize the results. For the console analysis, SCTK offers a generic function `runDimReduce()` to compute the 2D embedding. Methods available with the toolkit include tSNE and UMAP from *Seurat* [@Butler2018][@Stuart2019][@Satija2017][@Hao2021] package, tSNE from *Rtsne* [@Maaten2014][@Maaten2008] package and UMAP from *scater* [@McCarthy2017] package. To view detailed instructions on how to use these methods, please select "Interactive Analysis", from the tabs below, for the usage in Shiny application or "Console Analysis" for using these methods in R console: ## Workflow Guide ````{=html} <div class="tab"> <button class="tablinks" onclick="openTab(event, 'interactive')" id="ia-button">Interactive Analysis</button> <button class="tablinks" onclick="openTab(event, 'console')" id="console-button">Console Analysis</button> </div> <div id="interactive" class="tabcontent">
In general, the UI offers options for selection of data items and choice of parameters on the left side, and a visualization panel on the right side of the interface.
\
\
\
\
````{=html}
Here we show how to generate 2D embedding with the generic function `runDimReduce()`, together with the method to visualize and explore the results. **1. Compute 2D embedding** ```r sce <- runDimReduce(inSCE = sce, method = "scaterUMAP", useReducedDim = "PCA", reducedDimName = "UMAP") ``` The generic function `runDimReduce()` allows `"scaterUMAP"` from *scater*, `"rTSNE"` from *Rtsne*, `"seuratUMAP"` and `"seuratTSNE"` from *Seurat* as options of 2D embedding for `method` argument. For detailed parameter description, please click on the function name to be redirected to its reference page. **2. Visualization** There are multiple functions that can create scatter plot using dimensions stored in `reducedDims` slot of the SCE object. ```r # Make scatter plot without annotation plotDimRed(sce, useReduction = "UMAP") # Short-cut for embedding named as "UMAP" plotUMAP(sce) # Customizing scatter plot with more information from cell metadata (colData) plotSCEDimReduceColData(sce, colorBy = "cluster", reducedDimName = "UMAP") # Color scatter plot with feature expression plotSCEDimReduceFeatures(sce, feature = "CD8A", reducedDimName = "UMAP") ``` ````{=html} <details> <summary><b>Example</b></summary>
library(singleCellTK) sce <- importExampleData("pbmc3k") sce <- runNormalization(sce, normalizationMethod = "LogNormalize", useAssay = "counts", outAssayName = "logcounts") sce <- runFeatureSelection(sce, useAssay = "counts", method = "modelGeneVar") sce <- setTopHVG(sce, method = "modelGeneVar", hvgNumber = 2000, featureSubsetName = "HVG") sce <- runDimReduce(sce, method = "seuratPCA", useAssay = "logcounts", scale = TRUE, useFeatureSubset = "HVG", reducedDimName = "PCA", nComponents = 50) # Run UMAP on the PCA reducedDim sce <- runDimReduce(sce, method = "scaterUMAP", useReducedDim = "PCA", reducedDimName = "UMAP") # Plot UMAP plotDimRed(sce, useReduction = "UMAP")
````{=html}
Individual Functions
While the `runDimReduce()` wrapper function can be used for all 2D embedding algorithms including tSNE and UMAP, and additionally for dimension reduction methods like PCA and ICA, separate functions are also available for all of the included methods. The following functions can be used for specific methods: Running tSNE from *Rtsne* package: ```r sce <- runTSNE(inSCE = sce, useReducedDim = "PCA", reducedDimName = "TSNE") ``` Using the *Seurat* tSNE wrapper is recommended only in the [Seurat Curated Workflow](seurat_curated_workflow.html). ```r sce <- runSeuratFindHVG(inSCE = sce, useAssay = "seuratNormData") sce <- runSeuratPCA(inSCE = sce, useAssay = "seuratNormData", scale = TRUE, reducedDimName = "seuratPCA") sce <- runSeuratTSNE(inSCE = sce, useReduction = "pca", reducedDimName = "seuratTSNE") ``` Running UMAP from *scater* package: ```r sce <- runUMAP(inSCE = sce, useReducedDim = "PCA", initialDims = 25, reducedDimName = "UMAP") ``` Using the *Seurat* UMAP wrapper is recommended only in the [Seurat Curated Workflow](seurat_curated_workflow.html). ```r sce <- runSeuratFindHVG(inSCE = sce, useAssay = "seuratNormData") sce <- runSeuratPCA(inSCE = sce, useAssay = "seuratNormData", scale = TRUE, reducedDimName = "seuratPCA") sce <- runSeuratUMAP(inSCE = sce, useReduction = "pca", reducedDimName = "seuratUMAP") ``` ````{=html} </details> </div> <script> document.getElementById("ia-button").click(); </script> </body>
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.