RGLab / cytolib

c++ library for representing and interacting the gated cytometry data structure
GNU Affero General Public License v3.0
12 stars 11 forks source link

Rework time channel scaling #33

Closed jacobpwagner closed 4 years ago

jacobpwagner commented 4 years ago

This is sort of a post-mortem issue to wrangle related commits to cytolib, flowWorkspace, and CytoML to address the following and provide some rationale to our future selves:

Before these commits, flowWorkspace::gh_apply_to_new_fcs was calling flowWorkspace:::.cpp_NewGatingSet, which in turn was automatically scaling the time channel by the factor in the $TIMESTEP keyword from the sample FCS:

https://github.com/RGLab/cytolib/blob/4a03d9920224db44171a9eb2d77a6c318829241c/src/GatingSet.cpp#L354

This makes sense if the source for the template GatingHierarchy for gh_apply_to_new_fcs originated in FlowJo where this scaling is standard. But otherwise, this results in a perhaps unexpected scaling of the time channel for the new samples relative to the template GatingHierarchy. Furthermore, there would be no intrinsic history of whether this transformation had already been applied, meaning using a result itself as a template would result in further rescaling.

For these reasons, it made sense to instead add the time channel transformation back as a separate transformation object during FlowJo parsing in CytoML. This in turn required some changes to cytolib::scaleTrans to handle a scale transformation based on a single floating point factor (as opposed to two ints). That in turn required some changes to the protocol buffers.

jacobpwagner commented 4 years ago

@wfulp, feel free to post here if anything looks amiss and I'll link any more necessary commits.