Feature: Updates for Space Ranger 4.0#9978
Conversation
|
@jsicherman it would be great if you could have a look at this. |
|
|
||
| st_coords <- merge( | ||
| as.data.frame(sf::st_coordinates(coordinates)), | ||
| data.frame( |
There was a problem hiding this comment.
Agree with OP that it would be nice to have a CreateFOV.sfc or similar that allows this construction without having to do two round trips through polygon construction. Not sure if such a method already exists in Seurat
| ) | ||
| { | ||
|
|
||
| image <- png::readPNG(source = file.path(image.dir, image.name)) |
There was a problem hiding this comment.
Yeah, we need to get the tissue image in there at some point so I left it in.
| segmentation.fov <- Read10X_Segmentations(image.dir = paste0(seg.data.dir, "spatial"), data.dir = data.dir, cell.names = segmentation.count.cellIDs) | ||
| segmentation.object[["slice1.polygons"]] <- segmentation.fov | ||
| object <- merge(x = object, y = segmentation.object) | ||
| DefaultAssay(object = object) <- segmentation.assay.name |
There was a problem hiding this comment.
I'm not sure if it's intuitive to have this create two assays and merge them together, rather than just one or the other. Will defer to you since you look at this data more, though.
Also, this output won't exist for Visium SD, which is also loaded through this preprocessing function, right? Should we raise a more informative error in those cases?
| if(load.segmentations) { | ||
| segmentation.assay.name <- "Segmentations" | ||
| seg.data.dir <- paste0(data.dir, "/segmented_outputs/") | ||
| seg.counts.path <- paste0(seg.data.dir, "filtered_feature_cell_matrix.h5") |
|
@stephenwilliams22 what do you mean when you say the polys aren't plotted correctly? Are they not closed, or merged together or something? |
I'm not totally sure but if you look here they just look like balls of twine.
|
|
@stephenwilliams22 looks like the vertices aren't ordered sequentially, which is weird if you could construct and plot them without issue in your original sfc? But also, how many vertices do you have per cell segmentation? Might be worth simplifying them if they're as complex as that screenshot seems to imply |
fixed. ordering was the issue |
|
Hey @stephenwilliams22, I am trying to test the new Load10x_Spatial and Read10x_Segmentations functions with a sample V3D object (https://www.10xgenomics.com/datasets/visium-hd-three-prime-mouse-embryo-fresh-frozen). Currently I am running into the following issue: If I do not specify an image in Load10X_Spatial ie: Then I get the following error when trying to run Load10X_Spatial: It seems that without an image, the function tries to automatically call Read10X_Image() which attempts to locate a spatial/tissue_positions.parquet file, which does not exist for V3D objects. I was able to get Read10X_Segmentations working on this V3D object however:
|
@YoukaiFromAccounting you do not need to use The |
|
@stephenwilliams22 Thanks for your help; I was able to get it working (I also switched to a smaller V3D dataset https://www.10xgenomics.com/datasets/visium-hd-three-prime-zebrafish-head-fresh-frozen). I am able to get a visualization if I run the following: |
Very cool! Do you think you all can take it from here to get the tissue image in the background? I think we also need to test if the regular data normalization workflow is working properly. Also, I'm wondering if this should be rewritten to use |
|
@stephenwilliams22 I'm not quite sure what you mean by using geom_sf; do you mean extracting the segmentation polygons from an sf object and plotting those with ggplot instead of using ImageDimPlot? |
Sorry, what i meant was in reference to my last checkbox at the top of the page. Right now we are implementing this in a Xenium fashion which does some back and forth making the polygons which are already in an |
|
Hi Stephen - we've been looking over this. Do you have example code (doesn't have to use Seurat at all) for
If you have this, we can certainly take the lead as using that as a prototype for updating the Seurat functions. |
|
How is this work progressing? |
|
We recommend that individuals interested in this update check out our Discussions board at (#9991) for questions/concerns users may have. |




Updates include helpers and readers for Space Ranger cell segmentation.
Integrates 10x cell segmentations of visium HD data into the Seurat object.
Issues
geom_sfinSpatialFeaturePlotI think that would be more desirable as this will automatically hold the tissue image as well