comparison vpt_segment.xml @ 0:8b9500115e69 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/vpt commit 16e04b2423dc0380a47243fb15bfd120dd95dedc
author bgruening
date Sun, 22 Jun 2025 12:25:34 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8b9500115e69
1 <tool id="vpt_segment" name="Vizgen VPT - Segment" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
2 <description>cells and refine MERSCOPE experiments</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 @CMD@
10 ln -s '$detected_transcripts' 'input/detected_transcripts.csv' &&
11 ln -s '$vpt_config_file' 'input/vpt_config_file.json' &&
12 ### segmentation
13 vpt
14 @COMMON_ARGS@
15 run-segmentation
16 --segmentation-algorithm 'input/vpt_config_file.json'
17 --input-images 'input/images/'
18 --input-micron-to-mosaic 'input/micron_to_mosaic_pixel_transform.csv'
19 --output-path 'output/'
20 --tile-size $tile_size
21 #if $max_row_group_size:
22 --max-row-group-size $max_row_group_size
23 #end if
24 --tile-overlap $tile_overlap &&
25 ### counting partition transcripts
26 vpt
27 @COMMON_ARGS@
28 partition-transcripts
29 --input-boundaries 'output/cellpose2_micron_space.parquet'
30 --input-transcripts 'input/detected_transcripts.csv'
31 --output-entity-by-gene 'output/cell_by_gene.csv'
32 --output-transcripts 'output/detected_transcripts.csv' &&
33 ### sum signals
34 vpt
35 @COMMON_ARGS@
36 sum-signals
37 --input-images 'input/images/'
38 --input-boundaries 'output/cellpose2_micron_space.parquet'
39 --input-micron-to-mosaic 'input/micron_to_mosaic_pixel_transform.csv'
40 --output-csv 'output/sum_signals.csv' &&
41 ### derive entity metadata
42 vpt
43 @COMMON_ARGS@
44 derive-entity-metadata
45 --input-boundaries 'output/cellpose2_micron_space.parquet'
46 --input-entity-by-gene 'output/cell_by_gene.csv'
47 --output-metadata 'output/cell_metadata.csv' &&
48 ### segmentation QC
49 vpt
50 @COMMON_ARGS@
51 generate-segmentation-metrics
52 --input-entity-by-gene 'output/cell_by_gene.csv'
53 --input-metadata 'output/cell_metadata.csv'
54 --input-transcripts 'output/detected_transcripts.csv'
55 --input-boundaries 'output/cellpose2_micron_space.parquet'
56 --input-micron-to-mosaic 'input/micron_to_mosaic_pixel_transform.csv'
57 --input-images 'input/images/'
58 --experiment-name '$qc_params.experiment_name'
59 --input-z-index '$qc_params.input_z_index'
60 #if $qc_params.red_stain_name != "None":
61 --red-stain-name '$qc_params.red_stain_name'
62 #end if
63 #if $qc_params.green_stain_name != "None":
64 --green-stain-name '$qc_params.green_stain_name'
65 #end if
66 #if $qc_params.blue_stain_name != "None":
67 --blue-stain-name '$qc_params.blue_stain_name'
68 #end if
69 --transcript-count-filter-threshold '$qc_params.transcript_count_filter_threshold'
70 --volume-filter-threshold '$qc_params.volume_filter_threshold'
71 --output-csv 'output/metrics.csv'
72 --output-report 'output/metrics.html'
73 --output-clustering 'output/metrics_clustering.parquet' &&
74 mv 'input/vpt_config_file.json' 'output/vpt_config_file.json'
75 ]]></command>
76 <configfiles>
77 <configfile name="vpt_config_file"><![CDATA[
78 {
79 "experiment_properties": {
80 #set $indices = ",".join([str(i) for i in range(len(str($vpt_config.experiment_properties.z_positions_um.value).split(",")))])
81
82 "all_z_indexes": [$indices],
83 "z_positions_um": [$vpt_config.experiment_properties.z_positions_um]
84 },
85 "segmentation_tasks": [
86 #set $task_n = len($vpt_config.segmentation_tasks.segmentation_task) - 1
87 #for $i, $task in enumerate($vpt_config.segmentation_tasks.segmentation_task):
88 {
89 "task_id": $i,
90 "segmentation_family": "Cellpose2",
91 #if $task.entity_types_detected != "both":
92 "entity_types_detected": ["$task.entity_types_detected"],
93 #else:
94 "entity_types_detected": [
95 "nuclei",
96 "cell"
97 ],
98 #end if
99 "z_layers": [$task.z_layers],
100 "segmentation_properties": {
101 #if $task.segmentation_properties.model != "null":
102 "model": "$task.segmentation_properties.model",
103 #else:
104 "model": null,
105 #end if
106 "model_dimensions": "$task.segmentation_properties.model_dimensions",
107 #if $task.segmentation_properties.custom_weights:
108 "custom_weights": "$task.segmentation_properties.custom_weights",
109 #else:
110 "custom_weights": null,
111 #end if
112 "channel_map": {
113 #if $task.segmentation_properties.channel_map.channel_red_conditional.red != "None":
114 "red": "$task.segmentation_properties.channel_map.channel_red_conditional.red",
115 #else:
116 "red": "",
117 #end if
118 #if $task.segmentation_properties.channel_map.channel_green_conditional.green != "None":
119 "green": "$task.segmentation_properties.channel_map.channel_green_conditional.green",
120 #else:
121 "green": "",
122 #end if
123 #if $task.segmentation_properties.channel_map.channel_blue_conditional.blue != "None":
124 "blue": "$task.segmentation_properties.channel_map.channel_blue_conditional.blue"
125 #else:
126 "blue": ""
127 #end if
128 }
129 },
130 "task_input_data": [
131 #if $task.segmentation_properties.channel_map.channel_red_conditional.red != "None":
132 #set $input_data = $task.segmentation_properties.channel_map.channel_red_conditional
133 {
134 "image_channel": "$task.segmentation_properties.channel_map.channel_red_conditional.red",
135 "image_preprocessing": [
136 #if $input_data.normalize_conditional.normalize_select == "Yes":
137 {
138 "name": "normalize",
139 "parameters": {
140 #if $input_data.normalize_conditional.normalize_type_conditional.normalization == "CLAHE":
141 "clip_limit": $input_data.normalize_conditional.normalize_type_conditional.clip_limit,
142 "filter_size": [
143 $input_data.normalize_conditional.normalize_type_conditional.filter_size,
144 $input_data.normalize_conditional.normalize_type_conditional.filter_size
145 ],
146 "type": "$input_data.normalize_conditional.normalize_type_conditional.normalization"
147 #end if
148 }
149 }#if $input_data.blur_conditional.blur_select == "Yes" or $input_data.downsample_conditional.downsample_select == "Yes"
150 ,
151 #end if
152 #end if
153 #if $input_data.blur_conditional.blur_select == "Yes":
154 {
155 "name": "blur",
156 "parameters": {
157 "type": "$input_data.blur_conditional.blur_options",
158 "size": $input_data.blur_conditional.kernel_size
159 }
160 }#if $input_data.downsample_conditional.downsample_select == "Yes"
161 ,
162 #end if
163 #end if
164 #if $input_data.downsample_conditional.downsample_select == "Yes":
165 {
166 "name": "downsample",
167 "parameters": {
168 "scale": "$input_data.downsample_conditional.scale"
169 }
170 }
171 #end if
172 ]
173 }#if $task.segmentation_properties.channel_map.channel_green_conditional.green != "None" or $task.segmentation_properties.channel_map.channel_blue_conditional.blue != "None":
174 ,
175 #end if
176 #end if
177 #if $task.segmentation_properties.channel_map.channel_green_conditional.green != "None":
178 #set $input_data = $task.segmentation_properties.channel_map.channel_green_conditional
179 {
180 "image_channel": "$task.segmentation_properties.channel_map.channel_green_conditional.green",
181 "image_preprocessing": [
182 #if $input_data.normalize_conditional.normalize_select == "Yes":
183 {
184 "name": "normalize",
185 "parameters": {
186 #if $input_data.normalize_conditional.normalize_type_conditional.normalization == "CLAHE":
187 "clip_limit": $input_data.normalize_conditional.normalize_type_conditional.clip_limit,
188 "filter_size": [
189 $input_data.normalize_conditional.normalize_type_conditional.filter_size,
190 $input_data.normalize_conditional.normalize_type_conditional.filter_size
191 ],
192 "type": "$input_data.normalize_conditional.normalize_type_conditional.normalization"
193 #end if
194 }
195 }#if $input_data.blur_conditional.blur_select == "Yes" or $input_data.downsample_conditional.downsample_select == "Yes"
196 ,
197 #end if
198 #end if
199 #if $input_data.blur_conditional.blur_select == "Yes":
200 {
201 "name": "blur",
202 "parameters": {
203 "type": "$input_data.blur_conditional.blur_options",
204 "size": $input_data.blur_conditional.kernel_size
205 }
206 }#if $input_data.downsample_conditional.downsample_select == "Yes"
207 ,
208 #end if
209 #end if
210 #if $input_data.downsample_conditional.downsample_select == "Yes":
211 {
212 "name": "downsample",
213 "parameters": {
214 "scale": "$input_data.downsample_conditional.scale"
215 }
216 }
217 #end if
218 ]
219 }#if $task.segmentation_properties.channel_map.channel_blue_conditional.blue != "None":
220 ,
221 #end if
222 #end if
223 #if $task.segmentation_properties.channel_map.channel_blue_conditional.blue != "None":
224 #set $input_data = $task.segmentation_properties.channel_map.channel_blue_conditional
225 {
226 "image_channel": "$task.segmentation_properties.channel_map.channel_blue_conditional.blue",
227 "image_preprocessing": [
228 #if $input_data.normalize_conditional.normalize_select == "Yes":
229 {
230 "name": "normalize",
231 "parameters": {
232 #if $input_data.normalize_conditional.normalize_type_conditional.normalization == "CLAHE":
233 "clip_limit": $input_data.normalize_conditional.normalize_type_conditional.clip_limit,
234 "filter_size": [
235 $input_data.normalize_conditional.normalize_type_conditional.filter_size,
236 $input_data.normalize_conditional.normalize_type_conditional.filter_size
237 ],
238 "type": "$input_data.normalize_conditional.normalize_type_conditional.normalization"
239 #end if
240 }
241 }#if $input_data.blur_conditional.blur_select == "Yes" or $input_data.downsample_conditional.downsample_select == "Yes"
242 ,
243 #end if
244 #end if
245 #if $input_data.blur_conditional.blur_select == "Yes":
246 {
247 "name": "blur",
248 "parameters": {
249 "type": "$input_data.blur_conditional.blur_options",
250 "size": $input_data.blur_conditional.kernel_size
251 }
252 }#if $input_data.downsample_conditional.downsample_select == "Yes"
253 ,
254 #end if
255 #end if
256 #if $input_data.downsample_conditional.downsample_select == "Yes":
257 {
258 "name": "downsample",
259 "parameters": {
260 "scale": "$input_data.downsample_conditional.scale"
261 }
262 }
263 #end if
264 ]
265 }
266 #end if
267 ],
268 "segmentation_parameters": {
269 #if $task.segmentation_parameters.nuclear_channel != "None":
270 "nuclear_channel": "$task.segmentation_parameters.nuclear_channel",
271 #else:
272 "nuclear_channel": null,
273 #end if
274 #if $task.segmentation_parameters.entity_fill_channel != "None":
275 "entity_fill_channel": "$task.segmentation_parameters.entity_fill_channel",
276 #else:
277 "entity_fill_channel": null,
278 #end if
279 "diameter": $task.segmentation_parameters.diameter,
280 "flow_threshold": $task.segmentation_parameters.flow_threshold,
281 "cellprob_threshold": $task.segmentation_parameters.cellprob_threshold,
282 "minimum_mask_size": $task.segmentation_parameters.minimum_mask_size
283 },
284 "polygon_parameters": {
285 "simplification_tol": $task.polygon_parameters.simplification_tol,
286 "smoothing_radius": $task.polygon_parameters.smoothing_radius,
287 "minimum_final_area": $task.polygon_parameters.minimum_final_area
288 }
289 }#if $i != $task_n
290 ,
291 #end if
292 #end for
293 ],
294 "segmentation_task_fusion": {
295 "entity_fusion_strategy": "$segmentation_task_fusion.entity_fusion_strategy",
296 "fused_polygon_postprocessing_parameters": {
297 "min_distance_between_entities": $segmentation_task_fusion.min_distance_between_entities,
298 "min_final_area": $segmentation_task_fusion.min_final_area
299 }
300 },
301 "output_files": [
302 {
303 #if $vpt_config.output_files.entity_types_output != "both":
304 "entity_types_output": ["$vpt_config.output_files.entity_types_output"],
305 #else:
306 "entity_types_output": [
307 "nuclei",
308 "cell"
309 ],
310 #end if
311 "files": {
312 "run_on_tile_dir": "result_tiles/",
313 "mosaic_geometry_file": "cellpose2_mosaic_space.parquet",
314 "micron_geometry_file": "cellpose2_micron_space.parquet",
315 "cell_metadata_file": "cellpose2_cell_metadata.csv"
316 }
317 }
318 ]
319 }
320 ]]></configfile>
321 </configfiles>
322 <inputs>
323 <expand macro="common_input"/>
324 <param argument="--detected_transcripts" type="data" format="csv" label="Detected transcripts"/>
325 <param argument="--tile_size" type="integer" min="1" value="4096" label="Number of pixels for the width and height of each tile"/>
326 <param argument="--tile_overlap" type="integer" min="0" max="100" value="10" label="Overlap between adjacent tiles (%)" help="Default: 10% of tile size"/>
327 <param argument="--max_row_group_size" type="integer" min="1000" value="" optional="true" label="Maximum number of rows in row groups inside output parquet files"/>
328 <section name="vpt_config" title="Segmentation configuration file">
329 <section name="experiment_properties" title="Experiment properties" help="Specify the z-indexes and z-positions in the data. It is used to apply 2D segmentation to 3D data and calculate distances on the z-axis.">
330 <param argument="--z_positions_um" type="text" value="1.5, 3, 4.5, 6, 7.5, 9, 10.5" label="Z-layer positions in micron">
331 <expand macro="sanitize_digits"/>
332 </param>
333 </section>
334 <section name="segmentation_tasks" title="Segmentation tasks" help="A list of segmentation tasks to perform sequentially. The VPT only supports 9 tasks in a single segmentation algorithm. If more tasks are needed, users are encouraged to run vpt multiple times and combine the segmentation outputs post hoc.">
335 <repeat name="segmentation_task" min="1" max="9" title="Segmentation tasks">
336 <param argument="--entity_types_detected" type="select" label="Detect cell or nucleus?">
337 <option value="cell">cell</option>
338 <option value="nucleus">nucleus</option>
339 <option value="both">both</option>
340 </param>
341 <param argument="--z_layers" type="text" value="3" optional="false" label="Comma-separated list of z-index images to segment.">
342 <expand macro="sanitize_digits"/>
343 </param>
344 <section name="segmentation_properties" title="Segmentation properties">
345 <param argument="--model" type="select" label="Cellpose model">
346 <option value="cyto2">cyto2</option>
347 <option value="nuclei">nuclei</option>
348 <option value="null">null</option>
349 </param>
350 <param argument="--model_dimensions" type="select" label="Model dimensions" help="2D applies the 2D Cellpose model to all z-planes specified in the z_layers list separately and the results are combined into a 3D output. 3D applies the native-3D Cellpose model to all z-planes specified in the z_layers list.">
351 <option value="2D">2D</option>
352 <option value="3D">3D</option>
353 </param>
354 <param argument="--custom_weights" type="data" format="data" optional="true" label="Custom Cellpose weights file"/>
355 <section name="channel_map" title="Channel map" expanded="true" help="Specify the channel map for the segmentation task with the corresponding task input data">
356 <conditional name="channel_red_conditional">
357 <param name="red" type="select" label="The stain that will be used for red channel">
358 <expand macro="channel_options_none"/>
359 </param>
360 <expand macro="channel_map_conditional_childs"/>
361 </conditional>
362 <conditional name="channel_green_conditional">
363 <param name="green" type="select" label="The stain that will be used for green channel">
364 <expand macro="channel_options_none"/>
365 </param>
366 <expand macro="channel_map_conditional_childs"/>
367 </conditional>
368 <conditional name="channel_blue_conditional">
369 <param name="blue" type="select" label="The stain that will be used for blue channel">
370 <expand macro="channel_options_none"/>
371 </param>
372 <expand macro="channel_map_conditional_childs"/>
373 </conditional>
374 </section>
375 </section>
376 <section name="segmentation_parameters" title="Segmentation parameters">
377 <param name="nuclear_channel" type="select" label="Nuclear channel">
378 <expand macro="channel_options_none">
379 <option value="all">all</option>
380 </expand>
381 </param>
382 <param name="entity_fill_channel" type="select" label="Entity fill channel">
383 <expand macro="channel_options_none">
384 <option value="all">all</option>
385 </expand>
386 </param>
387 <param name="diameter" type="integer" min="0" value="30" label="Diameter" help="A default value of 0 automatically estimate the diameter with Cellpose. Too small diameter leads to fragmented cells and too big one leads to over-merged cells"/>
388 <param name="flow_threshold" type="float" min="0" max="1" value="0.4" label="Flow threshold" help="Maximum allowed error of the flows for each mask. Increase if cellpose is not returning as many ROIs as you’d expect, and decrease if cellpose is returning too many ill-shaped ROIs"/>
389 <param name="cellprob_threshold" type="float" min="-6" max="6" value="0.0" label="Cellprobe threshold" help="Decrease this threshold if cellpose is not returning as many ROIs as you’d expect. Similarly, increase this threshold if cellpose is returning too ROIs particularly from dim areas."/>
390 <param name="minimum_mask_size" type="integer" min="-1" value="15" label="Minimum number of pixels per mask" help="This can be turned off with -1"/>
391 </section>
392 <section name="polygon_parameters" title="Polygon parameters">
393 <param name="simplification_tol" type="integer" min="0" value="2" label="Simplification tolerance" help="The acceptable loss of precision when simplifying cell boundaries. Even a small amount of simplification (2 px) dramatically improves processing time" />
394 <param name="smoothing_radius" type="integer" min="0" value="10" label="Smoothing radius" help="The size of a smoothing operation comparable to morphologically closing and then opening the cell mask using the same structuring element" />
395 <param name="minimum_final_area" type="integer" min="0" value="500" label="Minimum final area" help="Minimum area of a polygon to retain the cell. Used to filter spurious detections." />
396 </section>
397 </repeat>
398 </section>
399 <section name="segmentation_task_fusion" title="Segmentation task fusion" help="Specify how the geometries produced by each segmentation task should be combined">
400 <param name="entity_fusion_strategy" type="select" label="Entity fusion strategy">
401 <option value="harmonize" selected="true">harmonize (recommended)</option>
402 <option value="union">union</option>
403 <option value="larger">larger</option>
404 </param>
405 <param name="min_distance_between_entities" type="integer" min="0" value="2" label="Minimum distance between entities" help="When polygons are subtracted from one another, the space between the cells is zero. In order to provide some separation between cells, a minimum distance between these cell can be specified."/>
406 <param name="min_final_area" type="integer" min="0" value="0" label="Minimum area" help="After polygon subtraction, cells smaller than this threshold will be removed"/>
407 </section>
408 <section name="output_files" title="Output files">
409 <param name="entity_types_output" type="select" label="Output entity types">
410 <option value="cell">cell</option>
411 <option value="nucleus">nucleus</option>
412 <option value="both">both</option>
413 </param>
414 </section>
415 </section>
416 <section name="qc_params" title="QC metrics parameters">
417 <param argument="--experiment-name" type="text" value="Analysis Timestamp" label="The name of the experiment to be used as the index in the output csv and segmentation report">
418 <sanitizer invalid_char="">
419 <valid initial="string.letters,string.digits">
420 <add value="_" />
421 </valid>
422 </sanitizer>
423 <validator type="regex">[0-9a-zA-Z_]+</validator>
424 </param>
425 <param argument="--input-z-index" type="integer" min="0" value="2" label="The Z plane of the mosaic tiff images to use for the patch"/>
426 <param argument="--transcript-count-filter-threshold" type="integer" min="0" value="100" label="The cell transcript count threshold used for computing metrics and clustering"/>
427 <param argument="--volume-filter-threshold" type="integer" min="0" value="200" label="The cell volume threshold used for computing metrics and clustering"/>
428 <param argument="--red-stain-name" type="select" label="The stain that will be used for red channel in images">
429 <expand macro="channel_options_none"/>
430 </param>
431 <param argument="--green-stain-name" type="select" label="The stain that will be used for green channel in images">
432 <expand macro="channel_options_basic">
433 <option value="None">None</option>
434 <option value="DAPI">DAPI</option>
435 <option value="PolyT" selected="true">PolyT</option>
436 </expand>
437 </param>
438 <param argument="--blue-stain-name" type="select" label="The stain that will be used for blue channel in images">
439 <expand macro="channel_options_basic">
440 <option value="None">None</option>
441 <option value="DAPI" selected="true">DAPI</option>
442 <option value="PolyT">PolyT</option>
443 </expand>
444 </param>
445 </section>
446 <expand macro="advanced_output"/>
447 </inputs>
448 <outputs>
449 <collection name="vpt_results" type="list" label="${tool.name} on ${on_string}: VPT Results">
450 <discover_datasets pattern="(?P&lt;name&gt;.+)\.csv$" format="csv" directory="output"/>
451 </collection>
452 <collection name="vpt_boundaries" type="list" label="${tool.name} on ${on_string}: VPT segmentation boundaries">
453 <discover_datasets pattern="(?P&lt;name&gt;.+)\.parquet$" format="parquet" directory="output"/>
454 </collection>
455 <data name="vpt_qc" format="html" from_work_dir="output/metrics.html" label="${tool.name} on ${on_string}: VPT QC"/>
456 <collection name="vpt_config_out" type="list" label="${tool.name} on ${on_string}: VPT Config">
457 <discover_datasets pattern="(?P&lt;name&gt;.+)\.json$" format="json" directory="output"/>
458 </collection>
459 <expand macro="common_output"/>
460 </outputs>
461 <tests>
462 <!-- test 1: one segmentation task -->
463 <test expect_num_outputs="5">
464 <param name="input_images" location="https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z0.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z1.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z2.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z3.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z4.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z5.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z6.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z0.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z1.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z2.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z3.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z4.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z5.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z6.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z0.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z1.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z2.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z3.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z4.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z5.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z6.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z0.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z1.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z2.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z3.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z4.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z5.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z6.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z0.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z1.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z2.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z3.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z4.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z5.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z6.tif"/>
465 <param name="input_micron_to_mosaic" location="https://zenodo.org/records/15319018/files/micron_to_mosaic_pixel_transform.csv"/>
466 <param name="detected_transcripts" location="https://zenodo.org/records/15319018/files/detected_transcripts.csv"/>
467 <section name="vpt_config">
468 <section name="experiment_properties">
469 <param name="z_positions_um" value="1.5, 3, 4.5, 6, 7.5, 9, 10.5"/>
470 </section>
471 <section name="segmentation_tasks">
472 <repeat name="segmentation_task">
473 <param name="entity_types_detected" value="cell"/>
474 <param name="z_layers" value="3"/>
475 <section name="segmentation_properties">
476 <param name="model" value="cyto2"/>
477 <param name="model_dimensions" value="2D"/>
478 <section name="channel_map">
479 <conditional name="channel_red_conditional">
480 <param name="red" value="Cellbound1"/>
481 <conditional name="normalize_conditional">
482 <param name="normalize_select" value="Yes"/>
483 <conditional name="normalize_type_conditional">
484 <param name="normalization" value="CLAHE"/>
485 <param name="clip_limit" value="0.01"/>
486 <param name="filter_size" value="100"/>
487 </conditional>
488 </conditional>
489 </conditional>
490 <conditional name="channel_green_conditional">
491 <param name="green" value="Cellbound3"/>
492 <conditional name="normalize_conditional">
493 <param name="normalize_select" value="Yes"/>
494 <conditional name="normalize_type_conditional">
495 <param name="normalization" value="CLAHE"/>
496 <param name="clip_limit" value="0.01"/>
497 <param name="filter_size" value="100"/>
498 </conditional>
499 </conditional>
500 </conditional>
501 <conditional name="channel_blue_conditional">
502 <param name="blue" value="DAPI"/>
503 <conditional name="normalize_conditional">
504 <param name="normalize_select" value="Yes"/>
505 <conditional name="normalize_type_conditional">
506 <param name="normalization" value="CLAHE"/>
507 <param name="clip_limit" value="0.01"/>
508 <param name="filter_size" value="100"/>
509 </conditional>
510 </conditional>
511 </conditional>
512 </section>
513 </section>
514 <section name="segmentation_parameters">
515 <param name="nuclear_channel" value="DAPI"/>
516 <param name="entity_fill_channel" value="all"/>
517 <param name="diameter" value="70"/>
518 <param name="flow_threshold" value="0.95"/>
519 <param name="cellprob_threshold" value="-5.5"/>
520 <param name="minimum_mask_size" value="500"/>
521 </section>
522 <section name="polygon_parameters">
523 <param name="simplification_tol" value="2"/>
524 <param name="smoothing_radius" value="10"/>
525 <param name="minimum_final_area" value="500"/>
526 </section>
527 </repeat>
528 </section>
529 <section name="segmentation_task_fusion">
530 <param name="entity_fusion_strategy" value="harmonize"/>
531 <param name="min_distance_between_entities" value="1"/>
532 <param name="min_final_area" value="500"/>
533 </section>
534 <section name="output_files">
535 <param name="entity_types_output" value="cell"/>
536 </section>
537 </section>
538 <section name="qc_params">
539 <param name="experiment_name" value="cyto2_1task"/>
540 </section>
541 <section name="advanced_output">
542 <param name="log" value="true"/>
543 </section>
544 <output_collection name="vpt_results" type="list">
545 <element name="cell_by_gene">
546 <assert_contents>
547 <has_text_matching expression="cell,AKAP11,CBX5,CCDC113"/>
548 <has_text_matching expression="0,2,0,3,0,0,0,0,2,6"/>
549 <has_text_matching expression="3,6,3,2,1,3,3,1,3,16,0,8,113"/>
550 </assert_contents>
551 </element>
552 <element name="cell_metadata">
553 <assert_contents>
554 <has_text_matching expression="EntityID,fov,volume,center_x,center_y,min_x,min_y,max_x,max_y,anisotropy,transcript_count,perimeter_area_ratio,solidity"/>
555 <has_text_matching expression=",752.854533232[0-9]+,315.600965641[0-9]+,5.50107977386[0-9]+,310.1669732237[0-9]+,"/>
556 <has_text_matching expression=",416.540438981[0-9]+,68.7110642977[0-9]+,9.67291568732[0-9]+,64.4947481953[0-9]+,"/>
557 </assert_contents>
558 </element>
559 <element name="detected_transcripts">
560 <assert_contents>
561 <has_text_matching expression=",barcode_id,global_x,global_y,global_z,x,y,fov,gene,transcript_id,cell_id"/>
562 <has_text_matching expression="86,10,285.00012,10.13364,0.0,816.0,153.0,0,AKAP11,ENST00000025301.3"/>
563 <has_text_matching expression="229,10,274.95612,35.72964,0.0,723.0,390.0,0,AKAP11,ENST00000025301.3"/>
564 </assert_contents>
565 </element>
566 <element name="metrics">
567 <assert_contents>
568 <has_text_matching expression=",Cell count,Cell volume"/>
569 <has_text_matching expression="All cells,814,1572.4,1533.3,735.8,654.0,92.1,108.0,96.4,68.2,0.0"/>
570 <has_text_matching expression="Cells after filtering,700,1694.1,1667.9,851.1,810.5,104.5,111.0,95.9,63.2,0.06"/>
571 </assert_contents>
572 </element>
573 <element name="sum_signals">
574 <assert_contents>
575 <has_text_matching expression="Cellbound2_raw,Cellbound2_high_pass"/>
576 <has_text_matching expression="813229843.0,4955524.23422[0-9]+"/>
577 <has_text_matching expression="587668405.0,22623235.0759[0-9]+"/>
578 </assert_contents>
579 </element>
580 </output_collection>
581 <output_collection name="vpt_boundaries" type="list">
582 <element name="cellpose2_micron_space">
583 <assert_contents>
584 <has_size size="232259" delta="100"/>
585 </assert_contents>
586 </element>
587 <element name="cellpose2_mosaic_space">
588 <assert_contents>
589 <has_size size="215395" delta="100"/>
590 </assert_contents>
591 </element>
592 </output_collection>
593 <output name="vpt_qc">
594 <assert_contents>
595 <has_text text="VPT Segmentation Report (cyto2_1task)"/>
596 <has_text text="Cell count: &lt;b class=&quot;summary__value&quot;&gt;814&lt;/b&gt;&lt;/p&gt;"/>
597 <has_text text="Transcripts per cell - median: &lt;b class=&quot;summary__value&quot;&gt;654.0&lt;/b&gt;&lt;/p&gt;"/>
598 </assert_contents>
599 </output>
600 <output_collection name="vpt_config_out" type="list">
601 <element name="segmentation_specification">
602 <assert_contents>
603 <has_text_matching expression="input/vpt_config_file.json"/>
604 <has_text_matching expression="input/images/"/>
605 <has_text_matching expression="input/micron_to_mosaic_pixel_transform.csv"/>
606 </assert_contents>
607 </element>
608 <element name="vpt_config_file">
609 <assert_contents>
610 <has_text_matching expression="0,1,2,3,4,5,6"/>
611 <has_text_matching expression="Cellpose2"/>
612 <has_text_matching expression="cyto2"/>
613 <has_text_matching expression="CLAHE"/>
614 <has_text_matching expression="harmonize"/>
615 </assert_contents>
616 </element>
617 </output_collection>
618 <output name="vpt_log">
619 <assert_contents>
620 <has_text_matching expression="run_segmentation finished"/>
621 <has_text_matching expression="Partition transcripts finished"/>
622 <has_text_matching expression="Sum signals finished"/>
623 <has_text_matching expression="Generate segmentation metrics finished"/>
624 </assert_contents>
625 </output>
626 </test>
627 <!-- test 2: two segmentation tasks -->
628 <test expect_num_outputs="5">
629 <param name="input_images" location="https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z0.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z1.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z2.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z3.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z4.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z5.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z6.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z0.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z1.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z2.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z3.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z4.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z5.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z6.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z0.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z1.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z2.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z3.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z4.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z5.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z6.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z0.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z1.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z2.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z3.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z4.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z5.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z6.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z0.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z1.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z2.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z3.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z4.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z5.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z6.tif"/>
630 <param name="input_micron_to_mosaic" location="https://zenodo.org/records/15319018/files/micron_to_mosaic_pixel_transform.csv"/>
631 <param name="detected_transcripts" location="https://zenodo.org/records/15319018/files/detected_transcripts.csv"/>
632 <section name="vpt_config">
633 <section name="segmentation_tasks">
634 <repeat name="segmentation_task">
635 <param name="entity_types_detected" value="cell"/>
636 <param name="z_layers" value="3"/>
637 <section name="segmentation_properties">
638 <param name="model" value="cyto2"/>
639 <param name="model_dimensions" value="2D"/>
640 <section name="channel_map">
641 <conditional name="channel_red_conditional">
642 <param name="red" value="Cellbound1"/>
643 <conditional name="normalize_conditional">
644 <param name="normalize_select" value="Yes"/>
645 <conditional name="normalize_type_conditional">
646 <param name="normalization" value="CLAHE"/>
647 <param name="clip_limit" value="0.01"/>
648 <param name="filter_size" value="100"/>
649 </conditional>
650 </conditional>
651 </conditional>
652 <conditional name="channel_green_conditional">
653 <param name="green" value="Cellbound3"/>
654 <conditional name="normalize_conditional">
655 <param name="normalize_select" value="Yes"/>
656 <conditional name="normalize_type_conditional">
657 <param name="normalization" value="CLAHE"/>
658 <param name="clip_limit" value="0.01"/>
659 <param name="filter_size" value="100"/>
660 </conditional>
661 </conditional>
662 </conditional>
663 <conditional name="channel_blue_conditional">
664 <param name="blue" value="DAPI"/>
665 <conditional name="normalize_conditional">
666 <param name="normalize_select" value="Yes"/>
667 <conditional name="normalize_type_conditional">
668 <param name="normalization" value="CLAHE"/>
669 <param name="clip_limit" value="0.01"/>
670 <param name="filter_size" value="100"/>
671 </conditional>
672 </conditional>
673 </conditional>
674 </section>
675 </section>
676 <section name="segmentation_parameters">
677 <param name="nuclear_channel" value="DAPI"/>
678 <param name="entity_fill_channel" value="all"/>
679 <param name="diameter" value="70"/>
680 <param name="flow_threshold" value="0.95"/>
681 <param name="cellprob_threshold" value="-5.5"/>
682 <param name="minimum_mask_size" value="500"/>
683 </section>
684 <section name="polygon_parameters">
685 <param name="simplification_tol" value="2"/>
686 <param name="smoothing_radius" value="10"/>
687 <param name="minimum_final_area" value="500"/>
688 </section>
689 </repeat>
690 <repeat name="segmentation_task">
691 <param name="entity_types_detected" value="cell"/>
692 <param name="z_layers" value="3"/>
693 <section name="segmentation_properties">
694 <param name="model" value="nuclei"/>
695 <param name="model_dimensions" value="2D"/>
696 <section name="channel_map">
697 <conditional name="channel_blue_conditional">
698 <param name="blue" value="DAPI"/>
699 <conditional name="normalize_conditional">
700 <param name="normalize_select" value="Yes"/>
701 <conditional name="normalize_type_conditional">
702 <param name="normalization" value="CLAHE"/>
703 <param name="clip_limit" value="0.01"/>
704 <param name="filter_size" value="100"/>
705 </conditional>
706 </conditional>
707 </conditional>
708 </section>
709 </section>
710 <section name="segmentation_parameters">
711 <param name="nuclear_channel" value="all"/>
712 <param name="entity_fill_channel" value="DAPI"/>
713 <param name="diameter" value="55"/>
714 <param name="flow_threshold" value="0.8"/>
715 <param name="cellprob_threshold" value="-3.0"/>
716 <param name="minimum_mask_size" value="500"/>
717 </section>
718 <section name="polygon_parameters">
719 <param name="simplification_tol" value="2"/>
720 <param name="smoothing_radius" value="10"/>
721 <param name="minimum_final_area" value="500"/>
722 </section>
723 </repeat>
724 </section>
725 <section name="segmentation_task_fusion">
726 <param name="entity_fusion_strategy" value="harmonize"/>
727 <param name="min_distance_between_entities" value="1"/>
728 <param name="min_final_area" value="500"/>
729 </section>
730 <section name="output_files">
731 <param name="entity_types_output" value="cell"/>
732 </section>
733 </section>
734 <section name="qc_params">
735 <param name="experiment_name" value="cyto2_2task"/>
736 </section>
737 <section name="advanced_output">
738 <param name="log" value="true"/>
739 </section>
740 <output_collection name="vpt_results" type="list">
741 <element name="cell_by_gene">
742 <assert_contents>
743 <has_text_matching expression="cell,AKAP11,CBX5,CCDC113"/>
744 <has_text_matching expression="0,0,0,0,0,0,0,0,0,1,0,1"/>
745 <has_text_matching expression="1,2,0,1,2,1,3,0,3,8,0,4,18,2,1,2,2,0,0,2,1,0"/>
746 </assert_contents>
747 </element>
748 <element name="cell_metadata">
749 <assert_contents>
750 <has_text_matching expression="EntityID,fov,volume,center_x,center_y,min_x,min_y,max_x,max_y,anisotropy,transcript_count,perimeter_area_ratio,solidity"/>
751 <has_text_matching expression=",833.754893427[0-9]+,340.820612890[0-9]+,1.070367649097[0-9]+,334.8351650026[0-9]+,-3.129014413402[0-9]+"/>
752 <has_text_matching expression=",879.995798798[0-9]+,357.422829969[0-9]+,2.811753148503[0-9]+,352.3315077075[0-9]+,-2.496679594480[0-9]+"/>
753 </assert_contents>
754 </element>
755 <element name="detected_transcripts">
756 <assert_contents>
757 <has_text_matching expression=",barcode_id,global_x,global_y,global_z,x,y,fov,gene,transcript_id,cell_id"/>
758 <has_text_matching expression="63,10,370.95007,5.520504,0.0,1611.833,110.285774,0,AKAP11,ENST00000025301.3"/>
759 <has_text_matching expression="68,10,355.46716,6.4616404,0.0,1468.4725,119.0,0,AKAP11,ENST00000025301.3"/>
760 </assert_contents>
761 </element>
762 <element name="metrics">
763 <assert_contents>
764 <has_text_matching expression=",Cell count,Cell volume"/>
765 <has_text_matching expression="All cells,811,1588.0,1549.9,740.5,669.0,92.2,109.0,96.7,68.6,0.0"/>
766 <has_text_matching expression="Cells after filtering,698,1711.6,1705.9,856.1,817.5,104.6,111.0,96.2,63.7,0.06"/>
767 </assert_contents>
768 </element>
769 <element name="sum_signals">
770 <assert_contents>
771 <has_text_matching expression="Cellbound2_raw,Cellbound2_high_pass"/>
772 <has_text_matching expression="56353541.0,781480.649952[0-9]+"/>
773 <has_text_matching expression="53118509.0,808077.377016[0-9]+"/>
774 </assert_contents>
775 </element>
776 </output_collection>
777 <output_collection name="vpt_boundaries" type="list">
778 <element name="cellpose2_micron_space">
779 <assert_contents>
780 <has_size size="232259" delta="100"/>
781 </assert_contents>
782 </element>
783 <element name="cellpose2_mosaic_space">
784 <assert_contents>
785 <has_size size="215395" delta="100"/>
786 </assert_contents>
787 </element>
788 </output_collection>
789 <output name="vpt_qc">
790 <assert_contents>
791 <has_text text="VPT Segmentation Report (cyto2_2task)"/>
792 <has_text text="Cell count: &lt;b class=&quot;summary__value&quot;&gt;811&lt;/b&gt;&lt;/p&gt;"/>
793 <has_text text="Transcripts per cell - median: &lt;b class=&quot;summary__value&quot;&gt;669.0&lt;/b&gt;&lt;/p&gt;"/>
794 </assert_contents>
795 </output>
796 <output_collection name="vpt_config_out" type="list">
797 <element name="segmentation_specification">
798 <assert_contents>
799 <has_text_matching expression="input/vpt_config_file.json"/>
800 <has_text_matching expression="input/images/"/>
801 <has_text_matching expression="input/micron_to_mosaic_pixel_transform.csv"/>
802 </assert_contents>
803 </element>
804 <element name="vpt_config_file">
805 <assert_contents>
806 <has_text_matching expression="0,1,2,3,4,5,6"/>
807 <has_text_matching expression="Cellpose2"/>
808 <has_text_matching expression="cyto2"/>
809 <has_text_matching expression="nuclei"/>
810 <has_text_matching expression="CLAHE"/>
811 <has_text_matching expression="harmonize"/>
812 </assert_contents>
813 </element>
814 </output_collection>
815 <output name="vpt_log">
816 <assert_contents>
817 <has_text_matching expression="run_segmentation finished"/>
818 <has_text_matching expression="Partition transcripts finished"/>
819 <has_text_matching expression="Sum signals finished"/>
820 <has_text_matching expression="Generate segmentation metrics finished"/>
821 </assert_contents>
822 </output>
823 </test>
824 <!-- test 3: one segmentation task with custom weight -->
825 <test expect_num_outputs="5">
826 <param name="input_images" location="https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z0.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z1.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z2.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z3.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z4.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z5.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound1_z6.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z0.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z1.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z2.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z3.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z4.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z5.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound2_z6.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z0.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z1.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z2.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z3.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z4.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z5.tif,https://zenodo.org/records/15319018/files/mosaic_Cellbound3_z6.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z0.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z1.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z2.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z3.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z4.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z5.tif,https://zenodo.org/records/15319018/files/mosaic_DAPI_z6.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z0.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z1.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z2.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z3.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z4.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z5.tif,https://zenodo.org/records/15319018/files/mosaic_PolyT_z6.tif"/>
827 <param name="input_micron_to_mosaic" location="https://zenodo.org/records/15319018/files/micron_to_mosaic_pixel_transform.csv"/>
828 <param name="detected_transcripts" location="https://zenodo.org/records/15319018/files/detected_transcripts.csv"/>
829 <section name="vpt_config">
830 <section name="segmentation_tasks">
831 <repeat name="segmentation_task">
832 <param name="entity_types_detected" value="cell"/>
833 <param name="z_layers" value="3"/>
834 <section name="segmentation_properties">
835 <param name="model" value="null"/>
836 <param name="model_dimensions" value="2D"/>
837 <param name="custom_weights" location="https://zenodo.org/records/15319018/files/CP_20230830_093420"/>
838 <section name="channel_map">
839 <conditional name="channel_red_conditional">
840 <param name="red" value="Cellbound1"/>
841 <conditional name="normalize_conditional">
842 <param name="normalize_select" value="Yes"/>
843 <conditional name="normalize_type_conditional">
844 <param name="normalization" value="CLAHE"/>
845 <param name="clip_limit" value="0.01"/>
846 <param name="filter_size" value="100"/>
847 </conditional>
848 </conditional>
849 </conditional>
850 <conditional name="channel_green_conditional">
851 <param name="green" value="Cellbound3"/>
852 <conditional name="normalize_conditional">
853 <param name="normalize_select" value="Yes"/>
854 <conditional name="normalize_type_conditional">
855 <param name="normalization" value="CLAHE"/>
856 <param name="clip_limit" value="0.01"/>
857 <param name="filter_size" value="100"/>
858 </conditional>
859 </conditional>
860 </conditional>
861 <conditional name="channel_blue_conditional">
862 <param name="blue" value="DAPI"/>
863 <conditional name="normalize_conditional">
864 <param name="normalize_select" value="Yes"/>
865 <conditional name="normalize_type_conditional">
866 <param name="normalization" value="CLAHE"/>
867 <param name="clip_limit" value="0.01"/>
868 <param name="filter_size" value="100"/>
869 </conditional>
870 </conditional>
871 </conditional>
872 </section>
873 </section>
874 <section name="segmentation_parameters">
875 <param name="nuclear_channel" value="DAPI"/>
876 <param name="entity_fill_channel" value="all"/>
877 <param name="diameter" value="70"/>
878 <param name="flow_threshold" value="0.95"/>
879 <param name="cellprob_threshold" value="-5.5"/>
880 <param name="minimum_mask_size" value="500"/>
881 </section>
882 <section name="polygon_parameters">
883 <param name="simplification_tol" value="2"/>
884 <param name="smoothing_radius" value="10"/>
885 <param name="minimum_final_area" value="500"/>
886 </section>
887 </repeat>
888 </section>
889 <section name="segmentation_task_fusion">
890 <param name="entity_fusion_strategy" value="harmonize"/>
891 <param name="min_distance_between_entities" value="1"/>
892 <param name="min_final_area" value="500"/>
893 </section>
894 <section name="output_files">
895 <param name="entity_types_output" value="cell"/>
896 </section>
897 </section>
898 <section name="qc_params">
899 <param name="experiment_name" value="custom_1task"/>
900 </section>
901 <section name="advanced_output">
902 <param name="log" value="true"/>
903 </section>
904 <output_collection name="vpt_results" type="list">
905 <element name="cell_by_gene">
906 <assert_contents>
907 <has_text_matching expression="cell,AKAP11,CBX5,CCDC113"/>
908 <has_text_matching expression="6,11,4,0,5,2,1,0,1,2,1,2"/>
909 <has_text_matching expression="0,1,0,0,0,0,1,0,0,4"/>
910 </assert_contents>
911 </element>
912 <element name="cell_metadata">
913 <assert_contents>
914 <has_text_matching expression="EntityID,fov,volume,center_x,center_y,min_x,min_y,max_x,max_y,anisotropy,transcript_count,perimeter_area_ratio,solidity"/>
915 <has_text_matching expression="168.0683921161[0-9]+,246.3592447472[0-9]+,-1.507707574380[0-9]+,243.9322371166[0-9]+"/>
916 <has_text_matching expression="1540.721726928[0-9]+,412.175889439[0-9]+,2.951632912099[0-9]+,404.3500198495[0-9]+"/>
917 </assert_contents>
918 </element>
919 <element name="detected_transcripts">
920 <assert_contents>
921 <has_text_matching expression=",barcode_id,global_x,global_y,global_z,x,y,fov,gene,transcript_id,cell_id"/>
922 <has_text_matching expression="63,10,370.95007,5.520504,0.0,1611.833,110.285774,0,AKAP11,ENST00000025301.3"/>
923 <has_text_matching expression="68,10,355.46716,6.4616404,0.0,1468.4725,119.0,0,AKAP11,ENST00000025301.3"/>
924 </assert_contents>
925 </element>
926 <element name="metrics">
927 <assert_contents>
928 <has_text_matching expression=",Cell count,Cell volume"/>
929 <has_text_matching expression="All cells,93[0-9]+,121\d*(\.\d+)?,118\d*(\.\d+)?,60\d*(\.\d+)?,49\d*(\.\d+)?,7\d*(\.\d+)?,10\d*(\.\d+)?,9\d*(\.\d+)?,6\d*(\.\d+)?,0.0"/>
930 <has_text_matching expression="Cells after filtering,659,1532.9,1553.5,850.2,837.0,104.8,112.0,90.2,53.8,0.15"/>
931 </assert_contents>
932 </element>
933 <element name="sum_signals">
934 <assert_contents>
935 <has_text_matching expression="Cellbound2_raw,Cellbound2_high_pass"/>
936 <has_text_matching expression="73446567.0,1605103.666715[0-9]+"/>
937 <has_text_matching expression="1642190888.0,16154095.44810[0-9]+"/>
938 </assert_contents>
939 </element>
940 </output_collection>
941 <output_collection name="vpt_boundaries" type="list">
942 <element name="cellpose2_micron_space">
943 <assert_contents>
944 <has_size size="375308" delta="100"/>
945 </assert_contents>
946 </element>
947 <element name="cellpose2_mosaic_space">
948 <assert_contents>
949 <has_size size="365132" delta="100"/>
950 </assert_contents>
951 </element>
952 </output_collection>
953 <output name="vpt_qc">
954 <assert_contents>
955 <has_text text="VPT Segmentation Report (custom_1task)"/>
956 <has_text_matching expression="Cell count: &lt;b class=&quot;summary__value&quot;&gt;93[0-9]+&lt;/b&gt;&lt;/p&gt;"/>
957 <has_text_matching expression="Transcripts per cell - median: &lt;b class=&quot;summary__value&quot;&gt;49\d*(\.\d+)?&lt;/b&gt;&lt;/p&gt;"/>
958 </assert_contents>
959 </output>
960 <output_collection name="vpt_config_out" type="list">
961 <element name="segmentation_specification">
962 <assert_contents>
963 <has_text_matching expression="input/vpt_config_file.json"/>
964 <has_text_matching expression="input/images/"/>
965 <has_text_matching expression="input/micron_to_mosaic_pixel_transform.csv"/>
966 </assert_contents>
967 </element>
968 <element name="vpt_config_file">
969 <assert_contents>
970 <has_text_matching expression="0,1,2,3,4,5,6"/>
971 <has_text_matching expression="Cellpose2"/>
972 <has_text_matching expression="null"/>
973 <has_text_matching expression="CLAHE"/>
974 <has_text_matching expression="harmonize"/>
975 </assert_contents>
976 </element>
977 </output_collection>
978 <output name="vpt_log">
979 <assert_contents>
980 <has_text_matching expression="run_segmentation finished"/>
981 <has_text_matching expression="Partition transcripts finished"/>
982 <has_text_matching expression="Sum signals finished"/>
983 <has_text_matching expression="Generate segmentation metrics finished"/>
984 </assert_contents>
985 </output>
986 </test>
987 </tests>
988 <help>
989 The Vizgen Post-processing Tool (VPT) is a scalable and reproducible tool which enables users to reprocess and refine the single-cell results of MERSCOPE experiments.
990
991 The **Vizgen Post-processing Tool - Segment Cells** performes **run_segmentation**, **partition_transcripts**, **sum_signals**, **derive-entity-metadata**, and **generate-segmentation-metrics** of the VPT pipeline. The segmentation
992
993 Segmentation parameters for CellPose can be assigned with "**Segmentation configuration file**".
994
995 The segmentation parameters describes a series of steps to perform on the input data. Using the same segmentation algorithm on a series of experiments ensures that they are processed identically and reproducibly.
996
997 The segmentation parameters has 3 main sections:
998
999 1. **Experiment properties**:
1000 - Holds descriptions of the way the data was collected. Specifically, it must contain a list of the z-indexes and z-positions in the data. This data is used to apply 2D segmentation to 3D data and calculate distances on the z-axis.
1001 2. **Segmentation tasks**:
1002 - Holds a list of segmentation tasks to perform. These tasks will be performed sequentially. By running different segmentation tools in "tasks" and combining their output, it is possible to improve cell detection. For example, combining the results of CellPose with the `cyto2` model and the `nuclei` model can dramatically improve the segmentation F1 score over either method alone.
1003 3. **Segmentation task fusion**:
1004 - Specifies how the geometries produced by each segmentation task should be combined. All `segmentation_task_fusion` options will produce a non-overlapping set of valid geometries.
1005 4. **Output files**:
1006 - Specifies which entity types should be written to disk in the output folder and the file names they should receive.
1007
1008
1009 For more information on the VPT pipeline, please refer to the `VPT user guide`_
1010
1011 -----
1012
1013 If you want to use a custom-trained model, set the CellPose model to null and provide the custom weights file.
1014
1015
1016 .. class:: infomark
1017
1018 **Note:** VPT only supports **9** tasks in a single segmentation algorithm. If more tasks are needed, users are encouraged to run vpt multiple times and combine the segmentation outputs post hoc.
1019
1020 .. class:: infomark
1021
1022 **Note:** VPT tool on Galaxy only uses **CellPose** algorithm for cell segmentation.
1023
1024 .. _`VPT user guide`: https://vizgen.github.io/vizgen-postprocessing/
1025 </help>
1026 <expand macro="citations" />
1027 </tool>