Closed wnkc closed 1 year ago
Take a look at cyto_stats_compute()
.
Hi @DillonHammill, thanks for the prompt response. My last message was not clearly phrased. I am trying to extract the ID's of the events that are within a gate (event number), not the number of events. I have an imaging flow cytometric dataset and am attempting to correlate the ID of each event with the photo ID. Is there a way of doing this in CytoExploreR?
See flowWorkspace's gh_pop_get_indices()
.
Thanks, this worked!
I am now dealing with a reverse problem: I have an array of events I want to give a different color in cyto_plot. Is there a way of doing this? I cannot seem to find anything in the R documentation of cyto_plot that does this.
@wnkc just pass the names of the nodes through the overlay
argument in cyto_plot()
.
The problem is, my population is not obtained through gating, it is a vector of events IDs that I confirmed through Image analysis to have the right morphology. I now want to see where these specific events lie in the FCM plots. Imagine the FCM data of a single experiment is a 2D dataframe,, where rows are the event ID and columns are the flow cytometric parameters that have been measured during the experiment. I want to subset this dataframe based on event IDs that I have in a different vector. Is there a quick way of doing this in CytoExploreR?
Import the data into a GatingSet and then convert event IDs into a filter that can be added to the GatingSet as a set of gates. If all your data is imported in a single FCS file:
# gs is the GatingSet with one sample
# ids is the column of ids from your data.frame
# convert ids to factor then a filter
ids <- as(factor(ids), "filterResult"))
# add the ids as a gate to GatingSet
gs_pop_add(gs, gate = ids, parent = "root")
# check gates have been added
cyto_nodes(gs)
If you have multiple samples in your GatingSet, you need to convert your ids into a list named with each sample in the GatingSet before giving it to gs_pop_add()
.
Finally, you can now pass the names of the populations to overlay
in cyto_plot()
for visualisation.
Hi @DillonHammill, I got it to work by making a logical vector indicating the indices that are "positive" events in my dataset as true. This, for each sample. And then indeed like you said adding it all in a list named with each sample. However it seems like cyto_plot_explore did not know how to handle this when adding it as an overlay or overlay_list argument (after adding it to the gatingset through gs_pop_add) so I plotted with a for loop exploring the parameters of interest.
I am familiarizing myself with the CytoExploreR package and would like to know how I can extract the event numbers of the events that are found within a gate. I have been trying to use cyto_extract but this yields a cytoframe dataframe I cannot seem to glean the data out of . Is there a quick way of reaching this goal? Thank you.
This is my code (basically copy pasted from the vignette); basically I am trying to obtain the event numbers that are found within the Single cells gate (NIL).