Closed tessbrodie closed 2 years ago
Hi @tessbrodie
yes, you will need to download one gate per ROI and per cell type. It's implemented like this since we often detect patient specific staining differences or ROI specific effects such as a differential spatial overlap between markers. If you want to apply a defined gate across all cells you will need to load the shiny app without the masks and images and gate across all cells by setting an img_id
which is the same for all cells.
I'll think how to best implement what you suggest but it might not be straight forward. Thanks for the suggestion!
Thanks for the quick reply and I did not realize this could be on purpose, but I see your point. The issue here is how to do this when you have hundreds of ROI? We would like to try your idea of applying an img_id, but if we cannot see the individual masks and images from each ROI and if all cells are merged, it would be hard to do the gating. Is there a way you could add a button in the Shiny for applying the gates to all ROI?
Again, thanks so much for your great tools!
So you want to visually inspect the gate on all images? You can set the gate and the switch between images by clicking the right and left button or by selecting the image name. If you are happy with your gate either save one object and apply the gate (which is stored in metadata(spe)
) computationally to all your cells or open the app again and set the exact same gate. You see the boundaries directly under each plot.
Sorry for the late response and I think we would like to apply our gate (B cells, for example) computationally to all our cells but we don't know how to do this. Would you mind sharing an example of what the code might look like to do this?
Hi @tessbrodie,
so there are two ways:
sce$all <- "all"
cytomapperShiny(object = sce, img_id = "all", cell_id = "ObjectNumber")
then you gate all CD20+ cells
gate <- metadata(gated_sce)$cytomapper_gate_1$gate
Bcells <- assay(sce, "exprs")["CD20",] < gate["CD20","max"] & assay(sce, "exprs")["CD20",] > gate["CD20","min"]
Does that help?
That helps a lot, thanks Nils!
Thanks for your great IMC analysis tools and we tried copy pasting the script from the IMC data analysis workflow website for cytomapperShiny and everything seems to work fine until we look at the number of cells labeled per patient. Our gated populations only apply to one ROI each, instead of applying to all ROIs.
Number of cells labeled per patient
B cells 27 CD11b positive no F480 or Ly6G 0 CD31 endothelial cells 0 Cholangiocytes 0 Hepatocytes 0 Kupffer cells 0 LSECs 0 neutrophils 0 T cells 19 unlabeled 2547
B cells 0 CD11b positive no F480 or Ly6G 0 CD31 endothelial cells 0 Cholangiocytes 41 Hepatocytes 0 Kupffer cells 0 LSECs 0 neutrophils 0 T cells 0 unlabeled 2311
Are we supposed to download a given gate for each ROI in the shiny? Or did we need to edit the script to avoid this? Also, it would be really helpful if after you gate a population in the Shiny, the cells would be taken out of the gating scheme so you do not have this issue with doublets that you mention.
Thanks again for your help and support, Best, Tess