added region_annotations #161
Open
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 contains functions for several basic operations for spatial data analysis:
hp.sh.filter_by_morphology: Allows filtering a shapes layer based on morphological features (area, perimeter, circularity, ...). Can be used to clean cells after segmentation.
hp.sh.filter_by_shapes: Allows filtering a shapes layer based on a secondary shapes layer containing region annotation. Can be used to clean cells/polygons occurring in artifacts, outside of the tissue, etc..
hp.tb.filter_numerical: Allows filtering a table layer based on a numerical column in .obs. This is a generalization of hp.tb.filter_on_size.
hp.tb.filter_categorical: Allows filtering a table layer based on a categorical column in .obs.
hp.assign_cells_to_shapes: Allows determining whether a cell occurs in a region annotation. Creates a column or multiple columns in .obs.
hp.tb.compute_distance_to_shapes: Allows computing distances per cell to polygons in a shapes layer. Multiple modes are included to support different use-cases. E.g. computing distance of cell to nearest polygon, computing distances to all centroids of all polygons, ...
hp.sh.prep_region_annotations: Prepares region annotations in a shapes layer for
hp.sh.filter_by_morphology,hp.tb.assign_cells_to_shapesandhp.tb.compute_distance_to_shapes.These functions were tested for shapes and table layers occurring in the same coordinate space and no transformations were required. More challenging use-cases still need to be tested/supported.