Refactoring query functions
There are multiple ways (some still to be implemented) to subset/query a SpatialData object. Some of these methods are living outside this repo. We need to port them here and use a more consistent syntax (for instance always sdata.query.query_method).
- [ ] spatial query (bounding box query):
sdata.query.bounding_box() - [ ] spatial query (general polygon): not implemented yet
- [ ] query by obs: implemented in
napari-spatialdata, branchspatialdata - [ ] query by var: not implemented yet
- [ ] query by coordinate system:
sdata.filter_by_coordinate_system() - [ ] query by (a list of) element names: implemented in
spatialdata-plot
FYI @giovp @timtreis
Currently, the bounding_box_query doesn't automatically filter for elements within the target coordinate system. I think we should add that. We could just add a call to filter_by_coordinate_system to the beginning of the query. Thoughts?
Also:
- [ ]
SpatialData.subset()
Another point to consider, as observed in https://github.com/scverse/spatialdata/issues/443#issuecomment-1922027061, is that query functions that appear only as methods of SpatialData maybe be a bit hidden in the docs.
- [ ] Modules and functions of modules are better (or we can also put an explicit link to those methods in the docs).