Open FelixTheStudent opened 2 years ago
While not implemented in cellpypes yet, here is code to achieve the same thing:
obj <- seurat %>%
pype_from_seurat() %>%
rule("Tcells", "CD3E", ">", 1) %>%
rule("Treg", "FOXP3", ">", .1, parent="Tcells") %>%
rule("Treg_eff","ICOS", ">", 1.5, parent="Treg") %>%
rule("Treg_mem","CCR7", ">", 1.5, parent="Treg")
# replace clusters 4,5 and 7 with cellpype labels:
pype_types <- as.character(classify(obj, c("Treg_eff", "Treg_mem")))
clusters <- as.character(seurat$seurat_clusters)
seurat$edited_clusters <- case_when(
clusters %in% c(4,5,7) ~ pype_types,
TRUE ~ clusters)
# plot result:
DimPlot(seurat, group.by = "edited_clusters")
Create an object slot where the user can put existing labels (e.g. output from Louvain, reference label transfer, etc.).
Write functions to:
parent
to therule
function and then we simply define subsets of these with cellpypes.