annotate rgToolFactoryMultIn.xml @ 32:4162896b29bd draft

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