RGLab / openCyto

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

gating vs gt_gating #204

Closed bjreisman closed 5 years ago

bjreisman commented 5 years ago

Hi openCyto team, I recently installed R on a new computer and ran into issues running older code as follows.

> exp_info$gates
--- Gating hieararchy parsed from GatingML: 
    with  5  populations defined
> myflowset <- read.flowSet(file = fcsunzip.paths)
> mygatingset <- GatingSet(myflowset)
................................................................................................................................................................................................done!
> mygatingset_compesated <- compensate(mygatingset, exp_info$compensations$JB)
> mygatingset_scaled <- transform(mygatingset_compesated, exp_info$transforms)
> markernames(mygatingset_scaled) <- exp_info$panels$`Panel 1`
> gating(exp_info$gates, mygatingset_scaled)
Debris
Intact
Singles
Viable
Barcoded
................................................................................................................................................................................................done!
> mygatingset_scaled
A GatingSet with 192 samples
> 

This code worked just fine on my older computer running openCyto 1.21.4, but when I tried it on a newer computer running the newest version of openCyto from bioconductor I ran into the follow error:

>openCyto::gating(exp_info$gates, mygatingset_scaled)
Error in UseMethod("gt_gating") :
  no applicable method for 'gt_gating' applied to an object of class "c('graphGML', 'graphNEL', 'graph', 'graphBase')"
In addition: Warning message:
'openCyto::gating' is deprecated.
Use 'gt_gating' instead.
See help("Deprecated")

Inspecting that object, I see that it's a graphGML object from CytoML

> class(exp_info$gates)
[1] "graphGML"
attr(,"package")
[1] "CytoML"

...and the gt_gating function seems to expect a gating template.

I might have missed it, but has something changed about how gates are represented and handed in the openCyto ecosystem? If so, how do I go about getting this code working? Would you consider adding back the old gating() function to keep the old method working?

jacobpwagner commented 5 years ago

That particular gating method lives in CytoML. Try removing the openCyto namespace specification on your openCyto::gating call and either library(CytoML) first or explicitly specify CytoML::gating.

jacobpwagner commented 5 years ago

This was working before because the gating generic in openCyto was dispatching to the graphGML-specific method in CytoML. That changed with the API changeover. @mikejiang , do you think we should rename CytoML::gating at all to avoid the confusion?

bjreisman commented 5 years ago

Ah, I should have mentioned that. When I dropped the openCyto:: it couldn’t find the function in cytoML, and it appears that the latest version of cytoML doesn’t export a gating() function. Is there a post or vignette describing the new API?

Get Outlook for iOShttps://aka.ms/o0ukef


From: Jake Wagner notifications@github.com Sent: Wednesday, November 20, 2019 3:18:54 PM To: RGLab/openCyto openCyto@noreply.github.com Cc: Reisman, Benjamin benjamin.reisman@vanderbilt.edu; Author author@noreply.github.com Subject: Re: [RGLab/openCyto] gating vs gt_gating (#204)

This was working before because the gating generic in openCyto was dispatching to the graphGML-specific method in CytoML. That changed with the API changeover. @mikejianghttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmikejiang&data=02%7C01%7Cbenjamin.reisman%40vanderbilt.edu%7Cae1fe8738b104fc2b01708d76dff3ffe%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C637098815371187120&sdata=sXdjuXaL4iWrBz%2Bm5%2FKiFoU2NUvuoNz%2FwuISrOE8eEY%3D&reserved=0 , do you think we should rename CytoML::gating at all to avoid the confusion?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FRGLab%2FopenCyto%2Fissues%2F204%3Femail_source%3Dnotifications%26email_token%3DAFL4HOBJRQXLGKYB3Z3C3DLQUWST5A5CNFSM4JPZGED2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEVCJ5A%23issuecomment-556410100&data=02%7C01%7Cbenjamin.reisman%40vanderbilt.edu%7Cae1fe8738b104fc2b01708d76dff3ffe%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C637098815371197083&sdata=%2BP41XROMZegElqhhV16S8B5XKwaVZchuGoqOUdVWR7Y%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAFL4HOHP4X5EASXSGQ7CBP3QUWST5ANCNFSM4JPZGEDQ&data=02%7C01%7Cbenjamin.reisman%40vanderbilt.edu%7Cae1fe8738b104fc2b01708d76dff3ffe%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C637098815371197083&sdata=rbHMZkXlHsPvy7d1cDfnjeIjwTBcKKz4NJUWKx7LY2A%3D&reserved=0.

mikejiang commented 5 years ago

I don't think CytoML::gating is public API

jacobpwagner commented 5 years ago

@bjreisman, a number of methods were recently renamed across our core packages (flowWorkspace, openCyto, CytoML) and the old names were deprecated. However, those methods are still available and should simply produce a deprecation warning like the one you encountered rather than an error. For each package there is also a help doc summarizing the changes line by line that you can access by help("<package name>-deprecated"), but we still have to finish this up for CytoML.

The problem you ran in to is a little bit different because it was relying on the deprecated gating generic from flowWorkspace. I'll add a deprecation note specifying the rename from CytoML::gating (for a graphGML object) to CytoML::gating_graphGML. I'll close this once I complete those necessary doc updates.

jacobpwagner commented 5 years ago

Done in https://github.com/RGLab/CytoML/commit/ec688d8d5d60be6aa094f29dd94e768dee68b00e. help("CytoML-deprecated") should now work as expected.

bjreisman commented 5 years ago

Awesome! Thanks for your work on this, looking forward to exploring the new API.