Open jacobpwagner opened 4 years ago
I think I have a question in a similar vein as the issue here, involving use of gh transformations. My goal is to obtain transformed axis breaks from a gatingset, which can then be piped to ggcyto. If there's a better way of accomplishing this task I'd appreciate any advice!
First question: Is there an easier way to get a single channel from all samples in a GatingSet? Included here is a reprex starting with a gatingset, and my initial attempt which can probably be vectorized or replaced with a gs function (suggestions would be appreciated):
data(GvHD)
fs <- GvHD[1:5]
gs <- fs %>% flowSet_to_cytoset() %>% GatingSet()
gs.markers <- gs %>% markernames()
gs.ff <- gs %>% gs_cyto_data() %>% cytoset_to_list() %>% lapply(cytoframe_to_flowFrame)
data.ff <- gs %>% gs_cyto_data() %>% cytoset_to_list() %>% lapply(cytoframe_to_flowFrame)
ff.cols <- data.ff %>% lapply(colnames) %>% Reduce(intersect, .)
data.raw <- vector('list'); i <- 1
for (c in which(ff.cols %in% names(gs.markers))) {
data.raw[[i]] = gs.ff %>% lapply(function(ff) ff[, c])
i<-i+1
}
data.pars.fs <- data.pars.ff %>% lapply(flowSet)
To complete this convoluted approach, the next step would be to obtain min/max axis breaks from this list of flowSets containing a single parameter. I considered doing this by splitting the flowset back to flowframes then following the below example in flow_breaks
documentation:
fr <- GvHD[[1]]
trans <- logicleTransform()
inv <- inverseLogicleTransform(trans = trans)
myBrks <- flow_breaks(data.raw, equal.space = TRUE, trans = trans, inv = inv)
I'm guessing there's probably a better way to do most of this. Thanks in advance!
The title pretty much describes it. If a user wants to alter the transformation on a single channel, the options currently available are:
cytoset
by usinginverse.transform
flag, changing the single transformation, then re-applying the forward transformation to all channels.gh_get_transformations
to get the transformationscytoset
and inverse transforming it using atransformList
containing the single inversecytoset
with the new transformationflowWorkspace:::set_transformations
to set the transformations for theGatingSet
so the gate coordinates are appropriately transformedOption 1 is a little easier for users to put together, but it's significantly less efficient because it requires inverting and re-transforming all channels. Option 2 is more efficient in that it only does the inversion and re-transformation of a single channel, but it is more onerous for users.
Neither is ideal, and this is likely to be a fairly common operation so we should make it easier and more efficient. This may also be another reason to consider storing the data at the raw scale, as then this just requires changing the transformation object for the channel of interest, which will be applied when it is needed.