RGLab / openCyto

A package that provides data analysis pipeline for flow cytometry.
GNU Affero General Public License v3.0
75 stars 29 forks source link

Can we use Opencyto to gate cytotoxic T cell subsets using 3 markers? #213

Closed Sithara85 closed 4 years ago

Sithara85 commented 4 years ago

READ THIS BEFORE YOU OPEN AN ISSUE ASK YOURSELF THESE QUESTIONS

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Please use the reprex package (https://github.com/tidyverse/reprex) to provide a minimal reproducible example.
    • Include your sessionInfo()
  2. Please upload any data needed to reproduce the error.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

SessionInfo: Provide your sessionInfo() as part of your reprex

Additional context Add any other context about the problem here.

gfinak commented 4 years ago

Closing your issue since it doesn't follow the protocol.

Sithara85 commented 4 years ago

HI Greg, Sorry about that. As a newbie to Flowcytometry world I wanted some help to proceed. If this is not the forum for that could you please direct me to the correct space?

mikejiang commented 4 years ago

This is the right place to post question. But you should try best to follow the issue template to compose it. At the very least, the main content of your question should be put into the issue body instead of the title.

Sithara85 commented 4 years ago

What would be the best strategy to gate cytotoxic T cell subsets? For example: in my case I would use three markers to gate them in FlowJo, I thought we can use K means clustering. Can we use Registerplugin to use K means in OpenCyto? Please suggest a best solution you can think of ? We have gated T cell pop in our samples to cytotoxic and Helper using OpenCyto.

gfinak commented 4 years ago

Have you worked through the package vignettes and online documentation at cytoverse.org? Do you have done code to share as a starting point?

Sithara85 commented 4 years ago

I haven't explored cytoverse.org. I will do some more learning and will make a new issue with more details. Thank you for your help!

jacobpwagner commented 4 years ago

I'm actually not sure if we have a good example for this sort of thing easily discoverable right now. You can add simple clustering results using a factor of the clustering results passed to flowWorkspace::gs_pop_add. Just keep in mind for a GatingSet that you will need a factor for each sample and the list will need the sample names:

library(flowCore)
library(flowWorkspace)
dataDir <- system.file("extdata",package="flowWorkspaceData")
gs <- load_gs(list.files(dataDir, pattern = "gs_manual",full = TRUE))
gh <- gs[[1]]
fr <- gh_pop_get_data(gh, "CD3+")
markers <- c("CD4", "CD8", "CD3")
channels <- sapply(markers, function(marker){
  getChannelMarker(fr, marker)$name
})
kmeans_results <- kmeans(exprs(fr)[,channels], centers = 3)
cluster_gate <- list(as.factor(kmeans_results$cluster))
names(cluster_gate) <- sampleNames(gs)
# A named list of factors (just length 1 in this case)
cluster_gate

gs_pop_add(gs, cluster_gate, parent = "CD3+", name = "kmeans")
recompute(gs)
plot(gs, "CD3+")

For a sketch of how to add factor output to a method added to openCyto using register_plugins, see: https://rpubs.com/wjiang2/320381. This also shows how to incorporate multiple filter results in a single method: https://rpubs.com/wjiang2/188182.

jacobpwagner commented 4 years ago

@Sithara85 , @mikejiang just put together a great example ("clustering gating by kmeans") and it is now available from https://cytoverse.org/examples/index.html under the openCyto tab. Sorry that page is still a little bare. We're still in the process of selecting/updating examples and getting them hooked in.

Sithara85 commented 4 years ago

Hi Jake,

That’s awesome! You have done a great job. While I was wondering whether K means clustering is the best solution in a scenario where we have three markers and you have implemented it with OpenCyto. Thank you very much!!

Best, Sithara

On Fri, Jun 26, 2020 at 3:37 PM Jake Wagner notifications@github.com wrote:

@Sithara85 https://github.com/Sithara85 , @mikejiang https://github.com/mikejiang just put together a great example ("clustering gating by kmeans") and it is now available from https://cytoverse.org/examples/index.html under the openCyto tab. Sorry that page is still a little bare. We're still in the process of selecting/updating examples and getting them hooked in.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/RGLab/openCyto/issues/213#issuecomment-650389247, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH3B7SYUZCHGYO2WHAWSYFTRYUBKLANCNFSM4OIWO7YA .

--

With regards,

Sithara Vivek,

Mobile - 224 522 2289

jacobpwagner commented 4 years ago

Good to hear. And yeah, the idea of that example is that it will show how to use register_plugins to hook in any k-level factor result from a clustering algorithm using any n channels, not necessarily just kmeans. And all credit goes to @mikejiang on that one :-)

Sithara85 commented 4 years ago

Thank you very much Mike!!

On Mon, Jun 29, 2020 at 11:38 PM Jake Wagner notifications@github.com wrote:

Good to hear. And yeah, the idea of that example is that it will show how to use register_plugins to hook in any k-level factor result from a clustering result using any n-factors, not necessarily just kmeans. And all credit goes to @mikejiang https://github.com/mikejiang on that one :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/RGLab/openCyto/issues/213#issuecomment-651528164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH3B7S2E34K56Z5XF3LLTFLRZFT37ANCNFSM4OIWO7YA .

--

With regards,

Sithara Vivek,

Mobile - 224 522 2289