library(bbknnR)
#> The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
#> which was just loaded, will retire in October 2023.
#> Please refer to R-spatial evolution reports for details, especially
#> https://r-spatial.org/r/2023/05/15/evolution4.html.
#> It may be desirable to make the sf package available;
#> package maintainers should consider adding sf to Suggests:.
#> The sp package is now running under evolution status 2
#> (status 2 uses the sf package in place of rgdal)
library(Seurat)
#> Loading required package: SeuratObject
#> Loading required package: sp
#>
#> Attaching package: 'SeuratObject'
#> The following object is masked from 'package:base':
#>
#> intersect
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(patchwork)
data("panc8_small")
Note that RunBBKNN()
also compute t-SNE and UMAP by default.
RunBBKNN(panc8_small, batch_key = "tech")
panc8_small <-#> Running BBKNN using RcppAnnoy...
#> Running UMAP...
#> Running tSNE...
#> All done!
FindClusters(panc8_small, graph.name = "bbknn")
panc8_small <-#> Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
#>
#> Number of nodes: 500
#> Number of edges: 6417
#>
#> Running Louvain algorithm...
#> Maximum modularity in 10 random starts: 0.7193
#> Number of communities: 5
#> Elapsed time: 0 seconds
DimPlot(panc8_small, reduction = "umap", group.by = "celltype", label = TRUE,
p1 <-label.size = 3 , repel = TRUE) + NoLegend()
DimPlot(panc8_small, reduction = "umap", group.by = "tech")
p2 <- DimPlot(panc8_small, reduction = "umap")
p3 <-
wrap_plots(list(p1, p2, p3), ncol = 1)
DimPlot(panc8_small, reduction = "tsne", group.by = "celltype", label = TRUE,
p1 <-label.size = 3 , repel = TRUE) + NoLegend()
DimPlot(panc8_small, reduction = "tsne", group.by = "tech")
p2 <- DimPlot(panc8_small, reduction = "tsne")
p3 <-
wrap_plots(list(p1, p2, p3), ncol = 1)