Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existing labels #16

Open
FelixTheStudent opened this issue Mar 18, 2022 · 1 comment
Open

Existing labels #16

FelixTheStudent opened this issue Mar 18, 2022 · 1 comment

Comments

@FelixTheStudent
Copy link
Owner

FelixTheStudent commented Mar 18, 2022

Create an object slot where the user can put existing labels (e.g. output from Louvain, reference label transfer, etc.).

Write functions to:

  • manually edit selected clusters. Specifically, a vector of existing classes could be supplied as parent to the rule function and then we simply define subsets of these with cellpypes.
  • rename classes
  • group classes together (see issue Function: group_classes (OR logic for rules) #8)
@FelixTheStudent
Copy link
Owner Author

FelixTheStudent commented Jun 14, 2022

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")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant