Hi, Is there a way to pipe in the same xml wrapper two scripts in different languages, the output of the first script becoming the input of the second ? I know that the spirit of galaxy would be to make a workflow, but the intermediate output in the present case is not interesting at all and may confuse the user. I am testing something like : <command interpreter="python">plotter.py $input $minsize $maxsize $factor $output</command> <command interpreter="bash">r_wrapper.sh $Rplotter</command> <inputs> <param name="input" type="data" format="tabular" label="Compute Plot table from this bowtie standard output"/> <param name="minsize" type="integer" size="3" value="20" label="Min size of small RNA to plot" help="'20' = 20 nucleotides"/> <param name="maxsize" type="integer" size="3" value="22" label="Max size of small RNA to plot" help="'22' = 22 nucleotides"/> <param name="factor" type="float" size="6" value="1.00" label="Normalization factort" help="leave at 1.00 for no normalization"/> <param name="title" type="text" size="15" value="Main Title" label="Main Titles"/> <param name="xlabel" type="text" size="15" value="Coordinates (nt)" label="x axis label"/> <param name="ylabel" type="text" size="15" value="Normalized number of reads" label="y axis label"/> <param name="yrange" type="integer" size="6" value="400" label="y axis range"/> </inputs> <configfiles> <configfile name="Rplotter"> ## Setup R error handling to go to stderr options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) tab = read.delim("${output}", header=TRUE) ## Open output PDF file pdf( "${outputFinal}" ) #determining y and x axis ranges MAXcoord = max(tab[,1]) + 100 MINcoord = min(tab[,1]) MMAX = ${yrange} plot(tab[,1], tab[,2], type="h", xaxt="n", xlim=c(MINcoord , MAXcoord), ylim=c(-MMAX , MMAX), frame.plot=FALSE, lwd=2, las=2, xlab= "${xlabel}", ylab="${ylabel}", main = "${title}") lines(tab[,1], tab[,3], type="h", lwd=2) axis(1) ## Close the PDF file devname = dev.off() </configfile> </configfiles> <outputs> <data name="output" format="tabular" label= "Data Frame"/> <data name="outputFinal" format="pdf" label= "PDF plot"/> </outputs> but the second script output is empty. I suspect that the second script is launched when the output of the first script is not available yet. Thanks for the help Chris
I think you could write a bash wrapper script around your tool, or if it's very simple, just switch from command interperter="python" to bash with command python plotter.py variables ; r_wrapper.sh $Rplotter using a semicolon to delineate the two commands. Brad On Nov 18, 2012, at 1:13 PM, Christophe Antoniewski <drosofff@gmail.com<mailto:drosofff@gmail.com>> wrote: Hi, Is there a way to pipe in the same xml wrapper two scripts in different languages, the output of the first script becoming the input of the second ? I know that the spirit of galaxy would be to make a workflow, but the intermediate output in the present case is not interesting at all and may confuse the user. I am testing something like : <command interpreter="python">plotter.py $input $minsize $maxsize $factor $output</command> <command interpreter="bash">r_wrapper.sh $Rplotter</command> <inputs> <param name="input" type="data" format="tabular" label="Compute Plot table from this bowtie standard output"/> <param name="minsize" type="integer" size="3" value="20" label="Min size of small RNA to plot" help="'20' = 20 nucleotides"/> <param name="maxsize" type="integer" size="3" value="22" label="Max size of small RNA to plot" help="'22' = 22 nucleotides"/> <param name="factor" type="float" size="6" value="1.00" label="Normalization factort" help="leave at 1.00 for no normalization"/> <param name="title" type="text" size="15" value="Main Title" label="Main Titles"/> <param name="xlabel" type="text" size="15" value="Coordinates (nt)" label="x axis label"/> <param name="ylabel" type="text" size="15" value="Normalized number of reads" label="y axis label"/> <param name="yrange" type="integer" size="6" value="400" label="y axis range"/> </inputs> <configfiles> <configfile name="Rplotter"> ## Setup R error handling to go to stderr options( show.error.messages=F, error = function () { cat( geterrmessage(), file=stderr() ); q( "no", 1, F ) } ) tab = read.delim("${output}", header=TRUE) ## Open output PDF file pdf( "${outputFinal}" ) #determining y and x axis ranges MAXcoord = max(tab[,1]) + 100 MINcoord = min(tab[,1]) MMAX = ${yrange} plot(tab[,1], tab[,2], type="h", xaxt="n", xlim=c(MINcoord , MAXcoord), ylim=c(-MMAX , MMAX), frame.plot=FALSE, lwd=2, las=2, xlab= "${xlabel}", ylab="${ylabel}", main = "${title}") lines(tab[,1], tab[,3], type="h", lwd=2) axis(1) ## Close the PDF file devname = dev.off() </configfile> </configfiles> <outputs> <data name="output" format="tabular" label= "Data Frame"/> <data name="outputFinal" format="pdf" label= "PDF plot"/> </outputs> but the second script output is empty. I suspect that the second script is launched when the output of the first script is not available yet. Thanks for the help Chris ___________________________________________________________ Please keep all replies on the list by using "reply all" in your mail client. To manage your subscriptions to this and other Galaxy lists, please use the interface at: http://lists.bx.psu.edu/ -- Brad Langhorst langhorst@neb.com<mailto:langhorst@neb.com>
On Sun, Nov 18, 2012 at 1:13 PM, Christophe Antoniewski <drosofff@gmail.com> wrote:
but the second script output is empty. I suspect that the second script is launched when the output of the first script is not available yet.
I'm pretty sure we do not currently support multiple "command" tags. However whatever is in the command text is always run through a shell (sh), so you can use pipes and such directly, just don't specify interpreter at all: <command>python plotter.py $input $minsize $maxsize $factor $output | bash r_wrapper.sh $Rplotter</command> ...should work.
Yes it is working too, avoiding an additional wrapper. Yet, strangely enough, the absolute paths are required in the command line: <command >python /home/galaxy/galaxy-dist/tools/chrisTools/plotter.py $input $minsize $maxsize $factor $output |bash /home/galaxy/galaxy-dist/tools/chrisTools/r_wrapper.sh $Rplotter</command> The galaxy has still some mysteries ;-) Chris 2012/11/19 James Taylor <james@jamestaylor.org>
On Sun, Nov 18, 2012 at 1:13 PM, Christophe Antoniewski <drosofff@gmail.com> wrote:
but the second script output is empty. I suspect that the second script is launched when the output of the first script is not available yet.
I'm pretty sure we do not currently support multiple "command" tags. However whatever is in the command text is always run through a shell (sh), so you can use pipes and such directly, just don't specify interpreter at all:
<command>python plotter.py $input $minsize $maxsize $factor $output | bash r_wrapper.sh $Rplotter</command>
...should work.
-- ¡ Note that my email address has changed ! ¡ Please update your records with ! ¡ *christophe.antoniewski@snv.jussieu.fr*<christophe.antoniewski@snv.jussieu.fr>! -- Christophe Antoniewski Drosophila Genetics and Epigenetics Laboratoire de Biolologie du Développement 9, Quai St Bernard, Boîte courrier 24 75252 Paris Cedex 05 Tel +33 1 44 27 34 39 Fax +33 1 44 27 34 45 Mobile +33 6 68 60 51 50 http://drosophile.org
participants (4)
-
Christophe Antoniewski
-
Christophe Antoniewski
-
James Taylor
-
Langhorst, Brad