-
Notifications
You must be signed in to change notification settings - Fork 49
Support for cells.zarr.zip for Xenium
#112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #112 +/- ##
==========================================
- Coverage 36.33% 35.94% -0.39%
==========================================
Files 18 18
Lines 1434 1516 +82
==========================================
+ Hits 521 545 +24
- Misses 913 971 +58
|
|
Tested on all the public Xenium versions using this https://github.com/giovp/spatialdata-sandbox/blob/main/tests/test_to_zarr_xenium.py |
src/spatialdata_io/readers/xenium.py
Outdated
| if morphology_focus: | ||
| morphology_focus_dir = path / XeniumKeys.MORPHOLOGY_FOCUS_DIR | ||
| files = {f for f in os.listdir(morphology_focus_dir) if f.endswith(".ome.tif")} | ||
| assert files == {XeniumKeys.MORPHOLOGY_FOCUS_CHANNEL_IMAGE.format(i) for i in range(4)} # type: ignore[str-format] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all v2.0.0 data has 4 channels. Xenium customers can run samples without the cell segmentation kit, in which case they will only have 1 ome.tif file in the morphology_focus_dir.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification, I will change the code to expect either the single DAPI channel either all the 4 channels.
If in the future also other cases are supported, such as an intermediate number of channels, I will adapt the code and make it general.
for more information, see https://pre-commit.ci
Co-authored-by: Matt Cai <matthew.cai@10xgenomics.com>
|
I applied the code suggestions and performed some additional cleanup. Also, I realized that the link between the labels indices for the cell segmentation and the instances of the rows required to parse additional data from I tested the code on the Xenium Analyzer versions 1.0.1, 1.0.2, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 2.0.0. One note on the new labels: the table is still mapped to the circles/shapes but the user can change the annotation target of the table to the labels using the new Using the multiscale labels instead of the shapes for visualizing the data not only improves the quality of the visualization over circles and polygons, but also doesn't compromise performance. Here is an example of the new (labels) vs old (circles) napari view. Full code to load the data, change the table and view the data. ##
import spatialdata as sd
from napari_spatialdata import Interactive
sdata = sd.read_zarr('data.zarr')
sdata['table'].obs['region'] = 'cell_labels'
sdata.set_table_annotates_spatialelement(
table_name='table',
region='cell_labels',
instance_key='cell_labels'
)
Interactive(sdata) |
Support for `cells.zarr.zip` for Xenium


Depends on #111 (should be merged first).
Closes #110
cells_summaryand adding it to the table