annotate macros.xml @ 2:495946ffc2d6 draft default tip

planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit dded837d19aeb3f06b84e5076282cedeeaf713fa
author mvdbeek
date Sun, 22 Jul 2018 13:38:01 -0400
parents 21d312776891
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
1
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
2 <macro>
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
3 <xml name="help_macro">
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
4 <help>
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
5 .. class:: warningmark
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
6
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
7 **Details and attribution** Docker_toolfactory_
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
8
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
9 **If you find a bug** please raise an issue at the bitbucket repository Issues_
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
10
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
11 **What it does** This tool enables a user to paste and submit an arbitrary R/python/perl script to Galaxy.
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
12
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
13 **Input options** This version is limited to simple transformation or reporting requiring only a single input file selected from the history.
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
14
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
15 **Output options** Optional script outputs include one single new history tabular file, or for scripts that create multiple outputs,
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
16 a new HTML report linking all the files and images created by the script can be automatically generated.
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
17
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
18 .. class:: warningmark
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
19
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
20 **Note to system administrators** This tool uses docker containers as protection against malicious scripts. It should only be installed on private/personnal Galaxy instances.
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
21
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
22 .. class:: warningmark
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
23
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
24 **Use on public servers** is STRONGLY discouraged for obvious reasons
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
25
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
26 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.
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
27 We recommend that you follow the good code hygiene practices associated with safe toolshed.
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
28
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
29 **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
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
30 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.
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
31 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.
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
32 This can be handy for complex scripts creating lots of output.
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
33
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
34 **Examples**
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
35 <![CDATA[
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
36
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
37 Each of these following trivial examples can be cut and pasted into the script box for testing.
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
38 Please make sure you choose the appropriate interpreter and upload and select a suitable small matching test data input
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
39
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
40 A simple Rscript "filter" showing how the command line parameters can be handled, takes an input file, does something (transpose in this case) and
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
41 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
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
42 as a string::
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
43
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
44 # transpose a tabular input file and write as a tabular output file
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
45 ourargs = commandArgs(TRUE)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
46 inf = ourargs[1]
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
47 outf = ourargs[2]
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
48 inp = read.table(inf,head=F,row.names=NULL,sep='\t',colClasses="character")
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
49 outp = t(inp)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
50 write.table(outp,outf, quote=FALSE, sep="\t",row.names=F,col.names=F)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
51
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
52 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
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
53 given input file type(s) specified when the tool is generated ::
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
54
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
55 # use p.adjust - assumes a HEADER row and column 1 - please fix for any real use
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
56 column = 1 # adjust if necessary for some other kind of input
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
57 ourargs = commandArgs(TRUE)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
58 inf = ourargs[1]
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
59 outf = ourargs[2]
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
60 inp = read.table(inf,head=T,row.names=NULL,sep='\t')
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
61 p = inp[,column]
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
62 q = p.adjust(p,method='BH')
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
63 outp = cbind(inp,'BH Adjusted p-value'=q)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
64 write.table(outp,outf, quote=FALSE, sep="\t",row.names=F,col.names=T)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
65
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
66
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
67 A demonstration Rscript example takes no input file but generates some random data based pdf images
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
68 You must make sure the option to create an HTML output file is
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
69 turned on for this to work. Images (pdf) are linked via thumbnails and
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
70 all files have a link on the resulting HTML page::
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
71
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
72 # note this script takes NO input or output because it generates random data
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
73 for (i in 1:10) {
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
74 foo = runif(100)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
75 bar = rnorm(100)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
76 bar = foo + 0.05*bar
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
77 pdf(paste('yet',i,"anotherplot.pdf",sep='_'))
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
78 plot(foo,bar,main=paste("Foo by Bar plot #",i),col="maroon", pch=3,cex=0.6)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
79 dev.off()
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
80 foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
81 bar = as.matrix(foo)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
82 pdf(paste('yet',i,"anotherheatmap.pdf",sep='_'))
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
83 heatmap(bar,main='Random Heatmap')
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
84 dev.off()
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
85 }
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
86
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
87 # A slight variation taking an input tabular file from which we read the first number as nreps
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
88 # his script takes a single parameter
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
89 # number of replicates
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
90
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
91 .. code-block:: R
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
92
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
93 ourargs = commandArgs(TRUE)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
94 infname = ourargs[1]
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
95 nreps = read.table(infname,head=F)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
96 nreps = unlist(nreps)[1]
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
97 nreps = max(c(1,nreps))
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
98 nreps = min(c(20,nreps))
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
99 print(paste("Using nreps=",nreps))
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
100 for (i in 1:nreps) {
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
101 foo = runif(100)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
102 bar = rnorm(100)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
103 bar = foo + 0.2*bar
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
104 pdf(paste("yet",i,"anotherplot.pdf",sep="_"))
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
105 plot(foo,bar,main=paste("Foo by Bar plot ",i),col="maroon", pch=3,cex=0.6)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
106 dev.off()
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
107 foo = data.frame(a=runif(100),b=runif(100),c=runif(100),d=runif(100),e=runif(100),f=runif(100))
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
108 bar = as.matrix(foo)
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
109 pdf(paste("yet",i,"anotherheatmap.pdf",sep="_"))
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
110 heatmap(bar,main="Random Heatmap")
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
111 dev.off()
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
112 }
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
113
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
114 A Python example that reverses each row of a tabular file (you'll need to remove the leading spaces
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
115 for this to work if cut and pasted into the script box)::
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
116
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
117 # reverse order of columns in a tabular file
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
118 import sys
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
119 inp = sys.argv[1]
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
120 outp = sys.argv[2]
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
121 i = open(inp,'r')
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
122 o = open(outp,'w')
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
123 for row in i:
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
124 rs = row.rstrip().split('\t')
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
125 rs.reverse()
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
126 o.write('\t'.join(rs))
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
127 o.write('\n')
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
128 i.close()
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
129 o.close()
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
130
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
131 A trivial shell script example to show that it works::
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
132
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
133 #!/bin/bash
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
134 INF=$1
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
135 OUTF=$2
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
136 cut -c2,4,6,8,10,12 $INF > $OUTF
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
137
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
138 A trivial perl script example to show that even perl works::
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
139
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
140 #
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
141 # change all occurances of a string in a file to another string
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
142 #
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
143 $oldfile = $ARGV[0];
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
144 $newfile = $ARGV[1];
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
145 $old = "gene";
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
146 $new = "foo";
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
147 open(OF, $oldfile);
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
148 open(NF, ">$newfile");
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
149 # read in each line of the file
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
150 while ($line = <OF>) {
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
151 $line =~ s/$old/$new/;
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
152 print NF $line;
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
153 }
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
154 close(OF);
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
155 close(NF);
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
156
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
157 ]]>
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
158
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
159 **Citation**
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
160
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
161
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
162 Paper_ :
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
163
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
164 Creating re-usable tools from scripts: The Galaxy Tool Factory
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
165 Ross Lazarus; Antony Kaspi; Mark Ziemann; The Galaxy Team
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
166 Bioinformatics 2012; doi: 10.1093/bioinformatics/bts573
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
167
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
168
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
169 **Licensing**
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
170
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
171 Copyright Ross Lazarus (ross period lazarus at gmail period com) May 2012
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
172 All rights reserved.
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
173 Licensed under the LGPL_
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
174
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
175 .. _LGPL: http://www.gnu.org/copyleft/lesser.html
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
176 .. _Docker_toolfactory: https://bitbucket.org/mvdbeek/dockertoolfactory
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
177 .. _Issues: https://bitbucket.org/mvdbeek/dockertoolfactory/issues
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
178 .. _Paper: http://bioinformatics.oxfordjournals.org/cgi/reprint/bts573?ijkey=lczQh1sWrMwdYWJ&amp;keytype=ref
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
179
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
180 </help>
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
181 <citations>
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
182 <citation type="doi">10.1093/bioinformatics/bts573</citation>
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
183 </citations>
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
184 </xml>
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
185 <xml name="test_data_macro">
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
186 </xml>
21d312776891 planemo upload for repository https://github.com/mvdbeek/docker_scriptrunner/ commit 30f8264cdd67d40dec8acde6407f32152e6a29c1-dirty
mvdbeek
parents:
diff changeset
187 </macro>