-
Notifications
You must be signed in to change notification settings - Fork 30
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
Xenium Ranger 3.0.1.1 after Cellpose resegmentation - "ValueError: A linearring requires at least 4 coordinates." #245
Comments
Is there a temporary workaround to manually create the SpatialData data framework from Xenium ranger output? (I mean a tutorial/notebook/...) |
Nobody have an idea about how to resolve this issue? |
After updating to Xenium Ranger v3.1, still not working. `Traceback (most recent call last): File "./lib/python3.10/site-packages/spatialdata_io/_utils.py", line 46, in wrapper return f(*args, **kwargs) File "./lib/python3.10/site-packages/spatialdata_io/readers/xenium.py", line 232, in xenium polygons["cell_boundaries"] = _get_polygons( File "./lib/python3.10/site-packages/spatialdata_io/readers/xenium.py", line 349, in _get_polygons out = Parallel(n_jobs=n_jobs)( File "./lib/python3.10/site-packages/joblib/parallel.py", line 1918, in call return output if self.return_generator else list(output) File "./lib/python3.10/site-packages/joblib/parallel.py", line 1847, in _get_sequential_output res = func(*args, **kwargs) File "./lib/python3.10/site-packages/spatialdata_io/readers/xenium.py", line 341, in _poly return Polygon(arr[:-1]) File "./lib/python3.10/site-packages/shapely/geometry/polygon.py", line 230, in new shell = LinearRing(shell) File "./lib/python3.10/site-packages/shapely/geometry/polygon.py", line 104, in new geom = shapely.linearrings(coordinates) File "./lib/python3.10/site-packages/shapely/decorators.py", line 77, in wrapper return func(*args, **kwargs) File "./lib/python3.10/site-packages/shapely/creation.py", line 173, in linearrings return lib.linearrings(coords, out=out, **kwargs) ValueError: A linearring requires at least 4 coordinates.` |
Hi,
If you do you, you should certainly also modify the transcripts file and the count matrix; be careful not to modify your raw data, it can be a bit dangerous to do this ! |
Thanks @Lem-P for reporting and thanks @ConstensouxAlexis for sharing a workaround. @Lem-P does this solve your issue? If not, I'll be happy to have a look into this, but please I ask you to share a reproducible script running on some public data to be making it easier to inspect this. Thank you. |
I think this is issue is caused by Xeniumranger import-segmentation and by spatialdata. When I run xeniumranger with a custom segmentation (Baysor or CellPose), even if I make sure all my segmented cells can be casted to Polygon and have more than 4 vertices, Xeniumranger will create some cells with less than 4 vertices. I haven't figured out yet what could be the problem ! |
After segmentation with cellpose, I ran Xenium Ranger 3.0.1.1
xeniumranger import-segmentation --id=my_ID \ --xenium-bundle=$DIR/outs \ --nuclei=$DIR/outs/mask_nuclei.ome_cp_masks.tif \ --cells=$DIR/outs/mask_cells.ome_cp_masks.tif
When I try to read the output folder with spatialdata_io (0.1.7.dev5+g82ff327), spatialdata (0.2.7.dev7+gd746485)
sdata = spatialdata_io.xenium(dir)
I get this error:
"ValueError: A linearring requires at least 4 coordinates."
The text was updated successfully, but these errors were encountered: