Skip to content

Commit 1540d6d

Browse files
committed
Restructured all tools, added sanitizers, added/fixed parameter help texts, added tool descriptions, added/fixed tests
1 parent 901a369 commit 1540d6d

File tree

7 files changed

+776
-387
lines changed

7 files changed

+776
-387
lines changed

tools/webatlas/build_config.xml

Lines changed: 289 additions & 59 deletions
Large diffs are not rendered by default.

tools/webatlas/consolidate_md.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<tool id="webatlas_consolidate_md" name="Webatlas Consolidate Metadata" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" python_template_version="3.5" profile="@PROFILE_VERSION@">
2-
<description>TODO description</description>
1+
<tool id="webatlas_consolidate_md" name="WebAtlas Consolidate Metadata" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" python_template_version="3.5" profile="@PROFILE_VERSION@">
2+
<description>Converts an image to Zarr and consolidates metadata</description>
33
<macros>
44
<import>macros.xml</import>
55
</macros>
@@ -22,10 +22,10 @@
2222
mv output.zarr.zip $output_zarr
2323
]]></command>
2424
<inputs>
25-
<param name="input_image" type="data" format="tif,tiff,jpg" label="tiff or jpg image"/>
25+
<param name="input_image" type="data" format="tif,tiff,jpg" label="TIFF or JPEG image" help="Input image to convert to Zarr. JPEG-compressed TIFF images are automatically decompressed before conversion."/>
2626
</inputs>
2727
<outputs>
28-
<data name="output_zarr" format="zarr.zip" label="${tool.name} on ${on_string}: zarr output"/>
28+
<data name="output_zarr" format="zarr.zip" label="${tool.name} on ${on_string}: ZIP-compressed Zarr output"/>
2929
</outputs>
3030
<tests>
3131
<test expect_num_outputs="1">

tools/webatlas/generate_image.xml

Lines changed: 187 additions & 145 deletions
Large diffs are not rendered by default.

tools/webatlas/macros.xml

