Extend transform method to support gate objects #258
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@mikejiang, this PR extends the existing transform method for
flowFrame
andflowSet
objects to cover gate objects (rectangleGate
,polygonGate
,ellipsoidGate
,quadGate
andfilters
) as well. This change makes it easy to convert gate objects between the linear and transformed scales to match the scales of the data.Transformations are applied in place so that any gate attributes remain attached.
For ellipsoidGates, we can't maintain the geometry of the ellipse with transformation so instead we convert it to a
polygonGate
and then apply the transformers to thoseco-ordinates
- returning apolygonGate
instead of a transformedellipsoidGate
.I also found a bug with the parameters of ellipsoidGates - it returns a named vector unlike the parameters of other gate types which are unnamed. This means that if you try to combine ellipses with other gate types in the same set of dimensions into a
filters
object, the validFilters check throws an error when it shouldn't. I fixed this in the ellipsoidGate constructor by making sure the parameters stored without names.I haven't added support for
multiRangeGate
as they are only currently supported for Time channel which should never be transformed. I can add supportmultiRangeGate
later if required.I rendered the docs for
multiRangeGate
and added some additional tests to the testthat suite to make sure the gates are transformed appropriately.