openCyto's gate_quad_tmix broken when reading from gating template (and a bit more)
0
0
Entering edit mode
Pierre • 0
@80156b46
Last seen 2.6 years ago
Belgium

Hello,

I have been using openCyto to automate gating and we recently updated to one of the last versions.

Doing so, some gates stopped functioning from the gating templates, and few others were broken. Here is my take and how I corrected tmix to make it works, and I would also ask for some guidance given the next directions of your package's implementation if possible.

In gate_quad_tmix function, the tmix filter is first set up and then applied using filter. The problem is that the filter function exists both in stats and in dplyr packages, which seems to break the reference Could it be replaced by an explicit flowCore::filter(...) to avoid issue ?

gate_quad_tmix <- function (...){
...
  tmix_filter <- tmixFilter(parameters = channels, K = K, usePrior = usePrior,
                            prior = prior, trans = trans)
  tmix_results <- try(flowCore::filter(fr, tmix_filter), silent = F) #corrected line adding flowCore reference
...
}

Also, the filter seems not applicable to cytoframes, but only to flowframes. For my use in the gating templates, I took the code of gate_quad_tmix, and implemented the call to flowCore as above, and wrapped it into a registrable function with explicit transformation of the cytoFrame to the flowFrame :

.my_gate_quad_tmix <- function(fr, pp_res, channels = NA, ...){
  #print(channels)
  my_gate_quad_tmix(cytoframe_to_flowFrame(fr), channels = as.character(channels),...)
}

Finally, it was not sufficient for me to just register the name gate_quad_tmix. My wish was to use gate_quad_tmix is for instance with a ' * ' alias to get all populations directly.

alias,     pop,        parent,  dims,       gating_method,  gating_args, ....
"A,B,C,D",  *,          Lymph,  "CH1,CH2",  gate_quad_tmix, K=3,...

The problem is that the function .gating_gtMethod in file gating-methods.R is not understanding it any longer for the gating functions found in one of its line (it wants only +/- +/-, so only one population in alias, not the 4 ones ?)

 if(names(x) %in% c("quadGate.seq", "gate_quad_sequential", "quadGate.tmix", "gate_quad_tmix"))

Hence, I needed to trick the system by providing my own gating function name when registering (I used gate_quad_tmix3, which is pretty poor :-) )

register_plugins(fun = .my_gate_quad_tmix, methodName = "gate_quad_tmix3")

With all of that, I could retrieve the use of a tmix gate usable from a csv gating template, but it was a bit hard :-)

So my questions:

  • Would it be possible to have few adjustments in a next release so the openCyto functions can be readily used from a csv gating template?
  • Is there anything to know about further developments (e.g. cytoframe vs. flowframe) that would need to be considered when I am updating my stuffs so they would not be deprecated too fast ?

    Lastly, I wanted to thank you for the very nice set of packages in openCyto. Keep up the good work !

Pierre Lebrun

filter gate_quad_tmix gt_gating • 690 views
ADD COMMENT
0
Entering edit mode

I see no answer, so I am wondering if the issue is easy to get (I guess it's not).

I don't have data to share unfortunately, but just try a gate_quad_tmix with '*' pop reference from within a gating template, and you will have all the issues going one by one.

The first issues of filter is maybe related to me now using the package 'signals' (so it just needs to avoid the package conflict), and the cytoframe issue is a more related to recent openCyto updates which read cytoframe instead of flowframe, I believe.

Kindly,

Pierre

ADD REPLY

Login before adding your answer.

Traffic: 774 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6