Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decompensate method for GatingHierarchy/GatingSet #333

Open
DillonHammill opened this issue Jun 25, 2020 · 2 comments
Open

Decompensate method for GatingHierarchy/GatingSet #333

DillonHammill opened this issue Jun 25, 2020 · 2 comments

Comments

@DillonHammill
Copy link
Contributor

DillonHammill commented Jun 25, 2020

Hi @mikejiang & @jacobpwagner,

I am looking into adding a decompensate method for GatingHierarchy/GatingSet objects in CytoExploreR, using the following approach:

# gs is uncompensated GatingSet - spill is spillover matrix
gs <- compensate(gs, spill)

# decompensate approach
cs_comp <- gs_cyto_data(gs)
cf_list <- lapply(cs_comp, function(fr){
   fr <- decompensate(fr, spill)
   flowFrame_to_cytoframe(fr)
})
names(cf_list) <- sampleNames(gs)
cs_decomp <- cytoset(cf_list)
gs_cyto_data(gs) <- cs_decomp

This works fine but still results in spillover matrices being extracted when calling gs_get_compensations(). Is there a way that I can tell it that the spillover matrices have been removed so that gs_get_compensations() returns NULL? Perhaps there is a better way to do this?

@jacobpwagner
Copy link
Member

jacobpwagner commented Jun 25, 2020

Hey @DillonHammill . We can maybe just add decompensate methods for cytoframe/cytoset and GatingHiearchy/GatingSet in to flowWorkspace, as well as the removal of the compensation from the GatingHierarchy/GatingSet. But first, what exactly is the use case? Our main concern is how we manage the state of transformations and gate definitions under the decompensation.

@DillonHammill
Copy link
Contributor Author

@jacobpwagner, within CytoExploreR I perform these operations at the cytoset level where I don't have to worry about gates, but I do make sure that the data is appropriately transformed at each step.

Since compensation usually occurs every early in the analysis pipeline, if you happen to apply the incorrect spillover matrix it means that you have to go all the way back to the initial GatingSet() call to fix this. This is because most users prefer to assign compensated/transformed/gated data under the same R object (e.g. gs) instead of creating separate objects for each step of the analysis pipeline (e.g. gs, gs_comp, gs_trans, gs_gated) - which makes it difficult to go backwards without having to start at the beginning. Since the transformation definitions are attached to the GatingSet it would be nice if there was a wrapper that inversed the transformations, decompensated the linear data and then re-applied the transformations. I am just trying to simplify this operation for users, I think many would prefer to use a decompensate() method that takes care of everything instead of having to start over.

I do use gs_get_compensations() to identify whether the data has been compensated in my cyto_spillover() functions, so if there is a decompensate() method it would be great if the spillover matrices would be removed from this output as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants