Add ImageDimPlot, ImageFeaturePlot to Seurat Visualize#7501
Add ImageDimPlot, ImageFeaturePlot to Seurat Visualize#7501khaled196 wants to merge 22 commits intogalaxyproject:mainfrom
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.
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.
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.
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=""/> |
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.
is there a select param missing in the xml with one and more values?
There was a problem hiding this comment.
removed this option and made it a vector, no need to specify
There was a problem hiding this comment.
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)"/> |
There was a problem hiding this comment.
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"/> |
There was a problem hiding this comment.
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.
Please use fixed tool versions. Otherwise, it breaks the reproducibility.
There was a problem hiding this comment.
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>
|
hi @pavanvidem Is the pull request ready, or are changes still needed? |
| </xrefs> | ||
| </xml> | ||
| </xml> | ||
| <xml name="creators"> |
There was a problem hiding this comment.
@MarisaJL wrote this entire tool suite initially. Her name is missing. Please carefully check the previous contributors and include only them. Otherwise, I am also fine with removing this whole section :)
There was a problem hiding this comment.
Author: Alex Ostrovsky 40246333+astrovsky01@users.noreply.github.com
Author: Alexander OSTROVSKY alexanderostrovsky@Chell.local
Author: Bjoern Gruening bjoern.gruening@gmail.com
Author: Björn Grüning bjoern.gruening@gmail.com
Author: Björn Grüning bjoern@gruenings.eu
Author: Khaled196 56037954+khaled196@users.noreply.github.com
Author: Khaled196 khalled.jooma@yahoo.com
Author: Lance Parsons lparsons@princeton.edu
Author: M Bernt m.bernt@ufz.de
Author: Maria Doyle maria.doyle@petermac.org
Author: Matthias Bernt m.bernt@ufz.de
Author: Mehmet Tekman mtekman89@gmail.com
Author: Nicola Soranzo nicola.soranzo@earlham.ac.uk
Author: Pavankumar Videm pavanvidem@gmail.com
Author: khaled196 khalled.jooma@yahoo.com
Author: mvdbeek m.vandenbeek@gmail.com
The GitHub list of computers from the API
There was a problem hiding this comment.
Ok, now I understand what is happening :)
There was an older Seurat (v4) tool in this same folder. The current Seurat (v5) tool was initially named seurat_v5. Seurat v4 has been deprecated, and seurat_v5 has since been renamed to seurat. So this is what I get
$ git log 8ae488affa6ce0299999a4164747d8c160bd994e..HEAD --format='%aN <%aE>' -- seurat | sort -u
Bjoern Gruening <bjoern.gruening@gmail.com>
Khaled196 <56037954+khaled196@users.noreply.github.com>
khaled196 <khalled.jooma@yahoo.com>
Khaled196 <khalled.jooma@yahoo.com>
Matthias Bernt <m.bernt@ufz.de>
M Bernt <m.bernt@ufz.de>
Pavankumar Videm <pavanvidem@gmail.com>
There was a problem hiding this comment.
wait, but this still did not get Marisa's contribution :) Let me check again
There was a problem hiding this comment.
I have added it but didn't push the changes yet 😁
There was a problem hiding this comment.
This should hopefully get everyone
$ (git log --format='%aN <%aE>' -- seurat_v5; git log 8ae488affa6ce0299999a4164747d8c160bd994e..HEAD --format='%aN <%aE>' -- seurat; ) | sort -u
Bjoern Gruening <bjoern.gruening@gmail.com>
Björn Grüning <bjoern@gruenings.eu>
Khaled196 <56037954+khaled196@users.noreply.github.com>
khaled196 <khalled.jooma@yahoo.com>
Khaled196 <khalled.jooma@yahoo.com>
MarisaJL <115314387+MarisaJL@users.noreply.github.com>
MarisaJL <marisa.loach@open.ac.uk>
Matthias Bernt <m.bernt@ufz.de>
M Bernt <m.bernt@ufz.de>
Pavankumar Videm <pavanvidem@gmail.com>
| <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 e.g boundaries ('slideA_fov1' = 'segmentation', 'slideB_fov2' = 'centroids')"/> |
There was a problem hiding this comment.
It is hard to expect an input that looks like ('slideA_fov1' = 'segmentation', 'slideB_fov2' = 'centroids') from users. If it requires a dictionary like input, then split this param into a repeat with two params. If a simple comma-separated list of FOVs is good enough, then please adjust the help text.
| </xml> | ||
| <xml name="plot_alpha"> | ||
| <param argument="alpha" type="integer" value="1" label="Alpha value for points"/> | ||
| <param argument="alpha" type="integer" optional="true" value="1" label="Alpha value for points"/> |
| </assert_contents> | ||
| </output> | ||
| <output name="rds_out" location="https://zenodo.org/records/13732784/files/rawdata.rds" ftype="rds"/> | ||
| <output name="rds_out" location="https://zenodo.org/records/17817806/files/rawdata.rds" ftype="rds"/> |
There was a problem hiding this comment.
can you please submit this zenodo record to Galaxy tool-devs community so that the community can maintain the record. If you edit the record, there should be an option to choose the community.
| <output name="rds_out" location="https://zenodo.org/records/13732784/files/conserved_markers.rds" ftype="rds"/> | ||
| <output name="markers_tabular" location="https://zenodo.org/records/13732784/files/conserved_markers.csv" ftype="csv"> | ||
| <output name="rds_out" location="https://zenodo.org/records/17817806/files/conserved_markers.rds" ftype="rds"/> | ||
| <output name="markers_tabular" location="https://zenodo.org/records/17817806/files/conserved_markers.csv" ftype="csv"> |
There was a problem hiding this comment.
with such p-low values in the table, this strict file comparison might break in the future. Please use assert_contents with expression.
| <output name="rds_out" location="https://zenodo.org/records/13732784/files/markersMAST.rds" ftype="rds"/> | ||
| <output name="markers_tabular" location="https://zenodo.org/records/13732784/files/markersMAST.csv" ftype="csv"> | ||
| <output name="rds_out" location="https://zenodo.org/records/17817806/files/markersMAST.rds" ftype="rds" compare="sim_size" /> | ||
| <output name="markers_tabular" location="https://zenodo.org/records/17817806/files/markersMAST.csv" ftype="csv" compare="sim_size"> |
There was a problem hiding this comment.
with such p-low values in the table, this strict file comparison might break in the future. Please use assert_contents with expression.
| <output name="rds_out" location="https://zenodo.org/records/13732784/files/markersDESeq2.rds" ftype="rds"/> | ||
| <output name="markers_tabular" location="https://zenodo.org/records/13732784/files/markersDESeq2.csv" ftype="csv"> | ||
| <output name="rds_out" location="https://zenodo.org/records/17817806/files/markersDESeq2.rds" ftype="rds" compare="sim_size"/> | ||
| <output name="markers_tabular" location="https://zenodo.org/records/17817806/files/markersDESeq2.csv" ftype="csv" compare="sim_size"> |
There was a problem hiding this comment.
same here. please use assert_contents
Co-authored-by: Pavankumar Videm <pavanvidem@gmail.com>
Co-authored-by: Pavankumar Videm <pavanvidem@gmail.com>
Co-authored-by: Pavankumar Videm <pavanvidem@gmail.com>
FOR CONTRIBUTOR: