Question: Empty table output
0
gravatar for hortowe
2.7 years ago by
hortowe10
hortowe10 wrote:

Hi all,

I'm attempting to run an Rscript that outputs a few tables, but can't get that to work. I then created a super simple test script that just prints a table, but the output is empty. When I go to the tool on the galaxy interface, I run it and everything works fine, but when I click on the output in my history, it says it is empty. One potential issue is that the path to the output file is a directory outside of the galaxy install...not sure if there is a specific place within galaxy that I should point to.

Script:

foo <- matrix(seq(1:100), nrow=10, ncol=10)

out.file <- "/path/to/output/test.txt"

write.table(foo, sep="\t", file=out.file, row.names=F)

xml:

<tool id="test" name="Testing" version="0.1">

<description>Print a table.</description>

<command>R --vanilla --file=/path/to/galaxy/tools/my_tools/test.R --args $out </command>

<inputs> </inputs>

<outputs>

<data name="out" format="tabular" label="Test output"/>

</outputs>

</tool>

Here is what I see on my galaxy interface: Palm Springs commercial photography

galaxy • 681 views
ADD COMMENTlink modified 2.7 years ago by Hotz, Hans-Rudolf1.8k • written 2.7 years ago by hortowe10
3
gravatar for Hotz, Hans-Rudolf
2.7 years ago by
Switzerland
Hotz, Hans-Rudolf1.8k wrote:

Hi

looks like you are mixing up two things..... what do you want to achieve? Do you want the output as a Galaxy history item or do you want to store the data outside of the Galaxy tree?

Normally, you want the data as a Galaxy history item (and I assume this is what you want, since you 'complain' about the empty output). Hence, you have to read the arguments (i.e "$out") in your R script.

Your example R script will then look like:

foo <- matrix(seq(1:100), nrow=10, ncol=10)

out.file <- commandArgs(trailingOnly = TRUE)

write.table(foo, sep="\t", file=out.file, row.names=F)

Be careful, this works only as long as you have just one argument. If you have more than one argument 'commandArgs' will give you a character vector of those arguments (see also '?commandArgs')

Hope this helps, Hans-Rudolf

ADD COMMENTlink written 2.7 years ago by Hotz, Hans-Rudolf1.8k

Hanz,

That worked like a charm, thank you! I am looking to have more than one argument eventually, but I believe I saw a few questions and maybe a wiki entry about it that I will check out. Thanks again.

ADD REPLYlink written 2.7 years ago by hortowe10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 181 users visited in the last hour