Skip to content
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

readVizgen, multiple z-planes #60

Closed
heziqing opened this issue Jan 2, 2025 · 5 comments
Closed

readVizgen, multiple z-planes #60

heziqing opened this issue Jan 2, 2025 · 5 comments

Comments

@heziqing
Copy link

heziqing commented Jan 2, 2025

Hi, I am using readVizgen to read merfish data. The input files are as follows:
input_files

The cell_boundaries.parquet file has multiple z-planes.
planes
When I used the readVizgen function to read the MERFISH data, an error occurred.
sfe_mer <- readVizgen(dir_use, z = "all", image = "DAPI", add_molecules = TRUE,flip = "geometry", BPPARAM=BiocParallel::MulticoreParam(14, tasks = 80L,force.GC = FALSE, progressbar = TRUE))

sfe_mer <- readVizgen(dir_use, z = 3L, image = "DAPI", add_molecules = TRUE,flip = "geometry", BPPARAM=BiocParallel::MulticoreParam(14, tasks = 80L,force.GC = FALSE, progressbar = TRUE))
The error is:
Sanity checks on cell segmentation polygons:

..found 33680 cells with (nested) polygon lists
..applying filtering
..removing 25 empty polygons
Casting MULTIPOLYGON geometry to POLYGON
|============ | 18%
Error: BiocParallel errors
14 remote errors, element index: 4, 284, 571, 867, 1140, 1421, ...
22269 unevaluated and other errors
first remote error:
Error in st_geometry(polys[polys[[cell_ID]] %in% dupl_cells[i], ])[[which_keep]]: subscript out of bounds
In addition: Warning message:
In .filter_polygons(polys, min_area = 15, BPPARAM = BiocParallel::MulticoreParam(14, :
There are 53183 cells with multiple pieces in cell segmentation larger than min_area, whose first 10 indices are: 3, 4, 5, 9, 11, 13, 14, 15, 16, 17. The largest piece is kept.

How can I resolve this issue? Thanks in advances!

@heziqing
Copy link
Author

heziqing commented Jan 2, 2025

Even I filtered the cell boundaries by the third plane, the same error still occured.
error

@alikhuseynov
Copy link
Collaborator

Hi, could you please install this package using devel branch und see if the same error occurs?
Thanks

@heziqing
Copy link
Author

heziqing commented Jan 3, 2025

Thank you for your response. I will try the version you mentioned. However, I’d like to ask which function can be used to visualize molecules across all planes, similar to Seurat's function:
ImageDimPlot(vizgen.obj, molecules = "Slc17a7", nmols = 10000, alpha = 0.3, mols.cols = "red").
It seems that in Seurat, ImageDimPlot can only display molecules from a specific plane, such as those on the third layer.

@alikhuseynov
Copy link
Collaborator

Thank you for your response. I will try the version you mentioned. However, I’d like to ask which function can be used to visualize molecules across all planes, similar to Seurat's function:

ImageDimPlot(vizgen.obj, molecules = "Slc17a7", nmols = 10000, alpha = 0.3, mols.cols = "red").

It seems that in Seurat, ImageDimPlot can only display molecules from a specific plane, such as those on the third layer.

Yes, that is in Voyager, take a look at these recent workflows:
Xenium ->
https://pachterlab.github.io/voyager/articles/vig5_xenium.html
Vizgen ->
https://pachterlab.github.io/voyager/articles/vig6_merfish.html

lambdamoses added a commit that referenced this issue Jan 25, 2025
@lambdamoses
Copy link
Collaborator

lambdamoses commented Jan 25, 2025

I can reproduce this error on an example dataset from Vizgen. I think I found the culprit. It has nothing to do with z-planes. It's from matching integer64 cell IDs. The subscript is out of bound when when we get a wrong match using integer64; base R can only handle integer32. I edited the code to match using a string ID and it eliminated that error. See if it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants