annotate rgToolFactory.xml @ 30:fb3fa6a2874d draft

Citations added (thanks John!) and a few more output formats for Alistair Chilcott
author fubar
date Thu, 28 Aug 2014 02:22:39 -0400
parents 63082502722a
children 4162896b29bd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26
63082502722a Uploaded
fubar
parents:
diff changeset
1 <tool id="rgTF" name="Tool Factory" version="1.11">
30
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
2 <description>Run a script; make a tool!</description>
26
63082502722a Uploaded
fubar
parents:
diff changeset
3 <requirements>
63082502722a Uploaded
fubar
parents:
diff changeset
4 <requirement type="package" version="9.10">ghostscript</requirement>
63082502722a Uploaded
fubar
parents:
diff changeset
5 <requirement type="package" version="1.3.18">graphicsmagick</requirement>
63082502722a Uploaded
fubar
parents:
diff changeset
6 </requirements>
63082502722a Uploaded
fubar
parents:
diff changeset
7 <command interpreter="python">
63082502722a Uploaded
fubar
parents:
diff changeset
8 #if ( $__user_email__ not in $__admin_users__ ):
63082502722a Uploaded
fubar
parents:
diff changeset
9 rgToolFactory.py --bad_user $__user_email__
63082502722a Uploaded
fubar
parents:
diff changeset
10 #else:
63082502722a Uploaded
fubar
parents:
diff changeset
11 rgToolFactory.py --script_path "$runme" --interpreter "$interpreter"
63082502722a Uploaded
fubar
parents:
diff changeset
12 --tool_name "$tool_name" --user_email "$__user_email__"
63082502722a Uploaded
fubar
parents:
diff changeset
13 #if $make_TAB.value=="yes":
63082502722a Uploaded
fubar
parents:
diff changeset
14 --output_tab "$tab_file"
63082502722a Uploaded
fubar
parents:
diff changeset
15 #end if
63082502722a Uploaded
fubar
parents:
diff changeset
16 #if $makeMode.make_Tool=="yes":
63082502722a Uploaded
fubar
parents:
diff changeset
17 --make_Tool "$makeMode.make_Tool"
63082502722a Uploaded
fubar
parents:
diff changeset
18 --tool_desc "$makeMode.tool_desc"
63082502722a Uploaded
fubar
parents:
diff changeset
19 --tool_version "$makeMode.tool_version"
63082502722a Uploaded
fubar
parents:
diff changeset
20 --new_tool "$new_tool"
63082502722a Uploaded
fubar
parents:
diff changeset
21 --help_text "$helpme"
63082502722a Uploaded
fubar
parents:
diff changeset
22 #if $make_HTML.value=="yes":
30
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
23 #if makeMode.include.deps.value=="yes":
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
24 --include_dependencies "yes"
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
25 #end if
26
63082502722a Uploaded
fubar
parents:
diff changeset
26 #end if
30
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
27 --citations "$citeme"
26
63082502722a Uploaded
fubar
parents:
diff changeset
28 #end if
63082502722a Uploaded
fubar
parents:
diff changeset
29 #if $make_HTML.value=="yes":
63082502722a Uploaded
fubar
parents:
diff changeset
30 --output_dir "$html_file.files_path" --output_html "$html_file" --make_HTML "yes"
63082502722a Uploaded
fubar
parents:
diff changeset
31 #else:
63082502722a Uploaded
fubar
parents:
diff changeset
32 --output_dir "."
63082502722a Uploaded
fubar
parents:
diff changeset
33 #end if
63082502722a Uploaded
fubar
parents:
diff changeset
34 #if $input1 != 'None':
63082502722a Uploaded
fubar
parents:
diff changeset
35 --input_tab "$input1"
63082502722a Uploaded
fubar
parents:
diff changeset
36 #end if
63082502722a Uploaded
fubar
parents:
diff changeset
37 #end if
63082502722a Uploaded
fubar
parents:
diff changeset
38 </command>
63082502722a Uploaded
fubar
parents:
diff changeset
39 <inputs>
63082502722a Uploaded
fubar
parents:
diff changeset
40 <param name="input1" type="data" label="Select an input file from your history" optional="true" size="120"
63082502722a Uploaded
fubar
parents:
diff changeset
41 help="Most scripts will need an input - your script MUST be ready for whatever format you choose"/>
63082502722a Uploaded
fubar
parents:
diff changeset
42 <param name="tool_name" type="text" value="My dynamic script" label="New tool ID and title for outputs" size="60"
63082502722a Uploaded
fubar
parents:
diff changeset
43 help="This will become the toolshed repository name so please choose thoughtfully to avoid namespace clashes with other tool writers">
63082502722a Uploaded
fubar
parents:
diff changeset
44 <sanitizer invalid_char="">
63082502722a Uploaded
fubar
parents:
diff changeset
45 <valid initial="string.letters,string.digits"/>
63082502722a Uploaded
fubar
parents:
diff changeset
46 </sanitizer>
63082502722a Uploaded
fubar
parents:
diff changeset
47 </param>
63082502722a Uploaded
fubar
parents:
diff changeset
48 <conditional name="makeMode">
63082502722a Uploaded
fubar
parents:
diff changeset
49 <param name="make_Tool" type="select" label="Create a tar.gz file ready for local toolshed entry" help="Ready to deploy securely!" size="60">
63082502722a Uploaded
fubar
parents:
diff changeset
50 <option value="yes">Generate a Galaxy ToolShed compatible toolshed.gz</option>
63082502722a Uploaded
fubar
parents:
diff changeset
51 <option value="" selected="true">No. Just run the script please</option>
63082502722a Uploaded
fubar
parents:
diff changeset
52 </param>
63082502722a Uploaded
fubar
parents:
diff changeset
53 <when value = "yes">
63082502722a Uploaded
fubar
parents:
diff changeset
54 <param name="tool_version" label="Tool Version - bump this to warn users trying to redo old analyses" type="text" value="0.01"
63082502722a Uploaded
fubar
parents:
diff changeset
55 help="If you change your script and regenerate the 'same' tool, you should inform Galaxy (and users) by changing (bumping is traditional) this number"/>
63082502722a Uploaded
fubar
parents:
diff changeset
56 <param name="tool_desc" label="Tool Description" type="text" value="" size="40"
63082502722a Uploaded
fubar
parents:
diff changeset
57 help="Supply a brief tool description for the Galaxy tool menu entry (optional - appears after the tool name)" />
63082502722a Uploaded
fubar
parents:
diff changeset
58 <param name="help_text" label="Tool form documentation and help text for users" type="text" area="true"
63082502722a Uploaded
fubar
parents:
diff changeset
59 size="8x120" value="**What it Does**"
63082502722a Uploaded
fubar
parents:
diff changeset
60 help="Supply the brief user documentation to appear on the new tool form as reStructured text - http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html" >
63082502722a Uploaded
fubar
parents:
diff changeset
61 <sanitizer>
63082502722a Uploaded
fubar
parents:
diff changeset
62 <valid initial="string.printable">
63082502722a Uploaded
fubar
parents:
diff changeset
63 </valid>
63082502722a Uploaded
fubar
parents:
diff changeset
64 <mapping initial="none"/>
63082502722a Uploaded
fubar
parents:
diff changeset
65 </sanitizer>
63082502722a Uploaded
fubar
parents:
diff changeset
66 </param>
63082502722a Uploaded
fubar
parents:
diff changeset
67 <param name="include_deps" type="select" label="Include ghostscript and graphicsmagick dependencies in generated tool" size="60"
63082502722a Uploaded
fubar
parents:
diff changeset
68 help="If an HTML file is being created, including dependencies is recommended. Otherwise this setting has no effect">
63082502722a Uploaded
fubar
parents:
diff changeset
69 <option value="">Rely on system ghostscript and graphicsmagick rather than include these as dependencies</option>
63082502722a Uploaded
fubar
parents:
diff changeset
70 <option value="yes" selected="true">Include dependencies so target installations will always work if HTML is being generated</option>
63082502722a Uploaded
fubar
parents:
diff changeset
71 </param>
30
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
72 <repeat name="citations" title="Citation">
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
73 <conditional name="citation_type">
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
74 <param name="type" type="select" label="Citation Type">
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
75 <option value="doi">DOI</option>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
76 <option value="bibtex">BibTeX</option>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
77 </param>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
78 <when value="doi">
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
79 <param name="doi" label="DOI" type="text" value=""
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
80 help="Supply a DOI (e.g. 10.1111/j.1740-9713.2007.00258.x) that should be cited when this tool is used in published research." />
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
81 </when>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
82 <when value="bibtex">
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
83 <param name="bibtex" label="BibTex" type="text" area="true"
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
84 size="8x120" help="Supply a BibTex entry that should be cited when this tool is used in published research." value="" >
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
85 <sanitizer>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
86 <valid initial="string.printable">
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
87 </valid>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
88 <mapping initial="none"/>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
89 </sanitizer>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
90 </param>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
91 </when>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
92 </conditional>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
93 </repeat>
26
63082502722a Uploaded
fubar
parents:
diff changeset
94 </when>
63082502722a Uploaded
fubar
parents:
diff changeset
95 <when value = "">
63082502722a Uploaded
fubar
parents:
diff changeset
96 </when>
63082502722a Uploaded
fubar
parents:
diff changeset
97 </conditional>
63082502722a Uploaded
fubar
parents:
diff changeset
98 <param name="make_HTML" type="select" label="Create an HTML report with links to all output files and thumbnail links to PDF images" size="60"
63082502722a Uploaded
fubar
parents:
diff changeset
99 help="Recommended for presenting complex outputs in an accessible manner. Turn off for simple tools so they just create one output">
63082502722a Uploaded
fubar
parents:
diff changeset
100 <option value="yes">Yes, arrange all outputs produced by my script as an HTML output</option>
63082502722a Uploaded
fubar
parents:
diff changeset
101 <option value="" selected="true">No, no HTML output file thanks</option>
63082502722a Uploaded
fubar
parents:
diff changeset
102 </param>
63082502722a Uploaded
fubar
parents:
diff changeset
103 <param name="make_TAB" type="select" label="Create a new (default tabular) history output with or without an HTML file specified above"
63082502722a Uploaded
fubar
parents:
diff changeset
104 help="This is useful if your script creates a single new tabular file you want to appear in the history after the tool executes">
63082502722a Uploaded
fubar
parents:
diff changeset
105 <option value="yes" selected="true">My script writes to a new history output</option>
63082502722a Uploaded
fubar
parents:
diff changeset
106 <option value="">I do not want a new history output file</option>
63082502722a Uploaded
fubar
parents:
diff changeset
107 </param>
63082502722a Uploaded
fubar
parents:
diff changeset
108 <param name="out_format" type="select" label="Galaxy datatype for your tool's output file if any" help="You may need to edit the xml to extend this list">
63082502722a Uploaded
fubar
parents:
diff changeset
109 <option value="tabular" selected="true">Tabular</option>
63082502722a Uploaded
fubar
parents:
diff changeset
110 <option value="interval">Interval</option>
63082502722a Uploaded
fubar
parents:
diff changeset
111 <option value="gz">gz</option>
63082502722a Uploaded
fubar
parents:
diff changeset
112 <option value="text">text</option>
30
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
113 <option value="sam">sam</option>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
114 <option value="bam">bam</option>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
115 <option value="fastqsanger">fastqsanger</option>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
116 <option value="fastq">fastq</option>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
117 <option value="fasta">fasta</option>
26
63082502722a Uploaded
fubar
parents:
diff changeset
118 </param>
63082502722a Uploaded
fubar
parents:
diff changeset
119 <param name="interpreter" type="select" label="Select the interpreter for your code. This must be available on the path of the execution host">
63082502722a Uploaded
fubar
parents:
diff changeset
120 <option value="Rscript" selected="true">Rscript</option>
63082502722a Uploaded
fubar
parents:
diff changeset
121 <option value="python">python</option>
63082502722a Uploaded
fubar
parents:
diff changeset
122 <option value="perl">perl</option>
30
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
123 <option value="bash">bash</option>
26
63082502722a Uploaded
fubar
parents:
diff changeset
124 <option value="sh">sh</option>
63082502722a Uploaded
fubar
parents:
diff changeset
125 </param>
63082502722a Uploaded
fubar
parents:
diff changeset
126 <param name="dynScript" label="Cut and paste the script to be executed here" type="text" value="" area="True" size="8x120"
63082502722a Uploaded
fubar
parents:
diff changeset
127 help="Script must deal with two command line parameters: Path to input tabular file path (or 'None' if none selected) and path to output tabular history file (or 'None').">
63082502722a Uploaded
fubar
parents:
diff changeset
128 <sanitizer>
63082502722a Uploaded
fubar
parents:
diff changeset
129 <valid initial="string.printable">
63082502722a Uploaded
fubar
parents:
diff changeset
130 </valid>
63082502722a Uploaded
fubar
parents:
diff changeset
131 <mapping initial="none"/>
63082502722a Uploaded
fubar
parents:
diff changeset
132 </sanitizer>
63082502722a Uploaded
fubar
parents:
diff changeset
133 </param>
63082502722a Uploaded
fubar
parents:
diff changeset
134 </inputs>
63082502722a Uploaded
fubar
parents:
diff changeset
135 <outputs>
63082502722a Uploaded
fubar
parents:
diff changeset
136 <data format="tabular" name="tab_file" label="${tool_name}.${out_format}">
63082502722a Uploaded
fubar
parents:
diff changeset
137 <filter>make_TAB=="yes"</filter>
63082502722a Uploaded
fubar
parents:
diff changeset
138 <change_format>
63082502722a Uploaded
fubar
parents:
diff changeset
139 <when input="out_format" value="interval" format="interval" />
63082502722a Uploaded
fubar
parents:
diff changeset
140 <when input="out_format" value="gz" format="gz" />
63082502722a Uploaded
fubar
parents:
diff changeset
141 <when input="out_format" value="text" format="text" />
30
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
142 <when input="out_format" value="sam" format="sam" />
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
143 <when input="out_format" value="bam" format=bam" />
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
144 <when input="out_format" value="fastqsanger" format="fastqsanger" />
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
145 <when input="out_format" value="fastq" format=fastq" />
26
63082502722a Uploaded
fubar
parents:
diff changeset
146 </change_format>
63082502722a Uploaded
fubar
parents:
diff changeset
147 </data>
63082502722a Uploaded
fubar
parents:
diff changeset
148 <data format="html" name="html_file" label="${tool_name}.html">
63082502722a Uploaded
fubar
parents:
diff changeset
149 <filter>make_HTML == "yes"</filter>
63082502722a Uploaded
fubar
parents:
diff changeset
150 </data>
63082502722a Uploaded
fubar
parents:
diff changeset
151 <data format="toolshed.gz" name="new_tool" label="${tool_name}.toolshed.gz">
63082502722a Uploaded
fubar
parents:
diff changeset
152 <filter>makeMode['make_Tool'] == "yes"</filter>
63082502722a Uploaded
fubar
parents:
diff changeset
153 </data>
63082502722a Uploaded
fubar
parents:
diff changeset
154 </outputs>
63082502722a Uploaded
fubar
parents:
diff changeset
155 <configfiles>
63082502722a Uploaded
fubar
parents:
diff changeset
156 <configfile name="runme">$dynScript</configfile>
63082502722a Uploaded
fubar
parents:
diff changeset
157 <configfile name="helpme">
63082502722a Uploaded
fubar
parents:
diff changeset
158 #if $makeMode.make_Tool == "yes":
63082502722a Uploaded
fubar
parents:
diff changeset
159 ${makeMode.help_text}
63082502722a Uploaded
fubar
parents:
diff changeset
160 #end if
63082502722a Uploaded
fubar
parents:
diff changeset
161 </configfile>
30
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
162 <configfile name="citeme">
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
163 #if $makeMode.make_Tool == "yes":
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
164 #for $citation in $makeMode.citations:
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
165 #if $citation.citation_type.type == "bibtex":
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
166 **ENTRY**bibtex
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
167 ${citation.citation_type.bibtex}
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
168 #else
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
169 **ENTRY**doi
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
170 ${citation.citation_type.doi}
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
171 #end if
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
172 #end for
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
173 #end if
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
174 </configfile>
26
63082502722a Uploaded
fubar
parents:
diff changeset
175 </configfiles>
63082502722a Uploaded
fubar
parents:
diff changeset
176 <help>
63082502722a Uploaded
fubar
parents:
diff changeset
177
63082502722a Uploaded
fubar
parents:
diff changeset
178 .. class:: warningmark
63082502722a Uploaded
fubar
parents:
diff changeset
179
63082502722a Uploaded
fubar
parents:
diff changeset
180 **Details and attribution** GTF_
63082502722a Uploaded
fubar
parents:
diff changeset
181
63082502722a Uploaded
fubar
parents:
diff changeset
182 **Local Admins ONLY** Only users whose IDs found in the local admin_user configuration setting in universe_wsgi.ini can run this tool.
63082502722a Uploaded
fubar
parents:
diff changeset
183
63082502722a Uploaded
fubar
parents:
diff changeset
184 **If you find a bug** please raise an issue at the bitbucket repository GTFI_
63082502722a Uploaded
fubar
parents:
diff changeset
185
63082502722a Uploaded
fubar
parents:
diff changeset
186 **What it does** This tool enables a user to paste and submit an arbitrary R/python/perl script to Galaxy.
63082502722a Uploaded
fubar
parents:
diff changeset
187
63082502722a Uploaded
fubar
parents:
diff changeset
188 **Input options** This version is limited to simple transformation or reporting requiring only a single input file selected from the history.
63082502722a Uploaded
fubar
parents:
diff changeset
189
63082502722a Uploaded
fubar
parents:
diff changeset
190 **Output options** Optional script outputs include one single new history tabular file, or for scripts that create multiple outputs,
63082502722a Uploaded
fubar
parents:
diff changeset
191 a new HTML report linking all the files and images created by the script can be automatically generated.
63082502722a Uploaded
fubar
parents:
diff changeset
192
63082502722a Uploaded
fubar
parents:
diff changeset
193 **Tool Generation option** Once the script is working with test data, this tool will optionally generate a new Galaxy tool in a gzip file
63082502722a Uploaded
fubar
parents:
diff changeset
194 ready to upload to your local toolshed for sharing and installation. Provide a small sample input when you run generate the tool because
63082502722a Uploaded
fubar
parents:
diff changeset
195 it will become the input for the generated functional test.
63082502722a Uploaded
fubar
parents:
diff changeset
196
63082502722a Uploaded
fubar
parents:
diff changeset
197 .. class:: warningmark
63082502722a Uploaded
fubar
parents:
diff changeset
198
63082502722a Uploaded
fubar
parents:
diff changeset
199 **Note to system administrators** This tool offers *NO* built in protection against malicious scripts. It should only be installed on private/personnal Galaxy instances.
63082502722a Uploaded
fubar
parents:
diff changeset
200 Admin_users will have the power to do anything they want as the Galaxy user if you install this tool.
63082502722a Uploaded
fubar
parents:
diff changeset
201
63082502722a Uploaded
fubar
parents:
diff changeset
202 .. class:: warningmark
63082502722a Uploaded
fubar
parents:
diff changeset
203
63082502722a Uploaded
fubar
parents:
diff changeset
204 **Use on public servers** is STRONGLY discouraged for obvious reasons
63082502722a Uploaded
fubar
parents:
diff changeset
205
63082502722a Uploaded
fubar
parents:
diff changeset
206 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.
63082502722a Uploaded
fubar
parents:
diff changeset
207 We recommend that you follow the good code hygiene practices associated with safe toolshed.
63082502722a Uploaded
fubar
parents:
diff changeset
208
63082502722a Uploaded
fubar
parents:
diff changeset
209 **Scripting conventions** The pasted script will be executed with the path to the (optional) input tabular data file path or NONE if you do not select one, and the path to the optional
63082502722a Uploaded
fubar
parents:
diff changeset
210 output file or None if none is wanted, as the first and second command line parameters. The script must deal appropriately with these - see Rscript examples below.
63082502722a Uploaded
fubar
parents:
diff changeset
211 Note that if an optional HTML output is selected, all the output files created by the script will be nicely presented as links, with pdf images linked as thumbnails in that output.
63082502722a Uploaded
fubar
parents:
diff changeset
212 This can be handy for complex scripts creating lots of output.
63082502722a Uploaded
fubar
parents:
diff changeset
213
63082502722a Uploaded
fubar
parents:
diff changeset
214 **Examples**
63082502722a Uploaded
fubar
parents:
diff changeset
215 <![CDATA[
63082502722a Uploaded
fubar
parents:
diff changeset
216
63082502722a Uploaded
fubar
parents:
diff changeset
217 Each of these following trivial examples can be cut and pasted into the script box for testing.
63082502722a Uploaded
fubar
parents:
diff changeset
218 Please make sure you choose the appropriate interpreter and upload and select a suitable small matching test data input
63082502722a Uploaded
fubar
parents:
diff changeset
219
63082502722a Uploaded
fubar
parents:
diff changeset
220 A simple Rscript "filter" showing how the command line parameters can be handled, takes an input file, does something (transpose in this case) and
63082502722a Uploaded
fubar
parents:
diff changeset
221 writes the results to a new tabular file. Note the use of colClasses to ensure that no fiddling takes place with numeric values by treating everything
63082502722a Uploaded
fubar
parents:
diff changeset
222 as a string::
63082502722a Uploaded
fubar
parents:
diff changeset
223
63082502722a Uploaded
fubar
parents:
diff changeset
224 # transpose a tabular input file and write as a tabular output file
63082502722a Uploaded
fubar
parents:
diff changeset
225 ourargs = commandArgs(TRUE)
63082502722a Uploaded
fubar
parents:
diff changeset
226 inf = ourargs[1]
63082502722a Uploaded
fubar
parents:
diff changeset
227 outf = ourargs[2]
63082502722a Uploaded
fubar
parents:
diff changeset
228 inp = read.table(inf,head=F,row.names=NULL,sep='\t',colClasses="character")
63082502722a Uploaded
fubar
parents:
diff changeset
229 outp = t(inp)
63082502722a Uploaded
fubar
parents:
diff changeset
230 write.table(outp,outf, quote=FALSE, sep="\t",row.names=F,col.names=F)
63082502722a Uploaded
fubar
parents:
diff changeset
231
63082502722a Uploaded
fubar
parents:
diff changeset
232 Calculate a multiple test adjusted p value from a column of p values - for this script to be useful, it needs the right column for the input to be specified in the code for the
63082502722a Uploaded
fubar
parents:
diff changeset
233 given input file type(s) specified when the tool is generated ::
63082502722a Uploaded
fubar
parents:
diff changeset
234
63082502722a Uploaded
fubar
parents:
diff changeset
235 # use p.adjust - assumes a HEADER row and column 1 - please fix for any real use
63082502722a Uploaded
fubar
parents:
diff changeset
236 column = 1 # adjust if necessary for some other kind of input
63082502722a Uploaded
fubar
parents:
diff changeset
237 ourargs = commandArgs(TRUE)
63082502722a Uploaded
fubar
parents:
diff changeset
238 inf = ourargs[1]
63082502722a Uploaded
fubar
parents:
diff changeset
239 outf = ourargs[2]
63082502722a Uploaded
fubar
parents:
diff changeset
240 inp = read.table(inf,head=T,row.names=NULL,sep='\t')
63082502722a Uploaded
fubar
parents:
diff changeset
241 p = inp[,column]
63082502722a Uploaded
fubar
parents:
diff changeset
242 q = p.adjust(p,method='BH')
63082502722a Uploaded
fubar
parents:
diff changeset
243 outp = cbind(inp,'BH Adjusted p-value'=q)
63082502722a Uploaded
fubar
parents:
diff changeset
244 write.table(outp,outf, quote=FALSE, sep="\t",row.names=F,col.names=T)
63082502722a Uploaded
fubar
parents:
diff changeset
245
63082502722a Uploaded
fubar
parents:
diff changeset
246
63082502722a Uploaded
fubar
parents:
diff changeset
247 A demonstration Rscript example takes no input file but generates some random data based pdf images
63082502722a Uploaded
fubar
parents:
diff changeset
248 You must make sure the option to create an HTML output file is
63082502722a Uploaded
fubar
parents:
diff changeset
249 turned on for this to work. Images (pdf) are linked via thumbnails and
63082502722a Uploaded
fubar
parents:
diff changeset
250 all files have a link on the resulting HTML page::
63082502722a Uploaded
fubar
parents:
diff changeset
251
63082502722a Uploaded
fubar
parents:
diff changeset
252 # note this script takes NO input or output because it generates random data
63082502722a Uploaded
fubar
parents:
diff changeset
253 for (i in 1:10) {
63082502722a Uploaded
fubar
parents:
diff changeset
254 foo = runif(100)
63082502722a Uploaded
fubar
parents:
diff changeset
255 bar = rnorm(100)
63082502722a Uploaded
fubar
parents:
diff changeset
256 bar = foo + 0.05*bar
63082502722a Uploaded
fubar
parents:
diff changeset
257 pdf(paste('yet',i,"anotherplot.pdf",sep='_'))
63082502722a Uploaded
fubar
parents:
diff changeset
258 plot(foo,bar,main=paste("Foo by Bar plot #",i),col="maroon", pch=3,cex=0.6)
63082502722a Uploaded
fubar
parents:
diff changeset
259 dev.off()
63082502722a Uploaded
fubar
parents:
diff changeset
260 foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))
63082502722a Uploaded
fubar
parents:
diff changeset
261 bar = as.matrix(foo)
63082502722a Uploaded
fubar
parents:
diff changeset
262 pdf(paste('yet',i,"anotherheatmap.pdf",sep='_'))
63082502722a Uploaded
fubar
parents:
diff changeset
263 heatmap(bar,main='Random Heatmap')
63082502722a Uploaded
fubar
parents:
diff changeset
264 dev.off()
63082502722a Uploaded
fubar
parents:
diff changeset
265 }
63082502722a Uploaded
fubar
parents:
diff changeset
266
63082502722a Uploaded
fubar
parents:
diff changeset
267 A slight variation taking an input tabular file from which we read the first number as nreps
63082502722a Uploaded
fubar
parents:
diff changeset
268
63082502722a Uploaded
fubar
parents:
diff changeset
269 # note this script takes a single parameter
63082502722a Uploaded
fubar
parents:
diff changeset
270 # number of replicates
63082502722a Uploaded
fubar
parents:
diff changeset
271 ourargs = commandArgs(TRUE)
63082502722a Uploaded
fubar
parents:
diff changeset
272 infname = ourargs[1]
63082502722a Uploaded
fubar
parents:
diff changeset
273 nreps = read.table(infname,head=F)
63082502722a Uploaded
fubar
parents:
diff changeset
274 nreps = unlist(nreps)[1]
63082502722a Uploaded
fubar
parents:
diff changeset
275 nreps = max(c(1,nreps))
63082502722a Uploaded
fubar
parents:
diff changeset
276 nreps = min(c(20,nreps))
63082502722a Uploaded
fubar
parents:
diff changeset
277 print(paste("Using nreps=",nreps))
63082502722a Uploaded
fubar
parents:
diff changeset
278 for (i in 1:nreps) {
63082502722a Uploaded
fubar
parents:
diff changeset
279 foo = runif(100)
63082502722a Uploaded
fubar
parents:
diff changeset
280 bar = rnorm(100)
63082502722a Uploaded
fubar
parents:
diff changeset
281 bar = foo + 0.2*bar
63082502722a Uploaded
fubar
parents:
diff changeset
282 pdf(paste("yet",i,"anotherplot.pdf",sep="_"))
63082502722a Uploaded
fubar
parents:
diff changeset
283 plot(foo,bar,main=paste("Foo by Bar plot ",i),col="maroon", pch=3,cex=0.6)
63082502722a Uploaded
fubar
parents:
diff changeset
284 dev.off()
63082502722a Uploaded
fubar
parents:
diff changeset
285 foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))
63082502722a Uploaded
fubar
parents:
diff changeset
286 bar = as.matrix(foo)
63082502722a Uploaded
fubar
parents:
diff changeset
287 pdf(paste("yet",i,"anotherheatmap.pdf",sep="_"))
63082502722a Uploaded
fubar
parents:
diff changeset
288 heatmap(bar,main="Random Heatmap")
63082502722a Uploaded
fubar
parents:
diff changeset
289 dev.off()
63082502722a Uploaded
fubar
parents:
diff changeset
290 }
63082502722a Uploaded
fubar
parents:
diff changeset
291
63082502722a Uploaded
fubar
parents:
diff changeset
292 A Python example that reverses each row of a tabular file (you'll need to remove the leading spaces
63082502722a Uploaded
fubar
parents:
diff changeset
293 for this to work if cut and pasted into the script box)::
63082502722a Uploaded
fubar
parents:
diff changeset
294
63082502722a Uploaded
fubar
parents:
diff changeset
295 # reverse order of columns in a tabular file
63082502722a Uploaded
fubar
parents:
diff changeset
296 import sys
63082502722a Uploaded
fubar
parents:
diff changeset
297 inp = sys.argv[1]
63082502722a Uploaded
fubar
parents:
diff changeset
298 outp = sys.argv[2]
63082502722a Uploaded
fubar
parents:
diff changeset
299 i = open(inp,'r')
63082502722a Uploaded
fubar
parents:
diff changeset
300 o = open(outp,'w')
63082502722a Uploaded
fubar
parents:
diff changeset
301 for row in i:
63082502722a Uploaded
fubar
parents:
diff changeset
302 rs = row.rstrip().split('\t')
63082502722a Uploaded
fubar
parents:
diff changeset
303 rs.reverse()
63082502722a Uploaded
fubar
parents:
diff changeset
304 o.write('\t'.join(rs))
63082502722a Uploaded
fubar
parents:
diff changeset
305 o.write('\n')
63082502722a Uploaded
fubar
parents:
diff changeset
306 i.close()
63082502722a Uploaded
fubar
parents:
diff changeset
307 o.close()
63082502722a Uploaded
fubar
parents:
diff changeset
308
63082502722a Uploaded
fubar
parents:
diff changeset
309 A trivial shell script example to show that it works::
63082502722a Uploaded
fubar
parents:
diff changeset
310
63082502722a Uploaded
fubar
parents:
diff changeset
311 #!/bin/bash
63082502722a Uploaded
fubar
parents:
diff changeset
312 INF=$1
63082502722a Uploaded
fubar
parents:
diff changeset
313 OUTF=$2
63082502722a Uploaded
fubar
parents:
diff changeset
314 cut -c2,4,6,8,10,12 $INF > $OUTF
63082502722a Uploaded
fubar
parents:
diff changeset
315
63082502722a Uploaded
fubar
parents:
diff changeset
316 A trivial perl script example to show that even perl works::
63082502722a Uploaded
fubar
parents:
diff changeset
317
63082502722a Uploaded
fubar
parents:
diff changeset
318 #
63082502722a Uploaded
fubar
parents:
diff changeset
319 # change all occurances of a string in a file to another string
63082502722a Uploaded
fubar
parents:
diff changeset
320 #
63082502722a Uploaded
fubar
parents:
diff changeset
321 $oldfile = $ARGV[0];
63082502722a Uploaded
fubar
parents:
diff changeset
322 $newfile = $ARGV[1];
63082502722a Uploaded
fubar
parents:
diff changeset
323 $old = "gene";
63082502722a Uploaded
fubar
parents:
diff changeset
324 $new = "foo";
63082502722a Uploaded
fubar
parents:
diff changeset
325 open(OF, $oldfile);
63082502722a Uploaded
fubar
parents:
diff changeset
326 open(NF, ">$newfile");
63082502722a Uploaded
fubar
parents:
diff changeset
327 # read in each line of the file
63082502722a Uploaded
fubar
parents:
diff changeset
328 while ($line = <OF>) {
63082502722a Uploaded
fubar
parents:
diff changeset
329 $line =~ s/$old/$new/;
63082502722a Uploaded
fubar
parents:
diff changeset
330 print NF $line;
63082502722a Uploaded
fubar
parents:
diff changeset
331 }
63082502722a Uploaded
fubar
parents:
diff changeset
332 close(OF);
63082502722a Uploaded
fubar
parents:
diff changeset
333 close(NF);
63082502722a Uploaded
fubar
parents:
diff changeset
334
63082502722a Uploaded
fubar
parents:
diff changeset
335 ]]>
63082502722a Uploaded
fubar
parents:
diff changeset
336
63082502722a Uploaded
fubar
parents:
diff changeset
337 **Citation**
63082502722a Uploaded
fubar
parents:
diff changeset
338
63082502722a Uploaded
fubar
parents:
diff changeset
339
63082502722a Uploaded
fubar
parents:
diff changeset
340 Paper_ :
63082502722a Uploaded
fubar
parents:
diff changeset
341
63082502722a Uploaded
fubar
parents:
diff changeset
342 Creating re-usable tools from scripts: The Galaxy Tool Factory
63082502722a Uploaded
fubar
parents:
diff changeset
343 Ross Lazarus; Antony Kaspi; Mark Ziemann; The Galaxy Team
63082502722a Uploaded
fubar
parents:
diff changeset
344 Bioinformatics 2012; doi: 10.1093/bioinformatics/bts573
63082502722a Uploaded
fubar
parents:
diff changeset
345
63082502722a Uploaded
fubar
parents:
diff changeset
346
63082502722a Uploaded
fubar
parents:
diff changeset
347 **Licensing**
63082502722a Uploaded
fubar
parents:
diff changeset
348
63082502722a Uploaded
fubar
parents:
diff changeset
349 Copyright Ross Lazarus (ross period lazarus at gmail period com) May 2012
63082502722a Uploaded
fubar
parents:
diff changeset
350 All rights reserved.
63082502722a Uploaded
fubar
parents:
diff changeset
351 Licensed under the LGPL_
63082502722a Uploaded
fubar
parents:
diff changeset
352
63082502722a Uploaded
fubar
parents:
diff changeset
353 .. _LGPL: http://www.gnu.org/copyleft/lesser.html
63082502722a Uploaded
fubar
parents:
diff changeset
354 .. _GTF: https://bitbucket.org/fubar/galaxytoolfactory
63082502722a Uploaded
fubar
parents:
diff changeset
355 .. _GTFI: https://bitbucket.org/fubar/galaxytoolfactory/issues
63082502722a Uploaded
fubar
parents:
diff changeset
356 .. _Paper: http://bioinformatics.oxfordjournals.org/cgi/reprint/bts573?ijkey=lczQh1sWrMwdYWJ&amp;keytype=ref
63082502722a Uploaded
fubar
parents:
diff changeset
357
63082502722a Uploaded
fubar
parents:
diff changeset
358
63082502722a Uploaded
fubar
parents:
diff changeset
359 </help>
30
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
360 <citations>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
361 <citation type="doi">10.1093/bioinformatics/bts573</citation>
fb3fa6a2874d Citations added (thanks John!) and a few more output formats for Alistair Chilcott
fubar
parents: 26
diff changeset
362 </citations>
26
63082502722a Uploaded
fubar
parents:
diff changeset
363 </tool>
63082502722a Uploaded
fubar
parents:
diff changeset
364
63082502722a Uploaded
fubar
parents:
diff changeset
365