-
Notifications
You must be signed in to change notification settings - Fork 493
Add ImageDimPlot, ImageFeaturePlot to Seurat Visualize #7501
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
base: main
Are you sure you want to change the base?
Conversation
… seurat Co-authored-by: Ona <no-reply@ona.com>
Co-authored-by: Ona <no-reply@ona.com>
tools/seurat/macros.xml
Outdated
| <param argument="smooth" type="boolean" truevalue="TRUE" falsevalue="FALSE" checked="false" label="Smooth the graph"/> | ||
| </xml> | ||
| <xml name="plot_boundaries"> | ||
| <param argument="boundaries" type="text" optional="true" value="" label="Boundaries" help="A vector of segmentation boundaries per image to plot"/> |
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.
can you please give an example of such vector in the help text?
tools/seurat/macros.xml
Outdated
| <param argument="boundaries" type="text" optional="true" value="" label="Boundaries" help="A vector of segmentation boundaries per image to plot"/> | ||
| </xml> | ||
| <xml name="plot_molecules"> | ||
| <param argument="molecules" type="text" optional="true" value="" label="Molecules" help="A vector of molecules to plot"/> |
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.
also an example vector in the help text
tools/seurat/macros.xml
Outdated
| </xml> | ||
| <xml name="plot_molecules"> | ||
| <param argument="molecules" type="text" optional="true" value="" label="Molecules" help="A vector of molecules to plot"/> | ||
| <param argument="mols_size" type="float" value="0.1" label="Point size for molecules" help="(mols.size)"/> |
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.
is there min, max?
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.
No min and max here. It has nmols that work as max, but this is only used for imagedimplot and not for imagefeatureplot, so I can't add it to the macros as one
tools/seurat/macros.xml
Outdated
| <param name="mols_alpha" type="float" value="1.0" min="0.0" max="1.0" label="Alpha value for molecules" help=""/> | ||
| </xml> | ||
| <xml name="plot_nmols"> | ||
| <param name="nmols" type="integer" value="1000" label="Max number of each molecule specified in `molecules` to plot" help=""/> |
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.
min, max?
tools/seurat/plot.xml
Outdated
| #if $method.plot.cols.cols == 'one' | ||
| cols = '$method.plot.cols.cols', | ||
| #else if $method.plot.cols.cols == 'more' | ||
| cols = c(unlist(strsplit(gsub(" ", "", '$method.plot.cols.cols_more'), ","))), |
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.
is there a select param missing in the xml with one and more values?
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.
removed this option and made it a vector, no need to specify
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.
Pull request overview
This pull request adds support for spatial transcriptomics visualization in Seurat by introducing two new plotting functions: ImageDimPlot for visualizing clusters or categorical groupings in a spatial context, and ImageFeaturePlot for visualizing gene expression in a spatial context. The PR also refactors some existing macro definitions to improve code reuse.
Key Changes:
- Added
ImageDimPlotandImageFeaturePlotmethods with comprehensive parameter support including FOV selection, boundary visualization, molecule overlays, and spatial-specific styling options - Refactored common plot parameters into reusable XML macros (e.g.,
plot_na_value,plot_cells,plot_boundaries) - Added test cases with test data files for both new visualization methods
Reviewed changes
Copilot reviewed 2 out of 8 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| tools/seurat/plot.xml | Added R code templates for ImageDimPlot and ImageFeaturePlot functions (lines 249-339), added UI conditional sections for both methods (lines 797-865), added two test cases (lines 1322-1357), and wrapped FeaturePlot min/max_cutoff in conditionals (lines 405-410) |
| tools/seurat/macros.xml | Added 14 new reusable macros for spatial plotting parameters including plot_fov, plot_boundaries, plot_molecules, plot_border, plot_dark_background, plot_crop, plot_overlap, plot_axes, plot_combine, plot_coord_fixed, plot_flip_xy, and refactored plot_na_value and plot_cells into macros |
| tools/seurat/test-data/imagefeatureplot.png | Added test output PNG file for ImageFeaturePlot validation |
| tools/seurat/test-data/imagedimplot.png | Added test output PNG file for ImageDimPlot validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tools/seurat/macros.xml
Outdated
| <xml name="plot_molecules"> | ||
| <param argument="molecules" type="text" optional="true" value="" label="Molecules" help="A vector of molecules to plot"/> | ||
| <param argument="mols_size" type="float" value="0.1" label="Point size for molecules" help="(mols.size)"/> | ||
| <param argument="mols_cols" type="text" optional="true" value="" label="Molecules Colores" help="A vector of color for molecules. The 'Set1' palette from RColorBreweris used by default (make sure they vector has the same length as the molecules)"/> |
Copilot
AI
Dec 3, 2025
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.
Multiple issues in the help text: "RColorBreweris" should be "RColorBrewer is" (missing space), and "they vector" should be "the vector"
| <param argument="mols_cols" type="text" optional="true" value="" label="Molecules Colores" help="A vector of color for molecules. The 'Set1' palette from RColorBreweris used by default (make sure they vector has the same length as the molecules)"/> | |
| <param argument="mols_cols" type="text" optional="true" value="" label="Molecules Colores" help="A vector of color for molecules. The 'Set1' palette from RColorBrewer is used by default (make sure the vector has the same length as the molecules)"/> |
tools/seurat/plot.xml
Outdated
| </test> | ||
| <test expect_num_outputs="2"> | ||
| <!-- test12: ImageDimPlot PNG --> | ||
| <param name="seurat_rds" ftype="rds" value="test_seurat_spatial.rds"/> |
Copilot
AI
Dec 3, 2025
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.
The seurat_rds parameter is defined twice. The first definition on line 1324 with ftype="rds" value="test_seurat_spatial.rds" should be removed, as the second definition on line 1325 with the location attribute is the correct one.
| <param name="seurat_rds" ftype="rds" value="test_seurat_spatial.rds"/> |
Co-authored-by: Ona <no-reply@ona.com>
Co-authored-by: Ona <no-reply@ona.com>
Co-authored-by: Ona <no-reply@ona.com>
tools/seurat/macros.xml
Outdated
| <requirement type="package">fit-sne</requirement> | ||
| <requirement type="package">bioconductor-limma</requirement> | ||
| <requirement type="package">bioconductor-mast</requirement> | ||
| <requirement type="package">bioconductor-deseq2</requirement> | ||
| <requirement type="package">r-svglite</requirement> | ||
| <requirement type="package">r-metap</requirement> | ||
| <requirement type="package">bioconductor-glmGamPoi</requirement> | ||
| <requirement type="package">umap-learn</requirement> | ||
| <requirement type="package">leidenalg</requirement> | ||
| <requirement type="package">r-harmony</requirement> | ||
| <requirement type="package">bioconductor-batchelor</requirement> | ||
| <requirement type="package">numpy</requirement> | ||
| <requirement type="package">pandas</requirement> |
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.
Please use fixed tool versions. Otherwise, it breaks the reproducibility.
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.
I am solving the conda compatibility right now. But my girpod disconnected.
Co-authored-by: Ona <no-reply@ona.com>
Co-authored-by: Ona <no-reply@ona.com>
FOR CONTRIBUTOR: