Streamline PathObject and simplify working with classifications #1593
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.
This PR removes some methods from
PathObject
that were previously deprecated.It also introduces
which now exist alongside the earlier methods
Having 3 different ways to set/get classifications may seem a bit much, but the intention is to make scripting as intuitive as possible. Each method has a different purpose:
PathClass
encapsulates everything about the classification: the different pieces (e.g. subclassifications) and the color; this is used internallyString
representation of thePathClass
; it can represent the key pieces (with a colon delimiter for subclassifications), but not the colorCD3: CD8
)In Groovy, checking if a cell has the derived classification "Tumor: Positive", and setting it to "Tumor: Negative" if not, would look like this:
I think the working with string is a bit less cumbersome and confusing than needing to add lots of
getPathClass()
lines. But it is more powerful with tricks like thisThe fact that
classification
andclassifications
differ by only a letter might be a bit confusing, but getting it wrong should throw an exception.... so hopefully the benefits are worth it.