comparison larch_select_paths.xml @ 0:2e827836f0ad draft

planemo upload for repository https://github.com/MaterialsGalaxy/larch-tools/tree/main/larch_select_paths commit 5be486890442dedfb327289d597e1c8110240735
author muon-spectroscopy-computational-project
date Tue, 14 Nov 2023 15:35:52 +0000
parents
children 7fdca938d90c
comparison
equal deleted inserted replaced
-1:000000000000 0:2e827836f0ad
1 <tool id="larch_select_paths" name="Larch Select Paths" version="@TOOL_VERSION@+galaxy@WRAPPER_VERSION@" python_template_version="3.5" profile="22.05" license="MIT">
2 <description>select FEFF paths for XAFS data</description>
3 <macros>
4 <!-- version of underlying tool (PEP 440) -->
5 <token name="@TOOL_VERSION@">0.9.71</token>
6 <!-- version of this tool wrapper (integer) -->
7 <token name="@WRAPPER_VERSION@">0</token>
8 <!-- citation should be updated with every underlying tool version -->
9 <!-- typical fields to update are version, month, year, and doi -->
10 <token name="@TOOL_CITATION@">10.1088/1742-6596/430/1/012007</token>
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."/>
13 </xml>
14 <xml name="expr">
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>
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."/>
19 </xml>
20 </macros>
21 <creator>
22 <person givenName="Patrick" familyName="Austin" url="https://github.com/patrick-austin" identifier="https://orcid.org/0000-0002-6279-7823"/>
23 </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>
29 <include type="literal" path="larch_select_paths.py"/>
30 </required_files>
31 <command detect_errors="exit_code"><![CDATA[
32 python '${__tool_directory__}/larch_select_paths.py' '$inputs'
33 ]]></command>
34 <configfiles>
35 <inputs name="inputs" data_style="paths"/>
36 </configfiles>
37 <inputs>
38 <section name="variables" expanded="false" title="GDS variable defaults" help="Define default values for variables in the EXAFS equation to use for the paths selected below.">
39 <section name="s02" expanded="false" title="S02: passive electron reduction factor">
40 <param name="is_common" type="boolean" checked="true" label="Common to all paths" help="If set, a single variable 's02' will be used for all paths. Otherwise, each path has a distinct variable."/>
41 <param name="value" type="float" value="1.0" min="0.0" max="1.0" label="Value" help="The initial value for 's02'. This is typically between 0.7 and 1.0."/>
42 <expand macro="vary"/>
43 </section>
44 <section name="e0" expanded="false" title="E0: energy shift">
45 <param name="is_common" type="boolean" checked="true" label="Common to all paths" help="If set, a single variable 'e0' will be used for all paths. Otherwise, each path has a distinct variable."/>
46 <param name="value" type="float" value="0.0" label="Value" help="The initial value for 'e0'. This should be close to zero, as it represents the difference in the absorption edge positions between simulation and experiment."/>
47 <expand macro="vary"/>
48 </section>
49 <section name="deltar" expanded="false" title="Delta R: change in path length">
50 <param name="is_common" type="boolean" checked="true" label="Common to all paths" help="If set, a single variable 'alpha*reff' will be used for all paths (where 'reff' is the effective path length). Otherwise, each path has a distinct variable."/>
51 <param name="value" type="float" value="0.0" label="Value" help="The initial value for 'alpha'. This should be close to zero, as it represents the difference in the FEFF path and fitted (experimental) path length."/>
52 <expand macro="vary"/>
53 </section>
54 <section name="sigma2" expanded="false" title="Sigma2: mean squared displacement">
55 <param name="is_common" type="boolean" checked="true" label="Common to all paths" help="If set, a single variable 'sigma2' will be used for all paths. Otherwise, each path has a distinct variable."/>
56 <param name="value" type="float" value="0.003" label="Value" help="The initial value for 'sigma2'. This should be small, but non-zero, as atomic vibrations will result in variation in exact positions."/>
57 <expand macro="vary"/>
58 </section>
59 </section>
60 <repeat name="feff_outputs" title="Distinct FEFF outputs" min="1" help="If FEFF has been used on multiple structures, the paths from each can be merged into one input to provide to Larch Artemis. If only one entry is provided, then the zipped directory of paths will be unchanged.">
61 <param name="label" type="text" optional="true" label="Label" help="Short label to use when merging different FEFF outputs to ensure they remain distinct. Not required if only providing a single output, and will default to the index in this list."/>
62 <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."/>
64 <conditional name="selection">
65 <param name="selection" type="select" label="Selection method">
66 <option value="all" selected="true">All paths</option>
67 <!-- <option value="number">Fixed number</option>
68 <option value="combinations">Combinations</option> -->
69 <option value="manual">Manual</option>
70 </param>
71 <when value="all">
72 <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."/>
74 <section name="s02" expanded="false" title="S02: passive electron reduction factor">
75 <expand macro="name"/>
76 <param name="value" type="float" value="1.0" min="0.0" max="1.0" label="Value" help="The initial value for 's02'. This is typically between 0.7 and 1.0."/>
77 <expand macro="expr"/>
78 <expand macro="vary"/>
79 </section>
80 <section name="e0" expanded="false" title="E0: energy shift">
81 <expand macro="name"/>
82 <param name="value" type="float" value="0.0" label="Value" help="The initial value for 'e0'. This should be close to zero, as it represents the difference in the absorption edge positions between simulation and experiment."/>
83 <expand macro="expr"/>
84 <expand macro="vary"/>
85 </section>
86 <section name="deltar" expanded="false" title="Delta R: change in path length">
87 <expand macro="name"/>
88 <param name="value" type="float" value="0.0" label="Value" help="The initial value for 'alpha'. This should be close to zero, as it represents the difference in the FEFF path and fitted (experimental) path length."/>
89 <expand macro="expr"/>
90 <expand macro="vary"/>
91 </section>
92 <section name="sigma2" expanded="false" title="Sigma2: mean squared displacement">
93 <expand macro="name"/>
94 <param name="value" type="float" value="0.003" label="Value" help="The initial value for 'sigma2'. This should be small, but non-zero, as atomic vibrations will result in variation in exact positions."/>
95 <expand macro="expr"/>
96 <expand macro="vary"/>
97 </section>
98 </repeat>
99 </when>
100 <!-- <when value="number">
101 </when>
102 <when value="combinations">
103 </when> -->
104 <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.">
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."/>
107 <section name="s02" expanded="false" title="S02: passive electron reduction factor">
108 <expand macro="name"/>
109 <param name="value" type="float" value="1.0" min="0.0" max="1.0" label="Value" help="The initial value for 's02'. This is typically between 0.7 and 1.0."/>
110 <expand macro="expr"/>
111 <expand macro="vary"/>
112 </section>
113 <section name="e0" expanded="false" title="E0: energy shift">
114 <expand macro="name"/>
115 <param name="value" type="float" value="0.0" label="Value" help="The initial value for 'e0'. This should be close to zero, as it represents the difference in the absorption edge positions between simulation and experiment."/>
116 <expand macro="expr"/>
117 <expand macro="vary"/>
118 </section>
119 <section name="deltar" expanded="false" title="Delta R: change in path length">
120 <expand macro="name"/>
121 <param name="value" type="float" value="0.0" label="Value" help="The initial value for 'alpha'. This should be close to zero, as it represents the difference in the FEFF path and fitted (experimental) path length."/>
122 <expand macro="expr"/>
123 <expand macro="vary"/>
124 </section>
125 <section name="sigma2" expanded="false" title="Sigma2: mean squared displacement">
126 <expand macro="name"/>
127 <param name="value" type="float" value="0.003" label="Value" help="The initial value for 'sigma2'. This should be small, but non-zero, as atomic vibrations will result in variation in exact positions."/>
128 <expand macro="expr"/>
129 <expand macro="vary"/>
130 </section>
131 </repeat>
132 </when>
133 </conditional>
134 </repeat>
135 </inputs>
136 <outputs>
137 <data name="merged_directories" format="zip" from_work_dir="merged.zip" label="Merged directories from ${on_string}">
138 <filter>len(feff_outputs) > 1</filter>
139 </data>
140 <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}"/>
142 </outputs>
143 <tests>
144 <!-- Test defaults for CSV with select_all -->
145 <test expect_num_outputs="2">
146 <param name="paths_zip" value="FEFF_paths.zip"/>
147 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
148 <output name="gds_csv" file="gds_default.csv"/>
149 <output name="sp_csv" file="sp_default.csv"/>
150 </test>
151 <!-- Test defaults for CSV with some selected rows -->
152 <test expect_num_outputs="2">
153 <param name="paths_zip" value="FEFF_paths.zip"/>
154 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
155 <param name="selection" value="manual"/>
156 <output name="gds_csv" file="gds_default.csv"/>
157 <output name="sp_csv" file="sp_select_all_false.csv"/>
158 </test>
159 <!-- Test selected paths without custom GDS -->
160 <test expect_num_outputs="2">
161 <param name="paths_zip" value="FEFF_paths.zip"/>
162 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
163 <param name="selection" value="manual"/>
164 <param name="id" value="3"/>
165 <output name="gds_csv" file="gds_default.csv"/>
166 <output name="sp_csv" file="sp_include_path_3.csv"/>
167 </test>
168 <!-- Test selected paths with custom name but no GDS entry -->
169 <test expect_num_outputs="2">
170 <param name="paths_zip" value="FEFF_paths.zip"/>
171 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
172 <param name="selection" value="manual"/>
173 <param name="id" value="3"/>
174 <section name="sigma2">
175 <param name="name" value="custom_name"/>
176 </section>
177 <output name="gds_csv" file="gds_include_path_3_custom_name.csv"/>
178 <output name="sp_csv" file="sp_include_path_3_custom_name.csv"/>
179 </test>
180 <!-- Test selected paths with custom GDS -->
181 <test expect_num_outputs="2">
182 <param name="paths_zip" value="FEFF_paths.zip"/>
183 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
184 <param name="selection" value="manual"/>
185 <param name="id" value="3"/>
186 <repeat name="paths">
187 <section name="sigma2">
188 <param name="name" value="custom_name"/>
189 <param name="value" value="0.005"/>
190 <param name="expr" value=""/>
191 <param name="vary" value="false"/>
192 </section>
193 </repeat>
194 <output name="gds_csv" file="gds_include_path_3_custom_name_value.csv"/>
195 <output name="sp_csv" file="sp_include_path_3_custom_name.csv"/>
196 </test>
197 <!-- Test changing default GDS values -->
198 <test expect_num_outputs="2">
199 <section name="variables">
200 <section name="s02">
201 <param name="value" value="0.1"/>
202 <param name="vary" value="false"/>
203 </section>
204 <section name="e0">
205 <param name="value" value="0.1"/>
206 <param name="vary" value="true"/>
207 </section>
208 <section name="deltar">
209 <param name="value" value="10"/>
210 <param name="vary" value="false"/>
211 </section>
212 </section>
213 <param name="paths_zip" value="FEFF_paths.zip"/>
214 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
215 <param name="selection" value="manual"/>
216 <output name="gds_csv" file="gds_altered_defaults.csv"/>
217 <output name="sp_csv" file="sp_select_all_false.csv"/>
218 </test>
219 <!-- Test merging defaults -->
220 <test expect_num_outputs="3">
221 <repeat name="feff_outputs">
222 <param name="paths_zip" value="FEFF_paths.zip"/>
223 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
224 </repeat>
225 <repeat name="feff_outputs">
226 <param name="paths_zip" value="FEFF_paths.zip"/>
227 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
228 </repeat>
229 <output name="merged_directories">
230 <assert_contents>
231 <has_size value="206000" delta="100"/>
232 </assert_contents>
233 </output>
234 <output name="gds_csv" file="gds_default.csv"/>
235 <output name="sp_csv" file="sp_merge_default.csv"/>
236 </test>
237 <!-- Test merging custom arguments -->
238 <test expect_num_outputs="3">
239 <repeat name="feff_outputs">
240 <param name="label" value="primary"/>
241 <param name="paths_zip" value="FEFF_paths.zip"/>
242 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
243 <conditional name="selection">
244 <param name="selection" value="manual"/>
245 <repeat name="paths">
246 <param name="id" value="3"/>
247 <section name="sigma2">
248 <param name="name" value="custom_name_1"/>
249 </section>
250 </repeat>
251 </conditional>
252 </repeat>
253 <repeat name="feff_outputs">
254 <param name="label" value="secondary"/>
255 <param name="paths_zip" value="FEFF_paths.zip"/>
256 <param name="paths_file" value="[CSV_summary_of_1564889.cif].csv"/>
257 <conditional name="selection">
258 <param name="selection" value="manual"/>
259 <repeat name="paths">
260 <param name="id" value="3"/>
261 <section name="sigma2">
262 <param name="name" value="custom_name_2"/>
263 </section>
264 </repeat>
265 </conditional>
266 </repeat>
267 <output name="merged_directories">
268 <assert_contents>
269 <has_size value="206500" delta="100"/>
270 </assert_contents>
271 </output>
272 <output name="gds_csv" file="gds_merge_custom.csv"/>
273 <output name="sp_csv" file="sp_merge_custom.csv"/>
274 </test>
275 </tests>
276 <help><![CDATA[
277 Select FEFF scattering paths to use in the fitting process.
278
279 If paths from multiple different FEFF outputs are of interest (for example, corresponding to different structural files), then additional FEFF outputs can be added.
280 Each requires its own zip directory and path summary CSV, and any custom GDS parameters will be uniquely labelled with the label provided or a numerical default.
281 In this case the zipped directories will also be merged into one output containing all paths and associated files.
282
283 If only one set of FEFF outputs is provided, labelling is not required and the existing zip file can be used as the input to Larch Artemis.
284
285 If the selection method "All paths" is chosen, or an individual row in the CSV with ``select`` is set to ``1``, it will be automatically used, with the default values defined.
286 This can be useful when many paths are needed and using the UI can be cumbersome.
287
288 It is also possible to manually check and further modify the GDS and SP output CSVs to ensure the values are suitable, as an alternative to re-running this tool.
289 ]]></help>
290 <citations>
291 <citation type="doi">@TOOL_CITATION@</citation>
292 <citation type="doi">10.1107/S0909049505012719</citation>
293 </citations>
294 </tool>