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

Extracting entire gatingTemplate from GatingSet #179

Closed DillonHammill closed 6 years ago

DillonHammill commented 6 years ago

Hi @gfinak and @mikejiang,

Is there an easy way to extract the entire gatingTemplate from a GatingSet/GatingHierachy? I am aware of templateGen but I need to extract gating_method and gating_args as well.

Regards, Dillon

gfinak commented 6 years ago

There is no gating method or gating args associated with a gating set. It's not possible to reconstruct the template with full arguments and gating methods directly at this time.

Greg Finak

On Wed, Jul 18, 2018, 18:58 Dillon Hammill notifications@github.com wrote:

Hi @gfinak https://github.com/gfinak and @mikejiang https://github.com/mikejiang,

Is there an easy way to extract the entire gatingTemplate from a GatingSet/GatingHierachy? I am aware of templateGen but I need to extract gating_method and gating_args as well.

Regards, Dillon

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/RGLab/openCyto/issues/179, or mute the thread https://github.com/notifications/unsubscribe-auth/ABUkeZBUkP321iHVnrkZkXSnJKkqrZONks5uH9nDgaJpZM4VVlps .

DillonHammill commented 6 years ago

Ok, thank you. I have a workaround for the meantime.

Cheers, Dillon

DillonHammill commented 6 years ago

It would be nice if the add_pop entries were attached to the GatingSet as you add them in a gs@template slot for example. Then the entire template can be extracted from the GatingSet. Maybe this might be possible?

mikejiang commented 6 years ago

add_pop returns a row of the current gating information and you can use rbind to collect and build the template as you go

DillonHammill commented 6 years ago

Hi @mikejiang,

Yes this is how I construct the template normally, I am just wondering if there is way to get this information from the GatingSet directly if you don't have access to the template?

I think I can add the add_pop entries to a new slot in the GatingSet as I construct the gates? something like this...

row <- add_pop(gs, alias, pop, dims etc.)
gs@template <- row

# New entry
row2 <- add_pop(gs, alias, pop, dims etc.)
gs@template <- rbind(gs@template,row2)

# Extract the entire template from gs
template <- gs@template
mikejiang commented 6 years ago

GatingSet was designed as the lower level of data structure that stores the tree of actual gates and intended to be agnostic about how these gates were generated (by template or by parsing xml). I am not sure if it is the best thing to do by adding template information to GatingSet.

DillonHammill commented 6 years ago

I guess the best way is to go through saving and reloading the gatingTemplate csv file?

template <- add_pop(gs, ....)
write.csv(template, "gatingTemplate.csv")

# Load in file and add gate
template <- read.csv("gatingTemplate.csv")
template <- rbind(template, add_pop(gs, ...))
DillonHammill commented 6 years ago

@mikejiang is it possible to extract gates directly from the GatingSet?

DillonHammill commented 6 years ago

getGate() can be used to extract gates from GatingSet