Question: Error unavailable variable in Galaxy
0
gravatar for sharma.ram.h
16 months ago by
sharma.ram.h0 wrote:

I have very simple Galaxy wrapper for simple R function. The following mergefun.xml file.

<tool id="mergefun" name="mergefun" version="1.0.0">
  <description>merge two datasets </description>

 <command><![CDATA[
        Rscript ~/Documents/galaxy_development/galaxy/tools/mergefun/mergefun.R --input1 $input1 --input2 $input2 --output $output
    ]]></command>

  <inputs>
    <param name="input1" type="data"
          label="encoded data" help="encoded must be a rda file" 
    />

    <param name="input2" type="data" 
              label="encoded data" help=" must be  rda file" 
    />

  </inputs>

<outputs>
    <data format="tabular" name = "output" label="output" />
</outputs>

  <help>
        merge two datasets 
  </help>
  </tool>

Here is simple R script with the function.

mergefun <- function(input1, input2){
  in1 <- input1
  in2 <- input2
  output <- merge(in1, in2)
  return(output)
}
output <- mergefun(input1=input1, input2=input2)
write.csv(output, file="merged_data.csv")

When I run I am getting the following error.

An error occurred with this dataset:
Error in mergefun(input1 = input1, input2 = input2) : 
  object 'input1' not found
Execution halted

It may be simple error as I am new to galaxy. Help appreciated.

galaxy R • 372 views
ADD COMMENTlink modified 16 months ago by Hotz, Hans-Rudolf1.8k • written 16 months ago by sharma.ram.h0
2
gravatar for Hotz, Hans-Rudolf
16 months ago by
Switzerland
Hotz, Hans-Rudolf1.8k wrote:

Hi

I don't think it is a Galaxy issue. The problem more likely lies in the R script: you don't pass the command line arguments to the script. Have a look at this simple example: https://www.r-bloggers.com/passing-arguments-to-an-r-script-from-command-lines/

Also, the end of your script will probably fail as well, since the data will not be stored as"merged_data.csv" in galaxy. Try:

output.var <- mergefun(input1=input1, input2=input2)

write.csv(output.var, file=output)

I hope this helps, Regards, Hans-Rudolf

ADD COMMENTlink written 16 months ago by Hotz, Hans-Rudolf1.8k
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: 169 users visited in the last hour