Hello David,

I've just committed change set 7656:6aadac8026cb to the Galaxy central repository that provides the ability to do what you need here.  It would be great if you could try things out and let me know if you run into any problems.  

I've been working with nikhil-joshi's deseq_and_sam2counts repository in the main Galaxy tool shed because his tools require this new feature as well.  This example should provide you with the information you'll need to tweak your tool shed repository so that your tool dependencies are located where they get installed rather than attempting to move them to ${GALAXY_DATA_INDEX_DIR} or some other location.

Here is the tool_dependency.xml file entry for locating a directory referred to by an environment variable name R_SCRIPT_PATH.

<?xml version="1.0"?>
    <set_environment version="1.0">
        <environment_variable name="R_SCRIPT_PATH" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable>

The <set_enviroment> tag, is still supported inside <package> tag sets, but when defined at the xml root level, it will locate dependencies included in the installed tool shed repository.  Of course, the above tool_dependencies.xml file could of course also include entries for tool dependencies that are packages, For example:

<?xml version="1.0"?>
    <set_environment version="1.0">
        <environment_variable name="R_SCRIPT_PATH" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable>
    <package name="R" version="2.15.1">
        <install version="1.0">
                <action type="download_by_url">http://CRAN.R-project.org/src/base/R-2/R-2.15.1.tar.gz</action>
                <action type="shell_command">./configure --prefix=$INSTALL_DIR</action>
                <action type="shell_command">make</action>
                <action type="set_environment">
                    <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable>
You need a FORTRAN compiler or perhaps f2c in addition to a C compiler to build R.

These tool dependency definitions are handled as described in the following section of the tool shed wiki:


So in order for the dependencies to be handled when the repository is installed, they must be defined in at least one of the <requirement> tag sets in at least 1 tool config in the repository.  So, the <requirements> tag set in the deseq.xml tool config file will look something like this (there are more requirement tags defined here than in the tool_dependencies.xml fiel above, but you should get the idea).

        <requirement type="set_environment">R_SCRIPT_PATH</requirement>
        <requirement type="package" version="2.15.1">R</requirement>
        <requirement type="package" version="2.10">Bioconductor</requirement>
        <requirement type="package" version="1.8.3">DESeq</requirement>
        <requirement type="package" version="1.24.0">aroma.light</requirement>
        <requirement type="package" version="0.20-6">lattice</requirement>

The <command> tag set in the deseq.xml tool config is also slightly altered.  Here is the way it looks before using this new approach:

<command interpreter="python">
         stderr_wrapper.py Rscript ${GALAXY_DATA_INDEX_DIR}/deseq.R $counts $column_types $comparison $top_table $diagnostic_html "$diagnostic_html.files_path" "$counts.name"

To use this new feature, the command string now uses the R_SCRIPT_PATH environment variable ( notice the required backslash to escape the $ )

<command interpreter="python">
    stderr_wrapper.py Rscript \$R_SCRIPT_PATH/deseq.R $counts $column_types $comparison $top_table $diagnostic_html "$diagnostic_html.files_path" "$counts.name"

When installed from the tool shed, a tool dependency object named R_SCRIPT_PATH will be created and associated with the installed repository.  The dependency will have a pointer to the env.sh file that is created to set the value of the R_SCRIPT_PATH environment variable.

Let me know if you bump into any issues in getting this working for your tools.


Greg Von Kuster

On Sep 12, 2012, at 1:00 PM, David Hoover wrote:

Are there any environment variables that are honored by toolshed installed tools?  I tried creating a tool that uses ${GALAXY_DATA_INDEX_DIR} or $GALAXY_HOME, then uploaded it the test toolshed, then installed it automatically.  Neither of these resolved to what I expected.  I don't want to hard-code the path in the xml tool file, but rather have a default location for other executables and jar files.  How should this best be done?

David Hoover
Helix Systems Staff
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: