Last active
February 7, 2023 02:18
-
-
Save daskelly/bb1469d68f1c4880f53b4eb70af8fc11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Seurat) | |
library(harmony) | |
# x is a Seurat object not yet processed but we have chosen num_pc | |
x <- FindNeighbors(x, reduction = 'pca', dims = 1:num_pc, verbose = FALSE) %>% | |
FindClusters(verbose = FALSE, resolution = 0.2) %>% | |
RunUMAP(reduction = 'pca', dims = 1:num_pc, verbose = FALSE) | |
x$noharmony_clusters <- x$seurat_clusters | |
x@misc$noharmony_umap <- x@reductions$umap | |
x <- RunHarmony(x, 'strain', theta = 1, dims.use = 1:num_pc, max.iter.harmony = 100) %>% | |
FindNeighbors(reduction = 'harmony', dims = 1:num_pc) %>% | |
FindClusters(verbose = FALSE, resolution = 0.2) %>% | |
RunUMAP(dims = 1:num_pc, reduction = 'harmony') | |
x$harmony_clusters <- x$seurat_clusters | |
x@misc$harmony_umap <- x@reductions$umap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment