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