I’m working on a very simple tool.
<tool id="gc_stat" name="GC Stat" version="0.1.0">
<requirements>
<requirement type="binary">Rscript</requirement>
<requirement type="package" version="1.1">samtools</requirement>
<requirement type="package" version="3.0.3">R</requirement>
</requirements>
<stdio>
<exit_code range="1:" />
</stdio>
<command><![CDATA[
samtools view $bam | Rscript simple_script.R > $output
]]></command>
<inputs>
<param name='bam' type='data' format='bam' label='Mapped reads' help='BAM files'/>
</inputs>
<outputs>
<data format='tabular' name='output' label='GC Statistic on ${on_string}'/>
</outputs>
<help><![CDATA[
Calculates a GC statistic for the specified BAM file.
]]></help>
</tool>
this won’t work because Rscript is not running in the tool install directory and can’t find simple_script.R…
and it seems that I have to add another file…
<?xml version="1.0"?>
<tool_dependency>
<set_environment version="1.0">
<environment_variable name="TOOL_INSTALL_DIR" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable>
</set_environment>
</tool_dependency>
and add a set_enviornment dependency to bring it in.
<requirements>
...
<requirement type="set_environment">TOOL_INSTALL_DIR</requirement>
</requirements>
<command><![CDATA[
samtools view $bam | Rscript $TOOL_INSTALL_DIR/simple_script.R > $output
]]></command>
I did that but the tool still won’t execute, in fact the .
Maybe because I have to put this into a toolshed - or maybe I’ve done something wrong?
I think this complexity could be avoided by setting an TOOL_INSTALL_DIR environment var as a tool is executed (though John doesn’t seem to like that idea due to a responsibility mixing issue)
I think it’s a worthy goal to make tool development as frictionless as possible.
Is there a simpler way to do this?
Brad