stratify_seurat | R Documentation |
Given two spot groups, compute for each spot: (i) the distance of the closest spot in the other class.
stratify_seurat(
seurat_obj,
ident = NULL,
colours = NULL,
colours_stratum = NULL,
pt_size = 4,
breaks = 5,
labels = NULL,
diagnostic_plot = TRUE
)
seurat_obj |
A Seurat object. |
ident |
The classes of the spots (0/1). A named vector (name = spot name; value = classes). |
colours |
Colors for the spot classes. |
colours_stratum |
A set of colors for the stratum. |
pt_size |
The size of the points. |
breaks |
Either a numeric vector of two or more unique cut points or a single number (greater than or equal to 2) giving the number of stratums in which spot are to be cut. |
labels |
Labels for the levels of the stratum. By default, labels are constructed using "(a,b]" interval notation. If labels = FALSE, simple integer codes are returned instead of a factor. |
diagnostic_plot |
Whether to produce a diagnostic diagram. Highly recommanded to visually inspect the results. |
library(Seurat)
library(ggplot2)
load_example_dataset("7870305/files/lymph_node_tiny_2")
Seurat::SpatialDimPlot(lymph_node_tiny_2)
identity <- Idents(lymph_node_tiny_2)
classes <- ifelse(Idents(lymph_node_tiny_2) == 7, 1, 0)
names(classes) <- names(identity)
h <- display_hull(lymph_node_tiny_2, ident=classes, color="black", delta=1, size_x=3.4, size_y=3)
plot_spatial(lymph_node_tiny_2, metadata = "seurat_clusters", pt_size = 6) + h
strat <- stratify_seurat(lymph_node_tiny_2, ident=classes)
strat[[1]]
strat[[2]] + ggplot2::coord_equal()
strat[[3]] + ggplot2::coord_equal()
strat[[4]] + ggplot2::coord_equal()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.