annotate README.txt @ 25:8cc3f3c0e539 default tip

Now uses admin_users to check that the user is authorized to run this tool Docs adjusted.
author Ross Lazarus <ross.lazarus@gmail.com>
date Wed, 06 Jun 2012 14:16:25 +1000
parents 8289ebc513ab
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
1 # WARNING before you start
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
2 # Install on a private Galaxy ONLY
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
3 # Please NEVER on a public or production instance
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
4
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
5 *Read on if* You use a production Galaxy;
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
6 Your users sometimes take data out of Galaxy, process it with ugly
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
7 little perl/awk/sed/R... scripts and put it back;
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
8 They do this when they can't do some transformation in Galaxy (the 90/10 rule);
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
9 You don't have enough developer resources for wrapping dozens of even relatively simple tools;
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
10 Your institution would be better off if those nasty, feral scripts were all tucked safely in
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
11 a local toolshed.
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
12
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
13 *The good news* If it can be trivially scripted, it can be running safely in your
25
8cc3f3c0e539 Now uses admin_users to check that the user is authorized to run this tool
Ross Lazarus <ross.lazarus@gmail.com>
parents: 24
diff changeset
14 local Galaxy via your own local toolshed in a few minutes.
8cc3f3c0e539 Now uses admin_users to check that the user is authorized to run this tool
Ross Lazarus <ross.lazarus@gmail.com>
parents: 24
diff changeset
15
19
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
16 That's what this tool does. You paste a simple script and the tool returns
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
17 a new, real Galaxy tool, ready to be installed from the local toolshed to local servers.
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
18 Scripts can be wrapped and online literally within minutes.
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
19
25
8cc3f3c0e539 Now uses admin_users to check that the user is authorized to run this tool
Ross Lazarus <ross.lazarus@gmail.com>
parents: 24
diff changeset
20 *To fully and safely exploit the awesome power* of this tool, Galaxy and the ToolShed,
8cc3f3c0e539 Now uses admin_users to check that the user is authorized to run this tool
Ross Lazarus <ross.lazarus@gmail.com>
parents: 24
diff changeset
21 you should be a developer installing this tool on a private/personal/scratch local instance where you are an admin_user.
8cc3f3c0e539 Now uses admin_users to check that the user is authorized to run this tool
Ross Lazarus <ross.lazarus@gmail.com>
parents: 24
diff changeset
22 Then, if you break it, you get to keep all the pieces
19
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
23 see https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
24
25
8cc3f3c0e539 Now uses admin_users to check that the user is authorized to run this tool
Ross Lazarus <ross.lazarus@gmail.com>
parents: 24
diff changeset
25 *To make the tool work* R, python, perl etc are needed on your path if you want to run scripts using those interpreters.
8cc3f3c0e539 Now uses admin_users to check that the user is authorized to run this tool
Ross Lazarus <ross.lazarus@gmail.com>
parents: 24
diff changeset
26 The HTML file code to shrink R's gross pdfs requires Ghostscript and imagemagick must be installed for generating the thumbnails.
8cc3f3c0e539 Now uses admin_users to check that the user is authorized to run this tool
Ross Lazarus <ross.lazarus@gmail.com>
parents: 24
diff changeset
27 If not already there (I just added it to datatypes_conf.xml.sample), please add:
19
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
28 <datatype extension="toolshed.gz" type="galaxy.datatypes.binary:Binary" mimetype="multipart/x-gzip" subclass="True" />
25
8cc3f3c0e539 Now uses admin_users to check that the user is authorized to run this tool
Ross Lazarus <ross.lazarus@gmail.com>
parents: 24
diff changeset
29 to your local data_types_conf.xml.
8cc3f3c0e539 Now uses admin_users to check that the user is authorized to run this tool
Ross Lazarus <ross.lazarus@gmail.com>
parents: 24
diff changeset
30
8cc3f3c0e539 Now uses admin_users to check that the user is authorized to run this tool
Ross Lazarus <ross.lazarus@gmail.com>
parents: 24
diff changeset
31 **Note that ONLY admin_users can run this tool**
19
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
32
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
33 *What it does* This is a tool factory for simple scripts in python, R or whatever ails ye.
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
34 LIMITED to simple scripts that read one input from the history.
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
35 Optionally can write one new history dataset,
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
36 and optionally collect any number of outputs into links on an autogenerated HTML page.
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
37 Generated tools can be edited and enhanced like any Galaxy tool, so start small and build up
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
38 A generated script gets you a serious leg up to a more complex one.
17
187c8b023595 more doco good
ross lazarus ross.lazarus@gmail.com
parents: 16
diff changeset
39
19
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
40 *What you do* You paste and run your script
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
41 you fix the syntax errors and eventually it runs
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
42 that's pretty good because you can use the redo button
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
43 to rerun it and edit the script as you debug - cool, but
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
44 now the power really kicks in, because
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
45 once the script works on some test data, you can
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
46 generate a toolshed compatible gzip file
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
47 containing your script neatly wrapped and hidden safely inside an ordinary Galaxy script in your
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
48 local toolshed. That means safe and largely automated installation in any production Galaxy configured
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
49 to use your toolshed or the tool
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
50 Automated build for tests still being worked on - should be done soon
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
51
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
52 *Generated tool Security* Once you install a generated tool, it's just
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
53 another tool - assuming the script is safe. They just run normally and their user cannot do anything unusually insecure
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
54 but please, practice safe toolshed.
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
55 Read the fucking code before you install any tool.
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
56 Especially this one - it is really scary.
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
57
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
58 If you opt for an HTML output, you get all the script outputs arranged
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
59 as a single Html history item - all output files are linked, thumbnails for all the pdfs.
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
60 Ugly but really inexpensive.
17
187c8b023595 more doco good
ross lazarus ross.lazarus@gmail.com
parents: 16
diff changeset
61
19
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
62 Patches welcome please.
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
63
17
187c8b023595 more doco good
ross lazarus ross.lazarus@gmail.com
parents: 16
diff changeset
64
19
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
65 long route to June 2012 product
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
66 derived from an integrated script model
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
67 called rgBaseScriptWrapper.py
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
68 Note to the unwary:
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
69 This tool allows arbitrary scripting on your Galaxy as the Galaxy user
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
70 There is nothing stopping a malicious user doing whatever they choose
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
71 Extremely dangerous!!
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
72 Totally insecure. So, trusted users only
17
187c8b023595 more doco good
ross lazarus ross.lazarus@gmail.com
parents: 16
diff changeset
73
19
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
74
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
75
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
76
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
77 copyright ross lazarus (ross stop lazarus at gmail stop com) May 2012
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
78
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
79 all rights reserved
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
80 Licensed under the LGPL if you want to improve it, feel free https://bitbucket.org/fubar/galaxytoolfactory/wiki/Home
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
81
a87a262220a4 Adding proof of concept for optional output formats.
ross lazarus ross.lazarus@gmail.com
parents: 18
diff changeset
82 Material for our more enthusiastic readers continues below
2
d95513e50c92 Add README.txt for bitbucket
ross lazarus ross.lazarus@gmail.com
parents:
diff changeset
83
13
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
84 **Motivation** Simple transformation, filtering or reporting scripts get written, run and lost every day in most busy labs
7
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
85 - even ours where Galaxy is in use. This 'dark script matter' is pervasive and generally not reproducible.
6
78044a3d4a21 Readme = wiki more or less now
Ross Lazarus <ross.lazarus@gmail.com>
parents: 5
diff changeset
86
13
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
87 **Benefits** For our group, this allows Galaxy to fill that important dark script gap - all those "small" bioinformatics
7
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
88 tasks. Once a user has a working R (or python or perl) script that does something Galaxy cannot currently do (eg transpose a
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
89 tabular file) and takes parameters the way Galaxy supplies them (see example below), they:
6
78044a3d4a21 Readme = wiki more or less now
Ross Lazarus <ross.lazarus@gmail.com>
parents: 5
diff changeset
90
7
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
91 1. Install the tool factory on a personal private instance
2
d95513e50c92 Add README.txt for bitbucket
ross lazarus ross.lazarus@gmail.com
parents:
diff changeset
92
7
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
93 2. Upload a small test data set
2
d95513e50c92 Add README.txt for bitbucket
ross lazarus ross.lazarus@gmail.com
parents:
diff changeset
94
7
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
95 3. Paste the script into the 'script' text box and iteratively run the insecure tool on test data until it works right -
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
96 there is absolutely no reason to do this anywhere other than on a personal private instance.
2
d95513e50c92 Add README.txt for bitbucket
ross lazarus ross.lazarus@gmail.com
parents:
diff changeset
97
7
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
98 4. Once it works right, set the 'Generate toolshed gzip' option and run it again.
2
d95513e50c92 Add README.txt for bitbucket
ross lazarus ross.lazarus@gmail.com
parents:
diff changeset
99
7
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
100 5. A toolshed style gzip appears ready to upload and install like any other Toolshed entry.
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
101
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
102 6. Upload the new tool to the toolshed
6
78044a3d4a21 Readme = wiki more or less now
Ross Lazarus <ross.lazarus@gmail.com>
parents: 5
diff changeset
103
7
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
104 7. Ask the local admin to check the new tool to confirm it's not evil and install it in the local production galaxy
2
d95513e50c92 Add README.txt for bitbucket
ross lazarus ross.lazarus@gmail.com
parents:
diff changeset
105
18
943d4f0ee7c1 More better doco
ross lazarus ross.lazarus@gmail.com
parents: 17
diff changeset
106 **Simple examples on the tool form**
13
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
107
16
36df24947ab3 readme changes
Ross Lazarus <ross.lazarus@gmail.com>
parents: 14
diff changeset
108 A simple Rscript "filter" showing how the command line parameters can be handled, takes an input file,
36df24947ab3 readme changes
Ross Lazarus <ross.lazarus@gmail.com>
parents: 14
diff changeset
109 does something (transpose in this case) and writes the results to a new tabular file::
7
7221619caefa Updated name and added crude gzip generator for toolshed
ross lazarus ross.lazarus@gmail.com
parents: 6
diff changeset
110
13
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
111 # transpose a tabular input file and write as a tabular output file
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
112 ourargs = commandArgs(TRUE)
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
113 inf = ourargs[1]
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
114 outf = ourargs[2]
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
115 inp = read.table(inf,head=F,row.names=NULL,sep='\t')
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
116 outp = t(inp)
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
117 write.table(outp,outf, quote=FALSE, sep="\t",row.names=F,col.names=F)
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
118
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
119 A more complex Rscript example takes no input file but generates a random heatmap pdf - you must make sure the option to create an HTML output file is
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
120 turned on for this to work. The heatmap will be presented as a thumbnail linked to the pdf in the resulting HTML page::
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
121
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
122 # note this script takes NO input or output because it generates random data
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
123 foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
124 bar = as.matrix(foo)
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
125 pdf( "heattest.pdf" )
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
126 heatmap(bar,main='Random Heatmap')
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
127 dev.off()
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
128
14
6f36c696afa5 readme adjustments
ross lazarus ross.lazarus@gmail.com
parents: 13
diff changeset
129 A Python example that reverses each row of a tabular file. You'll need to remove the leading spaces for this to work if cut
6f36c696afa5 readme adjustments
ross lazarus ross.lazarus@gmail.com
parents: 13
diff changeset
130 and pasted into the script box. Note that you can already do this in Galaxy by setting up the cut columns tool with the
6f36c696afa5 readme adjustments
ross lazarus ross.lazarus@gmail.com
parents: 13
diff changeset
131 correct number of columns in reverse order,but this script will work for any number of columns so is completely generic::
5
9c1a1e0e664a and again
ross lazarus ross.lazarus@gmail.com
parents: 4
diff changeset
132
13
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
133 # reverse order of columns in a tabular file
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
134 import sys
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
135 inp = sys.argv[1]
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
136 outp = sys.argv[2]
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
137 i = open(inp,'r')
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
138 o = open(outp,'w')
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
139 for row in i:
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
140 rs = row.rstrip().split('\t')
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
141 rs.reverse()
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
142 o.write('\t'.join(rs))
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
143 o.write('\n')
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
144 i.close()
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
145 o.close()
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
146
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
147
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
148 **Attribution** Copyright Ross Lazarus (ross period lazarus at gmail period com) May 2012
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
149
6
78044a3d4a21 Readme = wiki more or less now
Ross Lazarus <ross.lazarus@gmail.com>
parents: 5
diff changeset
150 All rights reserved.
13
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
151
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
152 Licensed under the LGPL_
4
3755b2365fb0 More edits to readme
ross lazarus ross.lazarus@gmail.com
parents: 3
diff changeset
153
6
78044a3d4a21 Readme = wiki more or less now
Ross Lazarus <ross.lazarus@gmail.com>
parents: 5
diff changeset
154
13
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
155 **Obligatory screenshot**
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
156 http://bitbucket.org/fubar/galaxytoolmaker/src/fda8032fe989/images/dynamicScriptTool.png
7725e4ab27e1 Adding tests - problem to find the script - needs a fixed string somewhere.
ross lazarus ross.lazarus@gmail.com
parents: 7
diff changeset
157