comparison toolfactory/ToolFactory.xml @ 0:03df06784e56 draft

Uploaded
author fubar_too
date Tue, 18 May 2021 08:42:29 +0000
parents
children cc1a8fbb0f48
comparison
equal deleted inserted replaced
-1:000000000000 0:03df06784e56
1 <tool id="rgtf2" name="toolfactory" version="2.00" profile="16.04" >
2 <description>Scripts into tools v2.0</description>
3 <macros>
4 <xml name="singleText">
5 <param name="param_value" type="text" value="" label="Enter this parameter's default text value">
6 </param>
7 </xml>
8 <xml name="singleInt">
9 <param name="param_value" type="integer" value="" label="Enter this parameter's default integer value" >
10 </param>
11 </xml>
12 <xml name="singleFloat">
13 <param name="param_value" type="float" value="" label="Enter this parameter's default value">
14 </param>
15 </xml>
16 <xml name="singleBoolean">
17 <param name="param_value" type="boolean" value="" label="Enter this parameter's default value" />
18 <param name="truevalue" type="text" value="True" label="Command line value to emit when True" />
19 <param name="falsevalue" type="boolean" value="True" label="Command line value to emit when False" />
20 </xml>
21 <xml name="selectText">
22 <repeat name="selectTexts" title="Add each option to be presented in a text select box" min="2" default="2"
23 help="Each text added here will also have a value to be emitted on the command line when the text is chosen">
24 <param name="select_text" type="text" value="" label="Enter the explanatory text the user will see for this choice" >
25 </param>
26 <param name="select_value" type="text" value="" label="Enter the value for the command line when the user selects this option">
27 </param>
28 </repeat>
29 </xml>
30 <xml name="tool_metadata">
31 <param name="tool_version" label="Tool Version - bump this to warn users trying to redo old analyses" type="text" value="0.01"
32 help="If you change your script and regenerate the 'same' tool, you should inform Galaxy (and users) by changing (bumping is traditional) this number"/>
33 <param name="tool_desc" label="Tool Synopsis" type="text" value=""
34 help="Supply a brief tool description for the Galaxy tool menu entry" />
35 <param name="install" label="Attempt to install in the host Galaxy"
36 help="This may/should fail unless running in a lax security environment (your own laptop perhaps) or the specialised ToolFactory Docker container"
37 type="hidden" checked="True" truevalue="1" falsevalue="0" />
38 <param name="run_test" label="Finalise new archive with test outputs. Runs externally. Outputs will appear in history when ready"
39 help="Archives must be run and updated using planemo to populate all the test outputs. May take a long time depending on dependencies"
40 type="hidden" checked="False" truevalue="1" falsevalue="" />
41 <param name="help_text" label="Tool form documentation and help text for users" type="text" area="true"
42 value="**What it Does**"
43 help="Supply user documentation to appear on the new tool form as reStructured text - http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html" >
44 <sanitizer>
45 <valid initial="string.printable" />
46 <mapping initial="none"/>
47 </sanitizer>
48 </param>
49 <repeat name="citations" title="Citation">
50 <conditional name="citation_type">
51 <param name="type" type="select" display="radio" label="Citation Type">
52 <option value="doi">DOI</option>
53 <option value="bibtex">BibTeX</option>
54 </param>
55 <when value="doi">
56 <param name="doi" label="DOI" type="text" value=""
57 help="Supply a DOI (e.g. doi: 10.1111/j.1740-9713.2007.00258.x) to be cited when this tool is used in published research." />
58 </when>
59 <when value="bibtex">
60 <param name="bibtex" label="BibTex" type="text" area="true"
61 help="Supply a BibTex entry that should be cited when this tool is used in published research." value="" >
62 <sanitizer>
63 <valid initial="string.printable" />
64 <mapping initial="none"/>
65 </sanitizer>
66 </param>
67 </when>
68 </conditional>
69 </repeat>
70 </xml>
71 <xml name="io">
72 <section name="io" title="Input and output files" expanded="true">
73 <repeat name="history_inputs" title="Inputs" min="0"
74 help="Input data files to pass on the command line to the executable. USE SMALL SAMPLES for the new tool's test. Prompts will form a history item selector as input for users of this new tool">
75 <param name="input_files" type="data" format="data" label="Select an input file from your history" multiple="false"
76 help=""/>
77 <param name="input_formats" type="select" multiple="true" label="Select the datatype(s) that your tool/script accepts as input"
78 help="If your datatype is not listed here, it has to be added in galaxy's datatypes_conf.xml" value="tabular">
79 <options from_parameter="tool.app.datatypes_registry.upload_file_formats">
80 <column name="value" index="0"/>
81 </options>
82 </param>
83 <param name="input_label" type="text" value="" label="This will become the user prompt for the form so please make it informative" >
84 </param>
85 <param name="input_help" type="text" value="" label="This will become help text on the form." >
86 </param>
87 <param name="input_CL" type="text" label="Positional: ordinal integer. Argparse: argument name. STDIN if the executable/script expects it"
88 help="If you will pass positional parameters, enter the integer ordinal for this parameter. If Argparse style, '--' will be prepended or '-' if single character" value="">
89 </param>
90 <param name="input_repeat" type="boolean" checked="False" truevalue="1" falsevalue="0" label="Allow user to repeat this input as many times as wanted - script/executable must parse these."/>
91 </repeat>
92 <repeat name="history_outputs" min="0" title="Outputs"
93 help="New history items output by the executable to appear in the user history after the tool runs. The name will become a history item for users of the new tool you are making containing one of it's outputs">
94 <param name="history_name" type="text" label="Output Name" optional="false"
95 help="Name used for this output in history. No spaces! Argparse will also use this name as --[name]">
96 <sanitizer invalid_char=" ">
97 <valid initial="string.ascii_letters,string.digits" >
98 <add value="_" />
99 </valid>
100 </sanitizer>
101 </param>
102 <param name="history_format" type="select" multiple="false" label="Select the datatype for this output"
103 help="If your datatype is not listed here, it has to be added in galaxy's datatypes_conf.xml" value="tabular">
104 <options from_parameter="tool.app.datatypes_registry.upload_file_formats">
105 <column name="value" index="0"/>
106 </options>
107 </param>
108 <param name="history_CL" type="text" label="Position"
109 help="Positional: ordinal integer or 'STDOUT' if '>' required. Otherwise ignored if argparse because name is used. If positional parameters, enter the integer ordinal expected for this parameter. If argparse, ignore unless STDOUT needed" value=""/>
110 <param name="history_test" type="text" label="Output test criteria"
111 help="Pass/fail decision criterion for this output compared to test generation. Available options are diff:[lines], sim_size:[delta (integer) or delta_frac (float)" value="diff:0"/>
112 </repeat>
113 <repeat name="collection_outputs" title="Output Collections" min="0"
114 help="New history collections to appear in the user history after the tool runs. Hides outputs not needed for downstream tools such as images and intermediate reports." default="0">
115 <param name="name" type="text" label="Name"
116 help="for new collection with all outputs not individually passed to history outputs. No spaces! Script MUST create and fill a directory with the same name and the tool test MUST be overwritten - see the plotter example for hints">
117 <sanitizer invalid_char="_">
118 <valid initial="string.ascii_letters,string.digits" >
119 <add value="_" />
120 </valid>
121 </sanitizer>
122 </param>
123 <param name="kind" type="select" multiple="false" label="Select the kind of collection for this output"
124 help="">
125 <option value="list" selected="true">List</option>
126 <option value="paired">Paired</option>
127 <option value="list:paired">List of paired</option>
128 </param>
129 <param name="label" type="text" label="Label for this collection" help="" value=""/>
130 <param name="discover" type="text" label="Discover datasets expression" help="__name_and_ext__ should catch all filenames with extensions" value="__name_and_ext__"/>
131 </repeat>
132
133 </section>
134 </xml>
135 <xml name="additparam">
136 <section name="addparam" title="Arguments" help="Executable or script settings passed on the command line other than I/O files" expanded="true">
137 <param name="edit_params" type="select" display="radio" label="Make these settings on the generated tool form user editable?"
138 help="If no, users will NOT be able to alter any additional parameters. If yes, these will appear on the tool form as text fields with no validation or sanitizing">
139 <option value="yes" selected="true">Yes, allow user to edit all additional parameters on the generated tool form</option>
140 <option value="no">No - use the fixed values for all additional parameters - no user editing</option>
141 </param>
142 <repeat name="additional_parameters" title="Command Line Paramters" min="0"
143 help="Command line settings for the user to pass to the executable. See examples below to see how these can be parsed by scripts in the various languages">
144 <param name="param_name" type="text" value="" label="Choose the name for this parameter - MUST not be blank!">
145 <sanitizer invalid_char="">
146 <valid initial="string.ascii_letters,string.digits"/>
147 <mapping initial="none"/>
148 </sanitizer>
149 </param>
150 <conditional name="ap_type">
151 <param name="param_type" type="select" label="Select the type for this parameter">
152 <option value="text" selected="true">Text string</option>
153 <option value="integer">Integer</option>
154 <option value="float">Float</option>
155 <option value="boolean">Boolean</option>
156 <option value="selecttext">Select text string</option>
157 </param>
158 <when value = "text">
159 <expand macro="singleText" />
160 </when>
161 <when value = "integer">
162 <expand macro="singleInt" />
163 </when>
164 <when value = "float">
165 <expand macro="singleFloat" />
166 </when>
167 <when value = "boolean">
168 <expand macro="singleBoolean" />
169 </when>
170 <when value = "selecttext">
171 <expand macro="selectText" />
172 </when>
173 </conditional>
174 <param name="param_label" type="text" value="" label="Enter this parameter's label for the form">
175 </param>
176 <param name="param_help" type="text" value="" label="Help for this parameter">
177 </param>
178 <param name="param_CL" type="text" label="Positional ordinal | argparse argument name"
179 help="Using positional parameters, enter the integer ordinal for this parameter on the command line. Using Argparse style, '--' will be prepended on the CL" value="" />
180 <param name="param_CLprefixed" type="text" label="Override the generated default argparse name prefix if not empty - eg ----foo if needed"
181 help="Some targets like Planemo expect an unadorned action like 'test' before --galaxy_root." value="" />
182 <param name="param_repeat" type="boolean" checked="False" truevalue="1" falsevalue="0" label="Allow user to repeat this as many times as needed." />
183 </repeat>
184 </section>
185 </xml>
186 </macros>
187
188 <requirements>
189 <requirement type="package" version="0.4.14">galaxyxml</requirement>
190 <requirement type="package" version="0.15.0">bioblend</requirement>
191 <requirement type="package" version="3.2.3">rsync</requirement>
192 </requirements>
193
194 <command detect_errors="exit_code"><![CDATA[
195 #import os
196 #set dev_env = os.environ.get('GALAXY_DEVELOPMENT_ENVIRONMENT', '0') == '1'
197 #if not $dev_env and ( $__user_email__ not in $__admin_users__ ):
198 python3 $__tool_directory__/rgToolFactory2.py --bad_user $__user_email__
199 #else:
200 python3 $__tool_directory__/ToolFactory.py
201 #if len(str($cl_suffix)) > 0:
202 --cl_user_suffix "$cl_suffix"
203 #end if
204 #if $cover.commover == "yes":
205 #if len(str($cover.command_override)) > 10:
206 --command_override "$commandoverride"
207 #end if
208 #if len(str($cover.test_override)) > 10:
209 --test_override "$testoverride"
210 #end if
211 #end if
212 #if $deps.packages > "":
213 --packages "$deps.packages"
214 #end if
215 #if $deps.usescript.choosescript == "yes":
216 --script_path "$runme"
217 --sysexe "$deps.usescript.scriptrunner"
218 #end if
219 --tool_name "$tool_name" --user_email "$__user_email__" --citations "$citeme" --parampass "$io_param.ppass.parampass"
220 --tool_desc "$tool_desc"
221 --tool_version "$tool_version"
222 --help_text "$helpme"
223 #if $io_param.ppass.parampass != '0':
224 #if str($io_param.ppass.addparam.edit_params) == "yes":
225 --edit_additional_parameters
226 #end if
227 #for $apar in $io_param.ppass.addparam.additional_parameters:
228 #if $apar.ap_type.param_type=="selecttext":
229 --selecttext_parameters '{"name":"$apar.param_name", "label":"$apar.param_label", "help":"$apar.param_help",
230 "type":"$apar.ap_type.param_type","CL":"$apar.param_CL","override":"$apar.param_CLprefixed","value": [
231 #for $i,$st in enumerate($apar.ap_type.selectTexts):
232 "$st.select_value"
233 #if ($i < (len($apar.ap_type.selectTexts)-1)):
234 ,
235 #end if
236 #end for
237 ], "texts": [
238 #for $i,$st in enumerate($apar.ap_type.selectTexts):
239 "$st.select_text"
240 #if ($i < (len($apar.ap_type.selectTexts)-1)):
241 ,
242 #end if
243
244 #end for
245 ]
246 }'
247 #else:
248 --additional_parameters '{"name": "$apar.param_name", "value": "$apar.ap_type.param_value", "label": "$apar.param_label", "help": "$apar.param_help",
249 "type": "$apar.ap_type.param_type","CL": "$apar.param_CL","override": "$apar.param_CLprefixed", "repeat": "$apar.param_repeat"}'
250 #end if
251 #end for
252 #end if
253 #for $intab in $io_param.ppass.io.history_inputs:
254 --input_files '{"name": "$intab.input_files", "CL": "$intab.input_CL", "format": "$intab.input_formats", "label": "$intab.input_label", "help": "$intab.input_help", "repeat": "$intab.input_repeat"}'
255 #end for
256 #for $otab in $io_param.ppass.io.history_outputs:
257 --output_files '{"name": "$otab.history_name", "format": "$otab.history_format", "CL": "$otab.history_CL", "test": "$otab.history_test"}'
258 #end for
259 #for $collect in $io_param.ppass.io.collection_outputs:
260 --collection '{"name": "$collect.name", "kind": "$collect.kind", "discover": "$collect.discover", "label": "$collect.label"}'
261 #end for
262 --untested_tool_out "$generated_xml"
263 --install "$install"
264 --galaxy_root "$__root_dir__"
265 --tool_dir "$__tool_directory__"
266 #end if
267 ]]></command>
268 <configfiles>
269 <configfile name="runme">
270 $deps.usescript.dynScript
271 </configfile>
272 <configfile name="commandoverride">
273 #if $cover.commover == "yes" and len(str($cover.command_override).strip()) > 1:
274 $cover.command_override
275 #end if
276 </configfile>
277 <configfile name="testoverride">
278 #if $cover.commover == "yes" and len(str($cover.test_override).strip()) > 1:
279 $cover.test_override
280 #end if
281 </configfile>
282 <configfile name="helpme">
283 ${help_text}
284 </configfile>
285 <configfile name="citeme">
286
287 #for $citation in $citations:
288 #if $citation.citation_type.type == "bibtex":
289 **ENTRY**bibtex
290 ${citation.citation_type.bibtex}
291 #else
292 **ENTRY**doi
293 ${citation.citation_type.doi}
294 #end if
295 #end for
296
297 </configfile>
298 </configfiles>
299 <inputs>
300 <param name="tool_name" type="text" value="my_tool" label="New tool ID and title for outputs"
301 help="Toolshed repository name. Choose thoughtfully to avoid namespace clashes with other tool writers. Lower case, digits and underscores only">
302 <sanitizer invalid_char="">
303 <valid initial="string.ascii_lowercase,string.digits">
304 <add value="_"/>
305 </valid>
306 </sanitizer>
307 </param>
308
309 <section name="deps" title="Dependencies, optional script and script interpreter" expanded="true">
310
311 <param name="packages" type="text" value="" label="Conda dependencies as package name[:version, name:version...]. These will always be available when this tool executes"
312 help="Use =[ver] or :[ver] for specific version - 'bwa=0.17.0'. Default is latest. Will be used every time the tool is (re)run. Only Conda is currently supported" />
313
314 <conditional name="usescript">
315 <param name="choosescript" type="select" display="radio" label="Supply a script for a dependency (e.g. python/R/bash) or a system executable such as Bash"
316 help = "For script interpreters like Python or bash, parameters and i/o specified below must match script's expectations - if you pass parameters, the script must deal with them">
317 <option value="no">No script required for this tool - just pass parameters on the command line to the first dependency listed above</option>
318 <option value="yes" selected="true">Yes, a script is ready to be pasted below</option>
319 </param>
320 <when value="no">
321 <param name="dynScript" type="hidden" value="" />
322 <param name="scriptrunner" type="hidden" value="" />
323 </when>
324 <when value="yes">
325 <param name="scriptrunner" type="text" value="" label="Interpreter for the script - eg bash or python. Can be one of the dependencies named above or a system executable"
326 help="Scripts are interpreted by the executable named here. For conda r-base, 'Rscript --vanilla' or for conda planemo, 'planemo test' for example">
327 </param>
328 <param name="dynScript" type="text" area="True" value="" label="Script for executable above to interpret. It can be one of the Conda dependency names "
329 help="Script must handle all i/o and parameters as specified below using the parameters and passing method chosen below">
330 <sanitizer>
331 <valid initial="string.printable"/>
332 <mapping initial="none"/>
333 </sanitizer>
334 </param>
335 </when>
336 </conditional>
337 </section>
338 <section name="io_param" title="Data file input, output and settings forming the executable or script command line" expanded="true">
339 <conditional name="ppass">
340 <param name="parampass" type="select" display="radio" label="Command line parameter passing method to use">
341 <option value="argparse" selected="true">Argparse: passed in the form of --clname value</option>
342 <option value="positional">Positional: Passed in the order of positional ordinals ...foo.bam bar.idx zot.xls</option>
343 <option value="0">Tool reads selected input file from STDIN and writes STDOUT with no parameters</option>
344 </param>
345 <when value="argparse">
346 <expand macro="io" />
347 <expand macro="additparam" />
348 </when>
349 <when value="positional">
350 <expand macro="io" />
351 <expand macro="additparam" />
352 </when>
353 <when value="0">
354 <expand macro="io"/>
355 </when>
356 </conditional>
357 </section>
358 <param name="cl_suffix" type="text" value="" label="Suffix for generated command line. Useful for bash post processing. Use override below to replace completely"
359 help="';' separated bash commands can be used here for post processing - added at end of autogenerated command line">
360 <sanitizer>
361 <valid initial="string.printable" />
362 <mapping initial="none"/>
363 </sanitizer>
364 </param>
365 <conditional name="cover">
366 <param name="commover" type="select" display="radio" label="Add Human wrought code to override the generated XML command and/or test section - DIY"
367 help = "For arbitrary and artfull command lines. All i/o and parameters must be passed. Choose No unless needed. Not for the faint of heart">
368 <option value="no" selected="true">No. Use automatically generated command/test XML </option>
369 <option value="yes">Yes. XML needed to override autogenerated command and/or test segments will be pasted below</option>
370 </param>
371 <when value="no">
372 <param name="command_override" type="hidden" value="" />
373 <param name="test_override" type="hidden" value="" />
374 </when>
375 <when value="yes">
376 <param name="command_override" type="text" area="True" value="" label="Optional. Human wrought command element override XML/template - e.g. for bwa"
377 help="For arbitrary and artfull command lines. All i/o and parameters must be passed. Leave blank unless needed. Not for the faint of heart">
378 <sanitizer>
379 <valid initial="string.printable"/>
380 <mapping initial="none"/>
381 </sanitizer>
382 </param>
383 <param name="test_override" type="text" area="True" value="" label="Optional. Human wrought test element override XML/template - e.g. for bwa"
384 help="For arbitrary and artfull scripts. Leave blank unless needed. Not for the faint of heart">
385 <sanitizer>
386 <valid initial="string.printable" />
387 <mapping initial="none"/>
388 </sanitizer>
389 </param>
390 </when>
391 </conditional>
392 <expand macro="tool_metadata" />
393 </inputs>
394 <outputs>
395 <data name="generated_xml" format="xml" label = "${tool_name} generated XML"/>
396 </outputs>
397 <tests>
398 <test>
399 <param name="user_email" value="admin@galaxy.org"/>
400 <param name="input_files" value="input1_sample" />
401 <param name="input_CL" value="1" />
402 <param name="input_formats" value="txt" />
403 <param name="input_label" value="input" />
404 <param name="input_help" value="help" />
405 <param name="tool_name" value="pyrevpos" />
406 <param name="parampass" value="positional" />
407 <param name="tool_version" value="0.01" />
408 <param name="tool_desc" value="positional reverse" />
409 <param name="help_text" value="help text goes here" />
410 <param name="packages" value="python"/>
411 <param name="history_name" value="output2" />
412 <param name="history_format" value="txt" />
413 <param name="history_CL" value="2" />
414 <param name="dynScript" value="import sys; inp = sys.argv[1]; outp = sys.argv[2]; inlist = open(inp,'r').readlines(); o = open(outp,'w'); rs = [''.join(list(reversed(x.rstrip()))) for x in inlist]; o.write('\n'.join(rs)); o.close()"/>
415 <param name="choosescript" value="yes" />
416 <param name="script_path" value="$runme"/>
417 <param name="install" value="0"/>
418 <output name="generated_xml" value="generated_xml_sample" compare="diff" lines_diff="5"/>
419 </test>
420 </tests>
421 <help>
422
423 **Details and attribution**
424 (see GTF_)
425
426 **Local Admins ONLY**
427 Only users whose IDs found in the local admin_user configuration setting in universe_wsgi.ini can run this tool.
428
429 **If you find a bug**
430 Please raise an issue, or even better, submit a pull request fixing it, on the github repository GTF_
431
432 **What it does**
433 This tool optionally generates normal workflow compatible first class Galaxy tools
434
435 Generated tools can run existing binary packages that become requirements, existing scripts, or new scripts pasted into this tool form.
436 Pasted scripts are written so they are part of the new tool and cannot be adjusted by the downstream user.
437 Binary packages are managed by the dependency subsystem - conda usually, so anything in bioconda or conda_forge is available for example.
438
439 Any number of parameters can be built into the new tool form for passing in to the script or executable at runtime.
440 These can be editable by the downstream user or baked in.
441
442 A new tarball compatible with any Galaxy toolshed is created in your history, however, it does not have the test prepared.
443 There is a separate tool you can run to update the archive after testing with Planemo
444
445 If the configuration in job_conf.xml allows tools to write to [galaxy_root]/tools, the new tool will be installed so you can view and test it locally.
446
447 .. class:: warningmark
448
449 **Note to system administrators**
450 This tool offers *NO* built in protection against malicious scripts. It should only be installed on private/personnal Galaxy instances.
451 Admin_users will have the power to do anything they want as the Galaxy user if you install this tool.
452
453 .. class:: warningmark
454
455 **Use on public servers** is STRONGLY discouraged for obvious reasons
456
457 The tools generated by this tool will run just as securely as any other normal installed Galaxy tool but like any other new tools, should always be checked carefully before installation.
458 We recommend that you follow the good code hygiene practices associated with safe toolshed practices.
459
460
461 Paper_
462
463 *Licensing*
464
465 Copyright Ross Lazarus (ross period lazarus at gmail period com) May 2012
466 All rights reserved.
467 Licensed under the LGPL_
468
469 .. _LGPL: http://www.gnu.org/copyleft/lesser.html
470 .. _GTF: https://github.com/fubar2/toolfactory
471 .. _Paper: https://academic.oup.com/bioinformatics/article/28/23/3139/192853
472
473
474 </help>
475 <citations>
476 <citation type="doi">10.1093/bioinformatics/bts573</citation>
477 </citations>
478 </tool>
479
480