spatialdata icon indicating copy to clipboard operation
spatialdata copied to clipboard

Refactoring query functions

Open LucaMarconato opened this issue 2 years ago • 3 comments

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, branch spatialdata
  • [ ] 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

LucaMarconato avatar Apr 13 '23 13:04 LucaMarconato

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?

kevinyamauchi avatar Apr 13 '23 21:04 kevinyamauchi

Also:

  • [ ] SpatialData.subset()

LucaMarconato avatar Jan 09 '24 16:01 LucaMarconato

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).

LucaMarconato avatar Feb 01 '24 19:02 LucaMarconato