Lines changed: 115 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -34,57 +34,108 @@
3434
]]>
3535
</token>
3636
<xml name="stem">
37-
<param name="stem" type="text" optional="false" label="Prefix for the output file(s)"/>
37+
<param name="stem" type="text" optional="false" label="Prefix for the output file(s)" help="Prefix used for the output file names. E.g. 'visium-breast-cancer'. Use the same prefix across WebAtlas tools for the same project and dataset, to ensure compatibility.">
38+
<sanitizer invalid_char="">
39+
<valid initial="string.ascii_letters,string.digits">
40+
<add value="_"/>
41+
<add value="-"/>
42+
</valid>
43+
</sanitizer>
44+
</param>
3845
</xml>
3946
<xml name="save_h5ad">
40-
<param argument="--save_h5ad" type="boolean" checked="false" label="Save h5ad file" help="If the AnnData object should also be written to an h5ad file."/>
47+
<param argument="--save_h5ad" type="boolean" checked="false" label="Save H5AD file" help="Save the processed AnnData object as an H5AD file in addition to the Zarr output."/>
4148
</xml>
4249
<xml name="h5ad_to_zarr_parameters">
4350
<param argument="--chunk_size" type="integer" min="1" value="10" label="Output Zarr column chunk size." help="Default value: 10"/>
44-
<param argument="--compute_embeddings" type="boolean" checked="false" optional="true" label="Compute embeddings" help="If `X_umap` and `X_pca` embeddings will be computed."/>
45-
<param argument="--var_index" type="text" optional="true" label="Alternative var index" help="Alternative `var` column name with `var` names to be used in the visualization."/>
46-
<conditional name="obs_subset_conditional">
47-
<param name="obs_subset" type="select" label="Subset obs" help="Subset the AnnData object on a specific 'obs' column with one or more values.">
48-
<option value="false">No</option>
49-
<option value="true">Yes</option>
50-
</param>
51-
<when value="true">
52-
<param name="obs_subset_column" type="text" optional="false" label="obs column name" help="obs column to apply the subset on."/>
53-
<param name="obs_subset_values" type="text" optional="false" label="Allowed values" help="Comma-separated list of allowed values."/>
54-
</when>
55-
<when value="false">
56-
</when>
57-
</conditional>
58-
<conditional name="var_subset_conditional">
59-
<param name="var_subset" type="select" label="Subset var" help="Subset the AnnData object on a specific 'var' column with one or more values.">
60-
<option value="false">No</option>
61-
<option value="true">Yes</option>
62-
</param>
63-
<when value="true">
64-
<param name="var_subset_column" type="text" optional="false" label="var column name" help="var column to apply the subset on."/>
65-
<param name="var_subset_values" type="text" optional="false" label="Allowed values" help="Comma-separated list of allowed values."/>
66-
</when>
67-
<when value="false">
68-
</when>
69-
</conditional>
70-
<conditional name="batch_processing_conditional">
71-
<param name="batch_processing" type="select" label="Enable batch processing" help="If the expression matrix will be written to Zarr incrementally. Use to avoid loading the whole AnnData into memory.">
72-
<option value="false">No</option>
73-
<option value="true">Yes</option>
51+
<param argument="--compute_embeddings" type="boolean" checked="false" optional="true" label="Compute embeddings" help="Compute 'X_umap' and 'X_pca' embeddings if they are not already present in the input data."/>
52+
<section name="sec_advanced_options" title="Advanced options" expanded="false">
53+
<param argument="--var_index" type="text" optional="true" label="Alternative var index" help="Alternative 'var' column name with 'var' names to be used in the visualization.">
54+
<sanitizer invalid_char="">
55+
<valid initial="string.ascii_letters,string.digits">
56+
<add value="_"/>
57+
<add value="-"/>
58+
<add value="."/>
59+
</valid>
60+
</sanitizer>
7461
</param>
75-
<when value="true">
76-
<param argument="--batch_size" type="integer" min="1" value="10000" label="Batch size" help="The amount of rows (if matrix is in CSR format) or columns (if matrix is dense or in CSC format) of the expression matrix to process at a time when batch processing. Default value: 10000"/>
77-
</when>
78-
<when value="false">
79-
</when>
80-
</conditional>
81-
<param argument="--consolidate_metadata" type="boolean" checked="true" optional="true" label="Consolidate metadata" help="Whether to consolidate output zarr metadata. Defaults to 'True'"/>
62+
<conditional name="obs_subset_conditional">
63+
<param name="obs_subset" type="select" label="Subset AnnData on an obs column" help="Subset the AnnData object on a specific observation (obs) column with one or more values.">
64+
<option value="false">No</option>
65+
<option value="true">Yes</option>
66+
</param>
67+
<when value="true">
68+
<param name="obs_subset_column" type="text" optional="false" label="Observation column name" help="Observation column to apply the subset on.">
69+
<sanitizer invalid_char="">
70+
<valid initial="string.ascii_letters,string.digits">
71+
<add value="_"/>
72+
<add value="-"/>
73+
<add value="."/>
74+
</valid>
75+
</sanitizer>
76+
</param>
77+
<param name="obs_subset_values" type="text" optional="false" label="Values to keep" help="Comma-separated list of values to keep.">
78+
<sanitizer invalid_char="">
79+
<valid initial="string.ascii_letters,string.digits">
80+
<add value="_"/>
81+
<add value="-"/>
82+
<add value="."/>
83+
<add value=","/>
84+
</valid>
85+
</sanitizer>
86+
</param>
87+
</when>
88+
<when value="false">
89+
</when>
90+
</conditional>
91+
<conditional name="var_subset_conditional">
92+
<param name="var_subset" type="select" label="Subset AnnData on a var column" help="Subset the AnnData object on a specific variable (var) column with one or more values.">
93+
<option value="false">No</option>
94+
<option value="true">Yes</option>
95+
</param>
96+
<when value="true">
97+
<param name="var_subset_column" type="text" optional="false" label="Variable column name" help="Variable column to apply the subset on. E.g. 'gene_ids'.">
98+
<sanitizer invalid_char="">
99+
<valid initial="string.ascii_letters,string.digits">
100+
<add value="_"/>
101+
<add value="-"/>
102+
<add value="."/>
103+
</valid>
104+
</sanitizer>
105+
</param>
106+
<param name="var_subset_values" type="text" optional="false" label="Values to keep" help="Comma-separated list of values to keep. E.g. 'A1CF,MSN'.">
107+
<sanitizer invalid_char="">
108+
<valid initial="string.ascii_letters,string.digits">
109+
<add value="_"/>
110+
<add value="-"/>
111+
<add value="."/>
112+
<add value=","/>
113+
</valid>
114+
</sanitizer>
115+
</param>
116+
</when>
117+
<when value="false">
118+
</when>
119+
</conditional>
120+
<conditional name="batch_processing_conditional">
121+
<param name="batch_processing" type="select" label="Enable batch processing" help="Write the expression matrix to Zarr incrementally instead of loading the full matrix into memory. Useful for large datasets.">
122+
<option value="false">No</option>
123+
<option value="true">Yes</option>
124+
</param>
125+
<when value="true">
126+
<param argument="--batch_size" type="integer" min="1" value="10000" label="Batch size" help="The amount of rows (if matrix is in CSR format) or columns (if matrix is dense or in CSC format) of the expression matrix to process at a time when batch processing. Default value: 10000."/>
127+
</when>
128+
<when value="false">
129+
</when>
130+
</conditional>
131+
<param argument="--consolidate_metadata" type="boolean" checked="true" optional="true" label="Consolidate metadata" help="Whether to consolidate output zarr metadata. Keep this enabled unless you need unconsolidated metadata for a specific use."/>
132+
</section>
82133
</xml>
83134

