comparison larch_select_paths.xml @ 1:7fdca938d90c draft

planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_select_paths commit 1cf6d7160497ba58fe16a51f00d088a20934eba6
author muon-spectroscopy-computational-project
date Wed, 06 Dec 2023 13:04:15 +0000
parents 2e827836f0ad
children 200534149c4d
comparison
equal deleted inserted replaced
0:2e827836f0ad 1:7fdca938d90c
2 <description>select FEFF paths for XAFS data</description> 2 <description>select FEFF paths for XAFS data</description>
3 <macros> 3 <macros>
4 <!-- version of underlying tool (PEP 440) --> 4 <!-- version of underlying tool (PEP 440) -->
5 <token name="@TOOL_VERSION@">0.9.71</token> 5 <token name="@TOOL_VERSION@">0.9.71</token>
6 <!-- version of this tool wrapper (integer) --> 6 <!-- version of this tool wrapper (integer) -->
7 <token name="@WRAPPER_VERSION@">0</token> 7 <token name="@WRAPPER_VERSION@">1</token>
8 <!-- citation should be updated with every underlying tool version --> 8 <!-- citation should be updated with every underlying tool version -->
9 <!-- typical fields to update are version, month, year, and doi --> 9 <!-- typical fields to update are version, month, year, and doi -->
10 <token name="@TOOL_CITATION@">10.1088/1742-6596/430/1/012007</token> 10 <token name="@TOOL_CITATION@">10.1088/1742-6596/430/1/012007</token>
11 <xml name="name"> 11 <xml name="name">
12 <param name="name" type="text" optional="true" label="Name" help="The name of the variable should be unique, and can be used in expressions for other paths. If name is set, will overwrite the default bevaviour for this variable."/> 12 <param name="name" type="text" optional="true" label="Name" help="The name of the variable should be unique, and can be used in expressions for other paths. If name is set, will overwrite the default bevaviour for this variable."/>
15 <param name="expr" type="text" optional="true" label="Expression" help="If set, the variable will be 'Defined' by the expression. This can include other variable name, for example in order to set two paths to use the same variable."/> 15 <param name="expr" type="text" optional="true" label="Expression" help="If set, the variable will be 'Defined' by the expression. This can include other variable name, for example in order to set two paths to use the same variable."/>
16 </xml> 16 </xml>
17 <xml name="vary"> 17 <xml name="vary">
18 <param name="vary" type="boolean" checked="true" label="Vary" help="If True, the initial 'Guess' will be optimised in the fitting. If False, the value will be 'Set' instead and not optimised."/> 18 <param name="vary" type="boolean" checked="true" label="Vary" help="If True, the initial 'Guess' will be optimised in the fitting. If False, the value will be 'Set' instead and not optimised."/>
19 </xml> 19 </xml>
20 <xml name="max_number">
21 <param name="max_number" type="integer" min="1" optional="true" label="Maximum number of paths" help="Will select (up to) this many paths, ordered by ascending path length, subject to criteria below. If unset, will select all that meet the criteria."/>
22 </xml>
23 <xml name="max_path_length">
24 <param name="max_path_length" type="float" min="0" optional="true" label="Maximum path length" help="Exclude paths with lengths greater than this (expressed in Angstrom). If unset, will not restrict based on path length."/>
25 </xml>
26 <xml name="min_amplitude_ratio">
27 <param name="min_amplitude_ratio" type="float" min="0" max="100" optional="true" label="Minimum amplitude ratio (%)" help="Exclude paths with a ratio below this ratio (expressed as a percentage). If unset, will not restrict based on amplitude ratio."/>
28 </xml>
29 <xml name="max_degeneracy">
30 <param name="max_degeneracy" type="integer" min="1" optional="true" label="Maximum degeneracy" help="Exclude paths with degeneracy above this value. If unset, will not restrict based on degeneracy."/>
31 </xml>
20 </macros> 32 </macros>
21 <creator> 33 <creator>
22 <person givenName="Patrick" familyName="Austin" url="https://github.com/patrick-austin" identifier="https://orcid.org/0000-0002-6279-7823"/> 34 <person givenName="Patrick" familyName="Austin" url="https://github.com/patrick-austin" identifier="https://orcid.org/0000-0002-6279-7823"/>
23 </creator> 35 </creator>
24 <requirements>
25 <requirement type="package" version="@TOOL_VERSION@">xraylarch</requirement>
26 <requirement type="package" version="3.5.2">matplotlib</requirement>
27 </requirements>
28 <required_files> 36 <required_files>
29 <include type="literal" path="larch_select_paths.py"/> 37 <include type="literal" path="larch_select_paths.py"/>
30 </required_files> 38 </required_files>
31 <command detect_errors="exit_code"><![CDATA[ 39 <command detect_errors="exit_code"><![CDATA[
40 mkdir sp &&
32 python '${__tool_directory__}/larch_select_paths.py' '$inputs' 41 python '${__tool_directory__}/larch_select_paths.py' '$inputs'
33 ]]></command> 42 ]]></command>
34 <configfiles> 43 <configfiles>
35 <inputs name="inputs" data_style="paths"/> 44 <inputs name="inputs" data_style="paths"/>
36 </configfiles> 45 </configfiles>
62 <param name="paths_zip" type="data" format="zip" label="Zipped paths directory" help="Zipped directory containing the actual path files output by FEFF."/> 71 <param name="paths_zip" type="data" format="zip" label="Zipped paths directory" help="Zipped directory containing the actual path files output by FEFF."/>
63 <param name="paths_file" type="data" format="feff" label="Paths file" help="CSV file detailing the possible scattering paths. Note that rows with '1' in the 'select' column will be selected with default values for their parameters automatically."/> 72 <param name="paths_file" type="data" format="feff" label="Paths file" help="CSV file detailing the possible scattering paths. Note that rows with '1' in the 'select' column will be selected with default values for their parameters automatically."/>
64 <conditional name="selection"> 73 <conditional name="selection">
65 <param name="selection" type="select" label="Selection method"> 74 <param name="selection" type="select" label="Selection method">
66 <option value="all" selected="true">All paths</option> 75 <option value="all" selected="true">All paths</option>
67 <!-- <option value="number">Fixed number</option> 76 <option value="criteria">Criteria</option>
68 <option value="combinations">Combinations</option> --> 77 <option value="combinations">Combinations</option>
69 <option value="manual">Manual</option> 78 <option value="manual">Manual</option>
70 </param> 79 </param>
71 <when value="all"> 80 <when value="all">
72 <repeat name="paths" title="Define path variables" help="Overwrite the default variables defined above for chosen paths."> 81 <repeat name="paths" title="Define path variables" help="Overwrite the default variables defined above for chosen paths.">
73 <param name="id" type="integer" value="1" min="1" label="Path ID" help="Numerical id of a path to select, this appears at the end of the label and filename in the path summary CSV."/> 82 <param name="id" type="integer" value="1" min="1" label="Path ID" help="Numerical id of a path to select, this appears at the end of the label and filename in the path summary CSV."/>
95 <expand macro="expr"/> 104 <expand macro="expr"/>
96 <expand macro="vary"/> 105 <expand macro="vary"/>
97 </section> 106 </section>
98 </repeat> 107 </repeat>
99 </when> 108 </when>
100 <!-- <when value="number"> 109 <when value="criteria">
110 <expand macro="max_number"/>
111 <expand macro="max_path_length"/>
112 <expand macro="min_amplitude_ratio"/>
113 <expand macro="max_degeneracy"/>
101 </when> 114 </when>
102 <when value="combinations"> 115 <when value="combinations">
103 </when> --> 116 <param name="min_combination_size" type="integer" value="1" min="1" label="Minimum combination size" help="Each combination will have at least this many paths. If less then this many paths match the below criteria, a single combination with all paths will be generated."/>
117 <param name="max_combination_size" type="integer" optional="true" label="Maximum combination size" help="Each combination will have at most this many paths. Note this is distinct from the number of paths to consider, below. One might want to consider combinations of the 5 shortest paths (set using 'Maximum number of paths'), but have no more than 3 paths in each combination (set using this)."/>
118 <expand macro="max_number"/>
119 <expand macro="max_path_length"/>
120 <expand macro="min_amplitude_ratio"/>
121 <expand macro="max_degeneracy"/>
122 </when>
104 <when value="manual"> 123 <when value="manual">
105 <repeat name="paths" title="Select paths" help="Identify paths to use in the fitting by their id, and optionally define their variables. This will overwrite and defaults set above."> 124 <repeat name="paths" title="Select paths" help="Identify paths to use in the fitting by their id, and optionally define their variables. This will overwrite and defaults set above.">
106 <param name="id" type="integer" value="1" min="1" label="Path ID" help="Numerical id of a path to select, this appears at the end of the label and filename in the path summary CSV."/> 125 <param name="id" type="integer" value="1" min="1" label="Path ID" help="Numerical id of a path to select, this appears at the end of the label and filename in the path summary CSV."/>
107 <section name="s02" expanded="false" title="S02: passive electron reduction factor"> 126 <section name="s02" expanded="false" title="S02: passive electron reduction factor">
108 <expand macro="name"/> 127 <expand macro="name"/>
136 <outputs> 155 <outputs>
137 <data name="merged_directories" format="zip" from_work_dir="merged.zip" label="Merged directories from ${on_string}"> 156 <data name="merged_directories" format="zip" from_work_dir="merged.zip" label="Merged directories from ${on_string}">
138 <filter>len(feff_outputs) > 1</filter> 157 <filter>len(feff_outputs) > 1</filter>
139 </data> 158 </data>
140 <data name="gds_csv" format="gds" from_work_dir="gds.csv" label="GDS values for ${on_string}"/> 159 <data name="gds_csv" format="gds" from_work_dir="gds.csv" label="GDS values for ${on_string}"/>
141 <data name="sp_csv" format="sp" from_work_dir="sp.csv" label="Selected paths for ${on_string}"/> 160 <data name="sp_csv" format="sp" from_work_dir="sp.csv" label="Selected paths for ${on_string}">
161 <filter>not any([f["selection"]["selection"] == "combinations" for f in feff_outputs])</filter>
162 </data>
163 <collection name="sp_collection" format="sp" type="list" label="Selected path combinations for ${on_string}">
164 <discover_datasets pattern="__name_and_ext__" directory="sp"/>
165 <filter>any([f["selection"]["selection"] == "combinations" for f in feff_outputs])</filter>
166 </collection>
142 </outputs> 167 </outputs>
143 <tests> 168 <tests>
144 <!-- Test defaults for CSV with select_all --> 169 <!-- Test defaults for CSV with select_all -->
145 <test expect_num_outputs="2"> 170 <test expect_num_outputs="2">
146 <param name="paths_zip" value="FEFF_paths.zip"/> 171 <param name="paths_zip" value="FEFF_paths.zip"/>
269 <has_size value="206500" delta="100"/> 294 <has_size value="206500" delta="100"/>
270 </assert_contents> 295 </assert_contents>
271 </output> 296 </output>
272 <output name="gds_csv" file="gds_merge_custom.csv"/> 297 <output name="gds_csv" file="gds_merge_custom.csv"/>
273 <output name="sp_csv" file="sp_merge_custom.csv"/> 298 <output name="sp_csv" file="sp_merge_custom.csv"/>
299 </test>
300 <!-- Test for criteria based selection -->
301 <test expect_num_outputs="2">
302 <repeat name="feff_outputs">
303 <param name="paths_zip" value="FEFF_paths.zip"/>
304 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
305 <conditional name="selection">
306 <param name="selection" value="criteria"/>
307 <param name="min_amplitude_ratio" value="20"/>
308 <param name="max_degeneracy" value="4"/>
309 </conditional>
310 </repeat>
311 <output name="gds_csv" file="gds_default.csv"/>
312 <output name="sp_csv" file="sp_criteria.csv"/>
313 </test>
314 <!-- Test for combinations based selection -->
315 <test expect_num_outputs="3">
316 <!-- Should result in 4 + 6 + 4 + 1 = 15 combinations -->
317 <repeat name="feff_outputs">
318 <param name="paths_zip" value="FEFF_paths.zip"/>
319 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
320 <conditional name="selection">
321 <param name="selection" value="combinations"/>
322 <param name="min_amplitude_ratio" value="20"/>
323 </conditional>
324 </repeat>
325 <!-- Should result in 3 combinations -->
326 <repeat name="feff_outputs">
327 <param name="paths_zip" value="FEFF_paths.zip"/>
328 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
329 <conditional name="selection">
330 <param name="selection" value="combinations"/>
331 <param name="min_combination_size" value="2"/>
332 <param name="max_combination_size" value="2"/>
333 <param name="max_number" value="3"/>
334 </conditional>
335 </repeat>
336 <output name="merged_directories">
337 <assert_contents>
338 <has_size value="206000" delta="1000"/>
339 </assert_contents>
340 </output>
341 <output name="gds_csv" file="gds_default.csv"/>
342 <!-- Should get 15 * 3 = 45 combinations in total -->
343 <output_collection name="sp_collection" type="list" count="45"/>
274 </test> 344 </test>
275 </tests> 345 </tests>
276 <help><![CDATA[ 346 <help><![CDATA[
277 Select FEFF scattering paths to use in the fitting process. 347 Select FEFF scattering paths to use in the fitting process.
278 348