Mercurial > repos > iuc > spatialdata_plot
comparison spatialdata_plot.xml @ 0:c5928c28e2f0 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/tools/spatialdata commit 87bff76d897c5a4277d9987cf26432a18e0458cd-dirty
| author | iuc |
|---|---|
| date | Sat, 14 Mar 2026 15:15:45 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:c5928c28e2f0 |
|---|---|
| 1 <tool id="spatialdata_plot" name="SpatialData Plot" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> | |
| 2 <description>rich static plotting from SpatialData objects</description> | |
| 3 <macros> | |
| 4 <import>macros.xml</import> | |
| 5 </macros> | |
| 6 <expand macro="requirements"/> | |
| 7 <expand macro="creator" /> | |
| 8 <command detect_errors="exit_code"><![CDATA[ | |
| 9 unzip -q '$input_spatialdata' -d input && | |
| 10 | |
| 11 ## Rename directory to spatialdata if it has a different name | |
| 12 dir_name=\$(ls -d input/*/ | head -1 | xargs basename) && | |
| 13 if [ "\$dir_name" != "spatialdata" ]; then | |
| 14 mv "input/\$dir_name" input/spatialdata; | |
| 15 fi && | |
| 16 | |
| 17 ## run the plotting pipeline | |
| 18 cat 'spdata_plot.py' && | |
| 19 python3 'spdata_plot.py' | |
| 20 ]]></command> | |
| 21 <configfiles> | |
| 22 <configfile name="spdata_plot_config" filename="spdata_plot.py"> | |
| 23 import spatialdata as sd | |
| 24 import spatialdata_plot | |
| 25 | |
| 26 ## Load the SpatialData object | |
| 27 spdata = sd.read_zarr("./input/spatialdata") | |
| 28 | |
| 29 print(spdata) | |
| 30 | |
| 31 ## Render images | |
| 32 #for $img in $render_images: | |
| 33 spdata = spdata.pl.render_images( | |
| 34 #if $img.image_element: | |
| 35 element='$img.image_element', | |
| 36 #else: | |
| 37 element=None, | |
| 38 #end if | |
| 39 #if $img.channel: | |
| 40 channel='$img.channel', | |
| 41 #end if | |
| 42 #if str($img.cmap_or_palette_condi.color_map_type) == 'cmap': | |
| 43 #set $cmap_list = [str(x.strip()) for x in str($img.cmap_or_palette_condi.cmap).split(',')] | |
| 44 cmap=$cmap_list, | |
| 45 #end if | |
| 46 #if str($img.normalize_condi.normalize) == 'yes': | |
| 47 norm=Normalize( | |
| 48 vmin=$img.normalize_condi.vmin if str($img.normalize_condi.vmin) != '' else None, | |
| 49 vmax=$img.normalize_condi.vmax if str($img.normalize_condi.vmax) != '' else None, | |
| 50 clip=$img.normalize_condi.clip | |
| 51 ), | |
| 52 #end if | |
| 53 #if str($img.cmap_or_palette_condi.color_map_type) == 'palette': | |
| 54 #set $palette_list = [str(x.strip()) for x in str($img.cmap_or_palette_condi.palette).split(',')] | |
| 55 palette=$palette_list, | |
| 56 #end if | |
| 57 alpha=$img.alpha, | |
| 58 #if $img.scale: | |
| 59 scale='$img.scale', | |
| 60 #end if | |
| 61 ) | |
| 62 #end for | |
| 63 | |
| 64 ## Render labels | |
| 65 #for $lbl in $render_labels: | |
| 66 spdata = spdata.pl.render_labels( | |
| 67 #if $lbl.labels_element: | |
| 68 element='$lbl.labels_element', | |
| 69 #else: | |
| 70 element=None, | |
| 71 #end if | |
| 72 #if $lbl.color: | |
| 73 color='$lbl.color', | |
| 74 #end if | |
| 75 #if $lbl.groups: | |
| 76 #set $groups_list = [str(x.strip()) for x in str($lbl.groups).split(',')] | |
| 77 groups=$groups_list, | |
| 78 #end if | |
| 79 #if str($lbl.cmap_or_palette_condi.color_map_type) == 'palette': | |
| 80 #set $palette_list = [str(x.strip()) for x in str($lbl.cmap_or_palette_condi.palette).split(',')] | |
| 81 palette=$palette_list, | |
| 82 #end if | |
| 83 contour_px=$lbl.contour_px, | |
| 84 #if str($lbl.cmap_or_palette_condi.color_map_type) == 'cmap': | |
| 85 #set $cmap_list = [str(x.strip()) for x in str($lbl.cmap_or_palette_condi.cmap).split(',')] | |
| 86 cmap=$cmap_list, | |
| 87 #end if | |
| 88 #if str($lbl.normalize_condi.normalize) == 'yes': | |
| 89 norm=Normalize( | |
| 90 vmin=$lbl.normalize_condi.vmin if str($lbl.normalize_condi.vmin) != '' else None, | |
| 91 vmax=$lbl.normalize_condi.vmax if str($lbl.normalize_condi.vmax) != '' else None, | |
| 92 clip=$lbl.normalize_condi.clip | |
| 93 ), | |
| 94 #end if | |
| 95 outline_alpha=$lbl.outline_alpha, | |
| 96 fill_alpha=$lbl.fill_alpha, | |
| 97 #if $lbl.scale: | |
| 98 scale='$lbl.scale', | |
| 99 #else | |
| 100 scale=None, | |
| 101 #end if | |
| 102 #if $lbl.table_name: | |
| 103 table_name='$lbl.table_name', | |
| 104 #else | |
| 105 table_name=None, | |
| 106 #end if | |
| 107 #if $lbl.table_layer: | |
| 108 table_layer='$lbl.table_layer', | |
| 109 #else | |
| 110 table_layer=None, | |
| 111 #end if | |
| 112 ) | |
| 113 #end for | |
| 114 | |
| 115 ## Render points | |
| 116 #for $pt in $render_points: | |
| 117 spdata = spdata.pl.render_points( | |
| 118 #if $pt.points_element: | |
| 119 element='$pt.points_element', | |
| 120 #else: | |
| 121 element=None, | |
| 122 #end if | |
| 123 #if $pt.color: | |
| 124 color='$pt.color', | |
| 125 #end if | |
| 126 #if str($pt.alpha) != '': | |
| 127 alpha=$pt.alpha, | |
| 128 #end if | |
| 129 #if $pt.groups: | |
| 130 #set $groups_list = [str(x.strip()) for x in str($pt.groups).split(',')] | |
| 131 groups=$groups_list, | |
| 132 #end if | |
| 133 #if str($pt.cmap_or_palette_condi.color_map_type) == 'palette': | |
| 134 #set $palette_list = [str(x.strip()) for x in str($pt.cmap_or_palette_condi.palette).split(',')] | |
| 135 palette=$palette_list, | |
| 136 #end if | |
| 137 #if str($pt.cmap_or_palette_condi.color_map_type) == 'cmap': | |
| 138 #set $cmap_list = [str(x.strip()) for x in str($pt.cmap_or_palette_condi.cmap).split(',')] | |
| 139 cmap=$cmap_list, | |
| 140 #end if | |
| 141 #if str($pt.normalize_condi.normalize) == 'yes': | |
| 142 norm=Normalize( | |
| 143 vmin=$pt.normalize_condi.vmin if str($pt.normalize_condi.vmin) != '' else None, | |
| 144 vmax=$pt.normalize_condi.vmax if str($pt.normalize_condi.vmax) != '' else None, | |
| 145 clip=$pt.normalize_condi.clip | |
| 146 ), | |
| 147 #end if | |
| 148 size=$pt.size, | |
| 149 #if $pt.method: | |
| 150 method='$pt.method', | |
| 151 #else: | |
| 152 method=None, | |
| 153 #end if | |
| 154 #if $pt.table_name: | |
| 155 table_name='$pt.table_name', | |
| 156 #else | |
| 157 table_name=None, | |
| 158 #end if | |
| 159 #if $pt.table_layer: | |
| 160 table_layer='$pt.table_layer', | |
| 161 #else | |
| 162 table_layer=None, | |
| 163 #end if | |
| 164 | |
| 165 ) | |
| 166 #end for | |
| 167 | |
| 168 ## Render shapes | |
| 169 #for $shp in $render_shapes: | |
| 170 spdata = spdata.pl.render_shapes( | |
| 171 #if $shp.shapes_element: | |
| 172 element='$shp.shapes_element', | |
| 173 #else: | |
| 174 element=None, | |
| 175 #end if | |
| 176 #if $shp.color: | |
| 177 color='$shp.color', | |
| 178 #end if | |
| 179 #if str($shp.fill_alpha) != '': | |
| 180 fill_alpha=$shp.fill_alpha, | |
| 181 #end if | |
| 182 #if str($shp.groups) != '': | |
| 183 #set $groups_list = [str(x.strip()) for x in str($shp.groups).split(',')] | |
| 184 groups=$groups_list, | |
| 185 #end if | |
| 186 #if str($shp.cmap_or_palette_condi.color_map_type) == 'palette': | |
| 187 #set $palette_list = [str(x.strip()) for x in str($shp.cmap_or_palette_condi.palette).split(',')] | |
| 188 palette=$palette_list, | |
| 189 #end if | |
| 190 | |
| 191 #if str($shp.outline_condi.outline_type) == 'no': | |
| 192 outline_width=None, | |
| 193 outline_color=None, | |
| 194 outline_alpha=None, | |
| 195 #else if str($shp.outline_condi.outline_type) == 'yes': | |
| 196 outline_width=$shp.outline_condi.outline_width1, | |
| 197 outline_color='$shp.outline_condi.outline_color1', | |
| 198 outline_alpha=$shp.outline_condi.outline_alpha1, | |
| 199 #else if str($shp.outline_condi.outline_type) == 'yes2': | |
| 200 outline_width=[$shp.outline_condi.outline_width1, $shp.outline_condi.outline_width2], | |
| 201 outline_color=['$shp.outline_condi.outline_color1', '$shp.outline_condi.outline_color2'], | |
| 202 outline_alpha=[$shp.outline_condi.outline_alpha1, $shp.outline_condi.outline_alpha2], | |
| 203 #end if | |
| 204 | |
| 205 #if str($shp.cmap_or_palette_condi.color_map_type) == 'cmap': | |
| 206 #set $cmap_list = [str(x.strip()) for x in str($shp.cmap_or_palette_condi.cmap).split(',')] | |
| 207 cmap=$cmap_list, | |
| 208 #end if | |
| 209 #if str($shp.normalize_condi.normalize) == 'yes': | |
| 210 norm=Normalize( | |
| 211 vmin=$shp.normalize_condi.vmin if str($shp.normalize_condi.vmin) != '' else None, | |
| 212 vmax=$shp.normalize_condi.vmax if str($shp.normalize_condi.vmax) != '' else None, | |
| 213 clip=$shp.normalize_condi.clip | |
| 214 ), | |
| 215 #end if | |
| 216 scale=$shp.scale, | |
| 217 #if $shp.method and str($shp.method) != 'None': | |
| 218 method='$shp.method', | |
| 219 #else: | |
| 220 method=None, | |
| 221 #end if | |
| 222 #if $shp.table_name: | |
| 223 table_name='$shp.table_name', | |
| 224 #else | |
| 225 table_name=None, | |
| 226 #end if | |
| 227 #if $shp.table_layer: | |
| 228 table_layer='$shp.table_layer', | |
| 229 #else | |
| 230 table_layer=None, | |
| 231 #end if | |
| 232 #if $shp.shape and str($shp.shape) != 'None': | |
| 233 shape='$shp.shape', | |
| 234 #else: | |
| 235 shape=None, | |
| 236 #end if | |
| 237 ) | |
| 238 #end for | |
| 239 | |
| 240 ## Show the plot | |
| 241 spdata.pl.show( | |
| 242 #if $show_params.coordinate_systems: | |
| 243 #set $coordinate_systems_list = [str(x.strip()) for x in str($show_params.coordinate_systems).split(',')] | |
| 244 coordinate_systems=$coordinate_systems_list, | |
| 245 #end if | |
| 246 figsize=($show_params.figsize_width, $show_params.figsize_height), | |
| 247 dpi=$show_params.dpi, | |
| 248 ncols=$show_params.ncols, | |
| 249 #if str($show_params.legend_fontsize) != '': | |
| 250 legend_fontsize=$show_params.legend_fontsize, | |
| 251 #end if | |
| 252 legend_fontweight='$show_params.legend_fontweight', | |
| 253 legend_loc='$show_params.legend_loc', | |
| 254 na_in_legend=$show_params.na_in_legend, | |
| 255 #if $show_params.title: | |
| 256 title='$show_params.title', | |
| 257 #end if | |
| 258 share_extent=$show_params.share_extent, | |
| 259 save='plot.${show_params.format}' | |
| 260 ) | |
| 261 | |
| 262 print("Plot saved successfully") | |
| 263 </configfile> | |
| 264 </configfiles> | |
| 265 <inputs> | |
| 266 <expand macro="input_spatialdata"/> | |
| 267 <repeat name="render_images" min="0" title="Render Images"> | |
| 268 <param name="image_element" type="text" optional="true" label="Image element name" help="Name of the image element to render. Leave empty to render all images."> | |
| 269 <expand macro="sanitize_query"/> | |
| 270 </param> | |
| 271 <param name="channel" type="text" optional="true" label="Channel(s)" help="Comma-separated list of channel names or indices to plot. Leave empty for all channels."> | |
| 272 <expand macro="sanitize_query"/> | |
| 273 </param> | |
| 274 <expand macro="cmap_or_palette_condi"/> | |
| 275 <expand macro="normalize_condi"/> | |
| 276 <param name="alpha" type="float" value="1.0" min="0.0" max="1.0" label="Alpha (opacity)" help="Transparency level (0=transparent, 1=opaque)"/> | |
| 277 <param name="scale" type="text" optional="true" label="Scale" help="Resolution control: leave empty for auto, 'full' for highest resolution, or specify a scale name. Please note that full resolution, takes more time to render."> | |
| 278 <expand macro="sanitize_query"/> | |
| 279 </param> | |
| 280 </repeat> | |
| 281 | |
| 282 <repeat name="render_labels" min="0" title="Render Labels"> | |
| 283 <param name="labels_element" type="text" optional="true" label="Labels element name" help="Name of the labels element to render. Leave empty to render all labels."> | |
| 284 <expand macro="sanitize_query"/> | |
| 285 </param> | |
| 286 <expand macro="param_color"/> | |
| 287 <param name="groups" type="text" optional="true" label="Groups to show" help=" When using color and the key represents discrete labels, groups can be used to show only a subset of them. Other values are set to NA. The list can contain multiple discrete labels to be visualized."> | |
| 288 <expand macro="sanitize_query"/> | |
| 289 </param> | |
| 290 <expand macro="cmap_or_palette_condi"/> | |
| 291 <param name="contour_px" type="integer" value="3" min="0" label="Contour width (pixels)" help="Width of contour to draw for each segment. 0 fills entire segment."/> | |
| 292 <expand macro="normalize_condi"/> | |
| 293 <param name="outline_alpha" type="float" value="0.0" min="0.0" max="1.0" label="Alpha value for the outline of the labels" help=" Invisible by default." /> | |
| 294 <param name="fill_alpha" type="float" value="0.4" min="0.0" max="1.0" label="Alpha value for the fill of the labels."/> | |
| 295 <param name="scale" type="text" optional="true" label="Scale" help="Resolution control: leave empty for auto, 'full' for highest resolution, or specify a scale name. Please note that full resolution, takes more time to render."> | |
| 296 <expand macro="sanitize_query"/> | |
| 297 </param> | |
| 298 <expand macro="param_table_name" value="" optional="true" help="Name of table containing color columns"/> | |
| 299 <expand macro="param_table_layer"/> | |
| 300 </repeat> | |
| 301 | |
| 302 <repeat name="render_points" min="0" title="Render Points"> | |
| 303 <param name="points_element" type="text" optional="true" label="Points element name" help="Name of the points element to render. Leave empty to render all points."> | |
| 304 <expand macro="sanitize_query"/> | |
| 305 </param> | |
| 306 <expand macro="param_color"/> | |
| 307 <param name="alpha" type="float" optional="true" min="0.0" max="1.0" label="Alpha (opacity)"/> | |
| 308 <param name="groups" type="text" optional="true" label="Groups to show" help=" When using color and the key represents discrete labels, groups can be used to show only a subset of them. Other values are set to NA. The list can contain multiple discrete labels to be visualized."> | |
| 309 <expand macro="sanitize_query"/> | |
| 310 </param> | |
| 311 <expand macro="cmap_or_palette_condi"/> | |
| 312 <expand macro="normalize_condi"/> | |
| 313 <param name="size" type="float" value="1.0" min="0.0" label="Point size"/> | |
| 314 <expand macro="param_rendering_method"/> | |
| 315 <expand macro="param_table_name" value="" optional="true" help="Name of table containing color columns"/> | |
| 316 <expand macro="param_table_layer"/> | |
| 317 </repeat> | |
| 318 | |
| 319 <repeat name="render_shapes" min="0" title="Render Shapes"> | |
| 320 <param name="shapes_element" type="text" optional="true" label="Shapes element name" help="Name of the shapes element to render. Leave empty to render all shapes."> | |
| 321 <expand macro="sanitize_query"/> | |
| 322 </param> | |
| 323 <expand macro="param_color"/> | |
| 324 <param name="fill_alpha" type="float" optional="true" min="0.0" max="1.0" label="Fill alpha" help="By default, it is set to 1.0 or, if a color is given that implies an alpha, that value is used for fill_alpha. If an alpha channel is present in a cmap passed by the user, fill_alpha will overwrite the value present in the cmap."/> | |
| 325 <param name="groups" type="text" optional="true" label="Groups to show" help=" When using color and the key represents discrete labels, groups can be used to show only a subset of them. Other values are set to NA. The list can contain multiple discrete labels to be visualized."> | |
| 326 <expand macro="sanitize_query"/> | |
| 327 </param> | |
| 328 <expand macro="cmap_or_palette_condi"/> | |
| 329 <conditional name="outline_condi"> | |
| 330 <param name="outline_type" type="select" label="Shape outline type"> | |
| 331 <option value="no">No outline</option> | |
| 332 <option value="yes">Yes, one outline</option> | |
| 333 <option value="yes2">Yes, two outlines</option> | |
| 334 </param> | |
| 335 <when value="no"/> | |
| 336 <when value="yes"> | |
| 337 <param name="outline_width1" type="float" optional="false" value="1.5" min="0.0" label="Outline width"/> | |
| 338 <param name="outline_color1" type="text" optional="false" value="#000000" label="Outline color" help="Color name or hex code"> | |
| 339 <expand macro="sanitize_query"/> | |
| 340 </param> | |
| 341 <param name="outline_alpha1" type="float" optional="false" value="1.0" min="0.0" max="1.0" label="Outline alpha"/> | |
| 342 </when> | |
| 343 <when value="yes2"> | |
| 344 <param name="outline_width1" type="float" optional="false" value="1.5" min="0.0" label="First outline width"/> | |
| 345 <param name="outline_color1" type="text" optional="false" value="#000000" label="First outline color" help="Color name or hex code"> | |
| 346 <expand macro="sanitize_query"/> | |
| 347 </param> | |
| 348 <param name="outline_alpha1" type="float" optional="false" value="1.0" min="0.0" max="1.0" label="First outline alpha"/> | |
| 349 <param name="outline_width2" type="float" optional="false" value="0.5" min="0.0" label="Second outline width"/> | |
| 350 <param name="outline_color2" type="text" optional="false" value="#ffffff" label="Second outline color" help="Color name or hex code"> | |
| 351 <expand macro="sanitize_query"/> | |
| 352 </param> | |
| 353 <param name="outline_alpha2" type="float" optional="false" value="1.0" min="0.0" max="1.0" label="Second outline alpha"/> | |
| 354 </when> | |
| 355 </conditional> | |
| 356 <expand macro="normalize_condi"/> | |
| 357 <param name="scale" type="float" min="0" value="1.0" label="Scale factor" help="Value to scale circles"/> | |
| 358 <expand macro="param_rendering_method" help="When Auto, the method is chosen based on the size of the data."> | |
| 359 <option value="None">Auto</option> | |
| 360 </expand> | |
| 361 <expand macro="param_table_name" value="" optional="true"/> | |
| 362 <expand macro="param_table_layer"/> | |
| 363 <param name="shape" type="select" optional="true" label="Convert shapes to" help="If Auto, the shapes are rendered as they are"> | |
| 364 <option value="None">Keep original shapes</option> | |
| 365 <option value="circle">Circle</option> | |
| 366 <option value="hex">Hexagon</option> | |
| 367 <option value="visium_hex">Visium hexagon (adjacent)</option> | |
| 368 <option value="square">Square</option> | |
| 369 </param> | |
| 370 </repeat> | |
| 371 | |
| 372 <section name="show_params" title="Plot Display Parameters" expanded="true"> | |
| 373 <param name="coordinate_systems" type="text" optional="true" label="Coordinate system(s)" help="Comma-separated list of coordinate systems to plot. Leave empty for all. If a coordinate system doesn't contain any relevant elements (as specified in the render_* calls), it is automatically not plotted."> | |
| 374 <expand macro="sanitize_query"/> | |
| 375 </param> | |
| 376 <param name="figsize_width" type="float" value="6.4" min="0.1" label="Figure width (inches)"/> | |
| 377 <param name="figsize_height" type="float" value="4.8" min="0.1" label="Figure height (inches)"/> | |
| 378 <param name="dpi" type="integer" value="100" min="1" label="DPI (resolution)" help="Dots per inch for the output image"/> | |
| 379 <param name="ncols" type="integer" value="4" min="1" label="Number of columns"/> | |
| 380 <param name="legend_fontsize" type="integer" optional="true" min="1" label="Legend font size"/> | |
| 381 <param name="legend_fontweight" type="select" label="Legend font weight"> | |
| 382 <option value="bold" selected="true">Bold</option> | |
| 383 <option value="normal">Normal</option> | |
| 384 <option value="light">Light</option> | |
| 385 </param> | |
| 386 <param name="legend_loc" type="select" label="Legend location"> | |
| 387 <option value="right margin" selected="true">Right margin</option> | |
| 388 <option value="upper right">Upper right</option> | |
| 389 <option value="upper left">Upper left</option> | |
| 390 <option value="lower left">Lower left</option> | |
| 391 <option value="lower right">Lower right</option> | |
| 392 <option value="center">Center</option> | |
| 393 </param> | |
| 394 <param name="na_in_legend" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Show NA values in legend?"/> | |
| 395 <param name="title" type="text" optional="true" label="Plot title" help="If not provided the plot will have the name of the coordinate system as title.."> | |
| 396 <expand macro="sanitize_query"/> | |
| 397 </param> | |
| 398 <param name="share_extent" type="boolean" truevalue="True" falsevalue="False" checked="true" label="Share extent across subplots?"/> | |
| 399 <param name="format" type="select" label="Image format"> | |
| 400 <option value="eps">EPS</option> | |
| 401 <option value="jpg" selected="true">JPG</option> | |
| 402 <option value="pdf">PDF</option> | |
| 403 <option value="png">PNG</option> | |
| 404 <option value="svg">SVG</option> | |
| 405 <option value="tiff">TIFF</option> | |
| 406 </param> | |
| 407 </section> | |
| 408 </inputs> | |
| 409 <outputs> | |
| 410 <data name="plot_output" format="jpg" from_work_dir="figures/plot.jpg" label="${tool.name} on ${on_string}: plot"> | |
| 411 <change_format> | |
| 412 <when input="show_params.format" value="eps" format="eps"/> | |
| 413 <when input="show_params.format" value="jpg" format="jpg"/> | |
| 414 <when input="show_params.format" value="pdf" format="pdf"/> | |
| 415 <when input="show_params.format" value="png" format="png"/> | |
| 416 <when input="show_params.format" value="svg" format="svg"/> | |
| 417 <when input="show_params.format" value="tiff" format="tiff"/> | |
| 418 </change_format> | |
| 419 </data> | |
| 420 </outputs> | |
| 421 <tests> | |
| 422 <!-- test 1 - render images --> | |
| 423 <test> | |
| 424 <param name="input_spatialdata" location="https://zenodo.org/records/18746346/files/xenium_spatialdata.spatialdata.zip"/> | |
| 425 <repeat name="render_images"> | |
| 426 <param name="image_element" value="he_image"/> | |
| 427 </repeat> | |
| 428 <assert_stdout> | |
| 429 <has_text text="spdata.pl.render_images"/> | |
| 430 <has_text text="element='he_image'"/> | |
| 431 </assert_stdout> | |
| 432 <output name="plot_output" ftype="jpg"> | |
| 433 <assert_contents> | |
| 434 <has_image_center_of_mass center_of_mass="83,245" eps="5"/> | |
| 435 <has_image_channels channels="3"/> | |
| 436 <has_image_height height="491"/> | |
| 437 <has_image_width width="174"/> | |
| 438 </assert_contents> | |
| 439 </output> | |
| 440 </test> | |
| 441 <!-- test 2 - render labels --> | |
| 442 <test> | |
| 443 <param name="input_spatialdata" location="https://zenodo.org/records/18746346/files/xenium_spatialdata.spatialdata.zip"/> | |
| 444 <repeat name="render_labels"> | |
| 445 <param name="labels_element" value="cell_labels"/> | |
| 446 <param name="color" value="total_counts"/> | |
| 447 <param name="contour_px" value="2"/> | |
| 448 <param name="outline_alpha" value="0.5"/> | |
| 449 <param name="fill_alpha" value="0.5"/> | |
| 450 </repeat> | |
| 451 <assert_stdout> | |
| 452 <has_text text="spdata.pl.render_labels"/> | |
| 453 <has_text text="element='cell_labels'"/> | |
| 454 <has_text text="color='total_counts'"/> | |
| 455 <has_text text="contour_px=2"/> | |
| 456 <has_text text="outline_alpha=0.5"/> | |
| 457 <has_text text="fill_alpha=0.5"/> | |
| 458 </assert_stdout> | |
| 459 <output name="plot_output" ftype="jpg"> | |
| 460 <assert_contents> | |
| 461 <has_image_center_of_mass center_of_mass="155,245" eps="5"/> | |
| 462 <has_image_channels channels="3"/> | |
| 463 <has_image_height height="491"/> | |
| 464 <has_image_width width="320"/> | |
| 465 </assert_contents> | |
| 466 </output> | |
| 467 </test> | |
| 468 <!-- test 3 - render points --> | |
| 469 <test> | |
| 470 <param name="input_spatialdata" location="https://zenodo.org/records/18746346/files/merscope_spatialdata.spatialdata.zip"/> | |
| 471 <repeat name="render_points"> | |
| 472 <param name="points_element" value="slide_name_region_transcripts"/> | |
| 473 <param name="color" value="fov"/> | |
| 474 <param name="alpha" value="0.7"/> | |
| 475 <param name="size" value="2.0"/> | |
| 476 </repeat> | |
| 477 <assert_stdout> | |
| 478 <has_text text="spdata.pl.render_points"/> | |
| 479 <has_text text="element='slide_name_region_transcripts'"/> | |
| 480 <has_text text="color='fov'"/> | |
| 481 <has_text text="alpha=0.7"/> | |
| 482 <has_text text="size=2.0"/> | |
| 483 </assert_stdout> | |
| 484 <output name="plot_output" ftype="jpg"> | |
| 485 <assert_contents> | |
| 486 <has_image_center_of_mass center_of_mass="295, 245" eps="10"/> | |
| 487 <has_image_channels channels="3"/> | |
| 488 <has_image_height height="491"/> | |
| 489 <has_image_width width="586"/> | |
| 490 </assert_contents> | |
| 491 </output> | |
| 492 </test> | |
| 493 <!-- test 4 - render shapes --> | |
| 494 <test> | |
| 495 <param name="input_spatialdata" location="https://zenodo.org/records/18746346/files/merscope_spatialdata.spatialdata.zip"/> | |
| 496 <repeat name="render_shapes"> | |
| 497 <param name="shapes_element" value="slide_name_region_polygons"/> | |
| 498 <param name="color" value="EntityID"/> | |
| 499 <param name="fill_alpha" value="0.3"/> | |
| 500 <conditional name="outline_condi"> | |
| 501 <param name="outline_type" value="yes"/> | |
| 502 <param name="outline_width1" value="1.0"/> | |
| 503 <param name="outline_color1" value="#ff0000"/> | |
| 504 <param name="outline_alpha1" value="0.8"/> | |
| 505 </conditional> | |
| 506 </repeat> | |
| 507 <assert_stdout> | |
| 508 <has_text text="spdata.pl.render_shapes"/> | |
| 509 <has_text text="element='slide_name_region_polygons'"/> | |
| 510 <has_text text="color='EntityID'"/> | |
| 511 <has_text text="fill_alpha=0.3"/> | |
| 512 <has_text text="outline_width=1.0"/> | |
| 513 <has_text text="outline_color='#ff0000'"/> | |
| 514 <has_text text="outline_alpha=0.8"/> | |
| 515 </assert_stdout> | |
| 516 <output name="plot_output" ftype="jpg"> | |
| 517 <assert_contents> | |
| 518 <has_image_center_of_mass center_of_mass="290, 247" eps="5"/> | |
| 519 <has_image_channels channels="3"/> | |
| 520 <has_image_height height="491"/> | |
| 521 <has_image_width width="582"/> | |
| 522 </assert_contents> | |
| 523 </output> | |
| 524 </test> | |
| 525 <!-- test 5 - combination: image + labels (xenium) --> | |
| 526 <test> | |
| 527 <param name="input_spatialdata" location="https://zenodo.org/records/18746346/files/xenium_spatialdata.spatialdata.zip"/> | |
| 528 <repeat name="render_images"> | |
| 529 <param name="image_element" value="morphology_focus"/> | |
| 530 </repeat> | |
| 531 <repeat name="render_labels"> | |
| 532 <param name="labels_element" value="cell_labels"/> | |
| 533 <param name="contour_px" value="1"/> | |
| 534 <param name="outline_alpha" value="0.7"/> | |
| 535 <param name="fill_alpha" value="0.0"/> | |
| 536 </repeat> | |
| 537 <assert_stdout> | |
| 538 <has_text text="spdata.pl.render_images"/> | |
| 539 <has_text text="element='morphology_focus'"/> | |
| 540 <has_text text="spdata.pl.render_labels"/> | |
| 541 <has_text text="element='cell_labels'"/> | |
| 542 </assert_stdout> | |
| 543 <output name="plot_output" ftype="jpg"> | |
| 544 <assert_contents> | |
| 545 <has_image_center_of_mass center_of_mass="81, 247" eps="5"/> | |
| 546 <has_image_channels channels="3"/> | |
| 547 <has_image_height height="491"/> | |
| 548 <has_image_width width="248"/> | |
| 549 </assert_contents> | |
| 550 </output> | |
| 551 </test> | |
| 552 <!-- test 6 - combination: points + shapes (merscope) --> | |
| 553 <test> | |
| 554 <param name="input_spatialdata" location="https://zenodo.org/records/18746346/files/merscope_spatialdata.spatialdata.zip"/> | |
| 555 <repeat name="render_points"> | |
| 556 <param name="points_element" value="slide_name_region_transcripts"/> | |
| 557 <param name="alpha" value="0.5"/> | |
| 558 <param name="size" value="1.5"/> | |
| 559 </repeat> | |
| 560 <repeat name="render_shapes"> | |
| 561 <param name="shapes_element" value="slide_name_region_polygons"/> | |
| 562 <param name="fill_alpha" value="0.0"/> | |
| 563 <conditional name="outline_condi"> | |
| 564 <param name="outline_type" value="yes"/> | |
| 565 <param name="outline_width1" value="0.5"/> | |
| 566 <param name="outline_color1" value="#ffffff"/> | |
| 567 <param name="outline_alpha1" value="1.0"/> | |
| 568 </conditional> | |
| 569 </repeat> | |
| 570 <assert_stdout> | |
| 571 <has_text text="spdata.pl.render_points"/> | |
| 572 <has_text text="element='slide_name_region_transcripts'"/> | |
| 573 <has_text text="spdata.pl.render_shapes"/> | |
| 574 <has_text text="element='slide_name_region_polygons'"/> | |
| 575 </assert_stdout> | |
| 576 <output name="plot_output" ftype="jpg"> | |
| 577 <assert_contents> | |
| 578 <has_image_center_of_mass center_of_mass="245, 244" eps="5"/> | |
| 579 <has_image_channels channels="3"/> | |
| 580 <has_image_height height="491"/> | |
| 581 <has_image_width width="492"/> | |
| 582 </assert_contents> | |
| 583 </output> | |
| 584 </test> | |
| 585 <!-- test 7 - combination: image + points + shapes (merscope) --> | |
| 586 <test> | |
| 587 <param name="input_spatialdata" location="https://zenodo.org/records/18746346/files/merscope_spatialdata.spatialdata.zip"/> | |
| 588 <repeat name="render_images"> | |
| 589 <param name="image_element" value="slide_name_region_z3"/> | |
| 590 </repeat> | |
| 591 <repeat name="render_points"> | |
| 592 <param name="points_element" value="slide_name_region_transcripts"/> | |
| 593 <param name="alpha" value="0.6"/> | |
| 594 <param name="size" value="2.0"/> | |
| 595 </repeat> | |
| 596 <repeat name="render_shapes"> | |
| 597 <param name="shapes_element" value="slide_name_region_polygons"/> | |
| 598 <param name="fill_alpha" value="0.0"/> | |
| 599 <conditional name="outline_condi"> | |
| 600 <param name="outline_type" value="yes"/> | |
| 601 <param name="outline_width1" value="1.0"/> | |
| 602 <param name="outline_color1" value="#00ff00"/> | |
| 603 <param name="outline_alpha1" value="0.8"/> | |
| 604 </conditional> | |
| 605 </repeat> | |
| 606 <assert_stdout> | |
| 607 <has_text text="spdata.pl.render_images"/> | |
| 608 <has_text text="element='slide_name_region_z3'"/> | |
| 609 <has_text text="spdata.pl.render_points"/> | |
| 610 <has_text text="element='slide_name_region_transcripts'"/> | |
| 611 <has_text text="spdata.pl.render_shapes"/> | |
| 612 <has_text text="element='slide_name_region_polygons'"/> | |
| 613 </assert_stdout> | |
| 614 <output name="plot_output" ftype="jpg"> | |
| 615 <assert_contents> | |
| 616 <has_image_center_of_mass center_of_mass="242, 244" eps="5"/> | |
| 617 <has_image_channels channels="3"/> | |
| 618 <has_image_height height="491"/> | |
| 619 <has_image_width width="492"/> | |
| 620 </assert_contents> | |
| 621 </output> | |
| 622 </test> | |
| 623 </tests> | |
| 624 <help><![CDATA[ | |
| 625 **What it does** | |
| 626 | |
| 627 This tool creates rich static plots from SpatialData objects. It provides comprehensive visualization capabilities for spatial omics data, including images, labels (segmentation masks), point data (e.g., transcripts), and geometric shapes (e.g., cell boundaries). | |
| 628 | |
| 629 ----- | |
| 630 | |
| 631 **Rendering Options** | |
| 632 | |
| 633 The tool supports four types of spatial elements: | |
| 634 | |
| 635 **1. Images**: Render microscopy images, H&E stains, or fluorescence channels | |
| 636 - Select specific channels or view all | |
| 637 - Apply colormaps and adjust transparency | |
| 638 - Control resolution and rendering quality | |
| 639 | |
| 640 **2. Labels**: Visualize segmentation masks (cells, nuclei, tissues) | |
| 641 - Color by categorical or continuous variables from annotation tables | |
| 642 - Adjust contour width and fill transparency | |
| 643 - Show only specific groups/categories | |
| 644 | |
| 645 **3. Points**: Display point-based data (e.g., transcript locations) | |
| 646 - Color by features or metadata | |
| 647 - Adjust point size and transparency | |
| 648 - Choose between matplotlib (smaller datasets) or datashader (large datasets) rendering | |
| 649 | |
| 650 **4. Shapes**: Render geometric shapes (circles, polygons, boundaries) | |
| 651 - Color by annotations or use solid colors | |
| 652 - Control outline and fill properties | |
| 653 - Convert shapes to standard geometries (circles, hexagons, squares) | |
| 654 | |
| 655 ----- | |
| 656 | |
| 657 **Display Parameters** | |
| 658 | |
| 659 - **Coordinate Systems**: Select which spatial coordinate systems to visualize | |
| 660 - **Figure Layout**: Control subplot arrangement, figure size, and resolution | |
| 661 - **Legend**: Customize font, position, and content | |
| 662 - **Title**: Add custom titles to plots | |
| 663 | |
| 664 ----- | |
| 665 | |
| 666 **Usage Tips** | |
| 667 | |
| 668 1. **Layer Multiple Elements**: Enable multiple render options (e.g., images + labels + points) to create overlay visualizations | |
| 669 2. **Color by Annotations**: Use the 'color' parameter to visualize gene expression or cell type labels from annotation tables | |
| 670 3. **Performance**: For large datasets, consider using datashader rendering method for points and shapes | |
| 671 4. **Resolution**: Use 'scale' parameter to balance between rendering speed and image quality | |
| 672 | |
| 673 ----- | |
| 674 | |
| 675 **Output** | |
| 676 | |
| 677 The tool generates a static plot image in the selected format (JPG, PNG, PDF, SVG, EPS, or TIFF) containing the rendered visualization(s). Multiple coordinate systems will be displayed as separate subplots arranged in a grid. | |
| 678 | |
| 679 ----- | |
| 680 | |
| 681 **More Information** | |
| 682 | |
| 683 - `SpatialData Plot documentation <https://spatialdata.scverse.org/projects/plot/en/stable/>`__ | |
| 684 - `SpatialData documentation <https://spatialdata.scverse.org/>`__ | |
| 685 | |
| 686 ]]></help> | |
| 687 <expand macro="citations" /> | |
| 688 </tool> |
