File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
singlecell/resources/chunks Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,20 @@ for (datasetId in names(seuratObjects)) {
1313 next
1414 }
1515
16- P1 <- Seurat :: DimPlot(seuratObj , group.by = field , reduction = ' tsne' )
17- P2 <- Seurat :: DimPlot(seuratObj , group.by = field , reduction = ' umap' )
16+ plotList <- list ()
17+ if (' tsne' %in% names(seuratObj @ reductions )) {
18+ plotList [[' tsne' ]] <- Seurat :: DimPlot(seuratObj , group.by = field , reduction = ' tsne' )
19+ }
20+
21+ if (' umap' %in% names(seuratObj @ reductions )) {
22+ plotList [[' umap' ]] <- Seurat :: DimPlot(seuratObj , group.by = field , reduction = ' umap' )
23+ }
1824
1925 if (' wnn.umap' %in% names(seuratObj @ reductions )) {
20- P3 <- Seurat :: DimPlot(seuratObj , group.by = field , reduction = ' wnn.umap' )
21- P1 <- P1 | P2 | P3
22- } else {
23- P1 <- P1 | P2
26+ plotList [[' wnn.umap' ]] <- Seurat :: DimPlot(seuratObj , group.by = field , reduction = ' wnn.umap' )
2427 }
2528
26- P1 <- P1 + patchwork :: plot_annotation(title = field ) + patchwork :: plot_layout(guides = " collect" )
29+ P1 <- patchwork :: wrap_plots( plotList ) + patchwork :: plot_layout( ncol = length( plotList )) + patchwork :: plot_annotation(title = field ) + patchwork :: plot_layout(guides = " collect" )
2730
2831 print(P1 )
2932 }
You can’t perform that action at this time.
0 commit comments