On Tue, Oct 12, 2010 at 11:15 AM, Peter <peter@maubp.freeserve.co.uk> wrote:
On Tue, Oct 12, 2010 at 10:43 AM, Freddy <freddy.debree@wur.nl> wrote:
Hi Peter,
Running R from xml is not so straight forward to me. Is the interpreter "bash" or is it "R"? If "bash" then it should be running "R --vanilla --slave input < Rscript > output" if "R" then it should be running ? smthg like "source(Rscript)"
Hope you can help...
Freddy
Consider a simple R script, hello_world.R like this:
print('Hello world'); print(commandArgs());
Then in Galaxy I think you'd need the default interpreter ("bash") and the command to be:
R --vanilla --file=hello_world.R --args "Args go here"
I'm assuming your script will write useful output to a file, and stdout can be discarded.
However, what I originally had in mind was setting the hash bang and executable bit with chmod so that you can do this at the command line:
./hello_world.R "Args go here"
Once that works, calling it from Galaxy should be trivial. I think one way to do this is with the little r package: http://code.google.com/p/littler/
Peter
Hi Freddy, I missed your earlier email about the r_wrapper.sh script that comes with Galaxy, used like this where an R script is created at run time from the XML wrapper using a moderately complex Cheater template: $ grep r_wrapper.sh tools/*/*.xml tools/plotting/xy_plot.xml: <command interpreter="bash">r_wrapper.sh $script_file</command> tools/stats/lda_analy.xml: <command interpreter="sh">r_wrapper.sh $script_file</command> tools/stats/plot_from_lda.xml: <command interpreter="sh">r_wrapper.sh $script_file</command> In these examples only the script name is passed (all the variable information is inside the dynamically generated script file). However, reading the shell script it *should* accept more than one input, but the first input is interpreted as the script name. Maybe that doesn't work since you said you tried it? Clearly there are several ways to approach this (r_wrapper.sh, rpy from python, etc). Guidance from the Galaxy developers on what they consider to be best practice would be welcome. Peter