scverse / spatialdata

An open and interoperable data framework for spatial omics data
https://spatialdata.scverse.org/
BSD 3-Clause "New" or "Revised" License
237 stars 45 forks source link

change channel names #786

Closed melonora closed 14 hours ago

melonora commented 1 week ago

Closes #750

This PR allows for either changing the channel_names by means of a static method on a image SpatialElement or in case of an element in the Spatialdata object a method taking as parameter the element name.

Also when channel names get written the metadata on disk is updated.

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 89.33333% with 8 lines in your changes missing coverage. Please review.

Project coverage is 91.80%. Comparing base (62e4699) to head (d8cd38e). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/spatialdata/models/_utils.py 83.33% 3 Missing :warning:
src/spatialdata/_core/spatialdata.py 91.66% 2 Missing :warning:
src/spatialdata/_io/_utils.py 92.30% 1 Missing :warning:
src/spatialdata/_utils.py 88.88% 1 Missing :warning:
src/spatialdata/transformations/operations.py 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #786 +/- ## ========================================== - Coverage 91.84% 91.80% -0.05% ========================================== Files 45 45 Lines 6893 6954 +61 ========================================== + Hits 6331 6384 +53 - Misses 562 570 +8 ``` | [Files with missing lines](https://app.codecov.io/gh/scverse/spatialdata/pull/786?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse) | Coverage Δ | | |---|---|---| | [src/spatialdata/\_core/operations/map.py](https://app.codecov.io/gh/scverse/spatialdata/pull/786?src=pr&el=tree&filepath=src%2Fspatialdata%2F_core%2Foperations%2Fmap.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL3NwYXRpYWxkYXRhL19jb3JlL29wZXJhdGlvbnMvbWFwLnB5) | `97.77% <100.00%> (ø)` | | | [src/spatialdata/\_core/operations/transform.py](https://app.codecov.io/gh/scverse/spatialdata/pull/786?src=pr&el=tree&filepath=src%2Fspatialdata%2F_core%2Foperations%2Ftransform.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL3NwYXRpYWxkYXRhL19jb3JlL29wZXJhdGlvbnMvdHJhbnNmb3JtLnB5) | `90.82% <100.00%> (ø)` | | | [src/spatialdata/\_io/io\_raster.py](https://app.codecov.io/gh/scverse/spatialdata/pull/786?src=pr&el=tree&filepath=src%2Fspatialdata%2F_io%2Fio_raster.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL3NwYXRpYWxkYXRhL19pby9pb19yYXN0ZXIucHk=) | `96.06% <100.00%> (ø)` | | | [src/spatialdata/models/\_\_init\_\_.py](https://app.codecov.io/gh/scverse/spatialdata/pull/786?src=pr&el=tree&filepath=src%2Fspatialdata%2Fmodels%2F__init__.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL3NwYXRpYWxkYXRhL21vZGVscy9fX2luaXRfXy5weQ==) | `100.00% <ø> (ø)` | | | [src/spatialdata/models/models.py](https://app.codecov.io/gh/scverse/spatialdata/pull/786?src=pr&el=tree&filepath=src%2Fspatialdata%2Fmodels%2Fmodels.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL3NwYXRpYWxkYXRhL21vZGVscy9tb2RlbHMucHk=) | `87.78% <100.00%> (+0.02%)` | :arrow_up: | | [src/spatialdata/\_io/\_utils.py](https://app.codecov.io/gh/scverse/spatialdata/pull/786?src=pr&el=tree&filepath=src%2Fspatialdata%2F_io%2F_utils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL3NwYXRpYWxkYXRhL19pby9fdXRpbHMucHk=) | `87.22% <92.30%> (+0.39%)` | :arrow_up: | | [src/spatialdata/\_utils.py](https://app.codecov.io/gh/scverse/spatialdata/pull/786?src=pr&el=tree&filepath=src%2Fspatialdata%2F_utils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL3NwYXRpYWxkYXRhL191dGlscy5weQ==) | `87.41% <88.88%> (+0.09%)` | :arrow_up: | | [src/spatialdata/transformations/operations.py](https://app.codecov.io/gh/scverse/spatialdata/pull/786?src=pr&el=tree&filepath=src%2Fspatialdata%2Ftransformations%2Foperations.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL3NwYXRpYWxkYXRhL3RyYW5zZm9ybWF0aW9ucy9vcGVyYXRpb25zLnB5) | `88.40% <50.00%> (-0.43%)` | :arrow_down: | | [src/spatialdata/\_core/spatialdata.py](https://app.codecov.io/gh/scverse/spatialdata/pull/786?src=pr&el=tree&filepath=src%2Fspatialdata%2F_core%2Fspatialdata.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL3NwYXRpYWxkYXRhL19jb3JlL3NwYXRpYWxkYXRhLnB5) | `90.88% <91.66%> (+<0.01%)` | :arrow_up: | | [src/spatialdata/models/\_utils.py](https://app.codecov.io/gh/scverse/spatialdata/pull/786?src=pr&el=tree&filepath=src%2Fspatialdata%2Fmodels%2F_utils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scverse#diff-c3JjL3NwYXRpYWxkYXRhL21vZGVscy9fdXRpbHMucHk=) | `90.41% <83.33%> (-1.03%)` | :arrow_down: |

🚨 Try these New Features:

LucaMarconato commented 1 day ago

Looks great! Three further minor comments: