Difficulties wrapping r script with r_wrapper.sh

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Difficulties wrapping r script with r_wrapper.sh

Jeremy Liu
Hi all,

I have been trying to wrap a test r script into my local galaxy install using r_wrapper.sh but have been running with problems. When I run the tool, I get the following error in the side bar. For reference, I've pasted the xml file below.

Error: 
Error in file(file, "rt") : cannot open the connection Calls: read.table -> file Error during wrapup: object 'l' not found Lost warning messages Execution halted

The xml file:
<tool id="r_script_test" name="Test R Script">
  <description>for proof of concept</description>
  <command interpreter="bash">r_wrapper.sh $script_file</command>
  <inputs>
    <param name="in_data" type="data" format="tabular" label="Test source file"/>
  </inputs>
  <outputs>
    <data name="out_data" format="tabular" />
  </outputs>
  <configfiles>
    <configfile name="script_file">
      ## Setup R error handling to go to stderr
      options(show.error.messages=F, 
        error = function() { cat(geterrmessage(), file=stderr()); 
        q( "no", l, F)})

      ## Read in tab file
      data1 = read.table("{$in_data}", sep="\t")

      ## Output tab file 
      write.table(data1, file="{$out_data}", quote=FALSE, sep="\t", eol = "\n", row.names=FALSE, col.names=FALSE)

      ## Close the session
      dev.off()
    </configfile>
  </configfiles>

  <help>
    This tools tests a R script to do simple file I/O
  </help>
 
</tool>

I have r_wrapper.sh copied in the same directory as the xml file. Any help would be appreciated!

Thanks!
Jeremy Liu

___________________________________________________________
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/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: Difficulties wrapping r script with r_wrapper.sh

Ross-2
This syntax  
write.table(data1, file="{$out_data}", 
might not do what you expect. The $ has to be outside the braces, but they're not needed there anyway - something like this might work better:

write.table(data1, file="$out_data",..

When things don't work, it's always useful to check the contents written into that configfile script by setting job cleanup to never and taking a look at the temporary folder noted in the galaxy log.


On Tue, Jun 24, 2014 at 2:35 AM, Jeremy Liu <[hidden email]> wrote:
Hi all,

I have been trying to wrap a test r script into my local galaxy install using r_wrapper.sh but have been running with problems. When I run the tool, I get the following error in the side bar. For reference, I've pasted the xml file below.

Error: 
Error in file(file, "rt") : cannot open the connection Calls: read.table -> file Error during wrapup: object 'l' not found Lost warning messages Execution halted

The xml file:
<tool id="r_script_test" name="Test R Script">
  <description>for proof of concept</description>
  <command interpreter="bash">r_wrapper.sh $script_file</command>
  <inputs>
    <param name="in_data" type="data" format="tabular" label="Test source file"/>
  </inputs>
  <outputs>
    <data name="out_data" format="tabular" />
  </outputs>
  <configfiles>
    <configfile name="script_file">
      ## Setup R error handling to go to stderr
      options(show.error.messages=F, 
        error = function() { cat(geterrmessage(), file=stderr()); 
        q( "no", l, F)})

      ## Read in tab file
      data1 = read.table("{$in_data}", sep="\t")

      ## Output tab file 
      write.table(data1, file="{$out_data}", quote=FALSE, sep="\t", eol = "\n", row.names=FALSE, col.names=FALSE)

      ## Close the session
      dev.off()
    </configfile>
  </configfiles>

  <help>
    This tools tests a R script to do simple file I/O
  </help>
 
</tool>

I have r_wrapper.sh copied in the same directory as the xml file. Any help would be appreciated!

Thanks!
Jeremy Liu

___________________________________________________________
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/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/


___________________________________________________________
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/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/