comparison toolfactory/ToolFactory.xml @ 50:807b8d103f18 draft default tip

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