84135
<!-- generate_image -->
85136
<token name="@VISIUM_LABEL_COMMAND@"><![CDATA[
86-
#if $ref_img:
87-
--ref_img $ref_img
137+
#if $ref_img_visium:
138+
--ref_img $ref_img_visium
88139
#end if
89140
--args "{
90141
#if $obs_subset_conditional.obs_subset == 'true':
@@ -100,40 +151,49 @@
100151
&&
101152
]]>
102153
</token>
103-
<token name="@REF_IMG_COMMAND@"><![CDATA[
104-
#if $ref_img:
105-
--ref_img $ref_img
106-
#end if
107-
]]>
108-
</token>
109154
<token name="@Z_INDEX_COMMAND@"><![CDATA[
110155
--args "{
111-
#if $z_index:
112-
'z_index': [${z_index.replace(' ', '').split(',')}]
113-
#end if
156+
'z_index': $z_index
114157
}"
115158
&&
116159
]]>
117160
</token>
118161
<xml name="ref_img">
119-
<param name="ref_img" type="data" format="tiff" optional="true" label="Reference image" help="Reference image from which to get the shape for the label image"/>
162+
<param argument="--ref_img" type="data" format="tiff" optional="false" label="Reference image" help="Reference image used to determine the dimensions of the output image."/>
120163
</xml>
121164
<xml name="obs_subset">
122165
<conditional name="obs_subset_conditional">
123-
<param name="obs_subset" type="select" label="Subset obs" help="Subset the AnnData object on a specific 'obs' column with one or more values.">
166+
<param name="obs_subset" type="select" label="Subset AnnData on an obs column" help="Subset the AnnData object on a specific observation (obs) column with one or more values.">
124167
<option value="false">No</option>
125168
<option value="true">Yes</option>
126169
</param>
127170
<when value="true">
128-
<param name="obs_subset_column" type="text" optional="false" label="obs column name" help="obs column to apply the subset on."/>
129-
<param name="obs_subset_values" type="text" optional="false" label="Allowed values" help="Comma-separated list of allowed values."/>
171+
<param name="obs_subset_column" type="text" optional="false" label="Observation column name" help="Observation column to apply the subset on.">
172+
<sanitizer invalid_char="">
173+
<valid initial="string.ascii_letters,string.digits">
174+
<add value="_"/>
175+
<add value="-"/>
176+
<add value="."/>
177+
</valid>
178+
</sanitizer>
179+
</param>
180+
<param name="obs_subset_values" type="text" optional="false" label="Values to keep" help="Comma-separated list of values to keep.">
181+
<sanitizer invalid_char="">
182+
<valid initial="string.ascii_letters,string.digits">
183+
<add value="_"/>
184+
<add value="-"/>
185+
<add value="."/>
186+
<add value=","/>
187+
</valid>
188+
</sanitizer>
189+
</param>
130190
</when>
131191
<when value="false">
132192
</when>
133193
</conditional>
134194
</xml>
135195
<xml name="z_index">
136-
<param name="z_index" type="text" optional="true" label="Z indices" help="Comma-separated list of Z indices to process. Default value: [0]."/>
196+
<param name="z_index" type="integer" optional="true" value="0" label="Z index" help="Z index to process. Run the tool again to generate additional Z planes. Default value: 0."/>
137197
</xml>
138198
<xml name="citations">
139199
<citations>

tools/webatlas/ome_zarr_metadata.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<tool id="webatlas_ome_zarr_metadata" name="Webatlas OME Zarr Metadata" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE_VERSION@">
2-
<description>TODO description</description>
1+
<tool id="webatlas_ome_zarr_metadata" name="WebAtlas OME Zarr Metadata" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE_VERSION@">
2+
<description>Extract basic OME-Zarr metadata as JSON</description>
33
<macros>
44
<import>macros.xml</import>
55
</macros>
@@ -8,7 +8,7 @@
88
/usr/local/bin/ome_zarr_metadata.py --xml_path '$input_zarr.extra_files_path/$input_zarr.metadata.store_root/OME/METADATA.ome.xml' > output.json
99
]]></command>
1010
<inputs>
11-
<param name="input_zarr" type="data" format="zarr" label="zarr directory"/>
11+
<param name="input_zarr" type="data" format="zarr" label="Zarr directory"/>
1212
</inputs>
1313
<outputs>
1414
<data name="output_json" format="json" label="${tool.name} on ${on_string}" from_work_dir="output.json"/>

0 commit comments

Comments
 (0)