Fix: Critical updates for Seurat v5, spacexr 2.0, and robust spot alignment#266
Fix: Critical updates for Seurat v5, spacexr 2.0, and robust spot alignment#266Atakannl wants to merge 7 commits intoBIMSBbioinfo:mainfrom
Conversation
|
Thanks so much for the PR @Atakannl, I will review this one with my use cases and get back to you! Artür |
|
Dear @Atakannl, thanks so much for the PR. Can you take a look at my review and correct if can. In summary, i do not believe we should implicitly join layers of a Seurat object. I would rather mention this in the documentation/tutorial, you can attempt this for the doc/rmd of the website which is here in the package too. I would explain that people who use v5 should join layers first (I find the need to do VoltRon/docs/nicheclustering.Rmd Lines 289 to 311 in ecd8f23 |
- Removed the implicit layer joining - Added validation for multi-layer assays - Require user to run JoinLayers before deconvolution
|
Thanks for the suggestion @Artur-man . I removed the implicit JoinLayers call and now explicitly check for multi-layer assays in Seurat v5. If multiple layers are detected, the user is instructed to run JoinLayers beforehand. No automatic layer modification is performed anymore. I will also add a note to the documentation for Seurat v5 users. |
|
I added the Seurat v5 compatibility note to both RCTD sections in the niche clustering vignette. The documentation now explicitly states that users must run |
|
@Atakannl thanks so much. I have left some comments I think this PR would make VoltRon comply with Seurat v5 and recent version of spacexr. We should only make the PR a bit cleaner and reduce unnecessary if statements, otherwise I like it. If you like I can resolve the conflicts for you, then you can continue updating. |
|
That would be great, @Artur-man, thank you. I will continue refining the conditional logic once the conflicts are resolved. |
|
@Atakannl ready for you now. Let me know if you have any questions. |
Hi VoltRon team,
While utilizing getDeconvolution() for a GBM spatial analysis, I encountered breaking compatibility issues with Seurat v5 (layer handling) and spacexr 2.0+ (Reference object requirements).
This PR implements the following fixes to modernize the vrDeconvolution module while maintaining strict backward compatibility:
Seurat v5 Support: Added a check for JoinLayers to correctly handle count retrieval (layer="counts" vs slot="counts"), fixing the "slot 'counts' not found" error.
spacexr 2.0 Compliance:
Implemented the native spacexr::Reference constructor for v2.0+ users.
Updated getRCTD to use the SpatialRNA constructor with data.frame coordinates (required by v2.0).
Preserved the legacy SpatialExperiment path for users on older versions.
Robust Spot Alignment: Added logic to align RCTD results back to the original VoltRon spot IDs. This fixes issues where RCTD drops spots during QC or sanitizes barcodes (e.g., changing - to .), which previously resulted in dimension mismatches or silent data loss.
Safety Validations:
Added explicit checks for sc.cluster existence in metadata to prevent cryptic errors.
Added hard failure stops if spot alignment finds zero matches.
I have verified these fixes on a merged GBM cohort using both Seurat v5 and spacexr v2.2.1.
Thanks for the great tool!