For Power-Users‎ > ‎

4. Wrapping a tool in FACE-IT

This section will go through the steps required to add an application. The application we'll be working with is called "clim_anomaly".
  1. SSH into dev.usefaceit.org as the galaxy user. If you need access, please send a request to the faceit mailing list.

  2. Every tool needs a unique directory for each available version. Create a directory for your tool in /mnt/galaxyTools:

       $ mkdir /mnt/galaxyTools/clim_anomaly
       $ mkdir /mnt/galaxyTools/clim_anomaly/1.0.0

  3. Every tool should have a default version. Run the following command in the clim_anomaly directory to a default symlink:

       $ ln -s 1.0.0 default

  4. Copy your tools into the /mnt/galaxyTools/clim_anomaly/1.0.0 directory.

  5. Every tool needs an env.sh script. The env.sh script adds your application directory to $PATH. It also ensures libraries are available to your application. The clim_anomaly example uses Java, and therefore needs to set $CLASSPATH. Here is the new /mnt/galaxyTools/clim_anomaly/1.0/env.sh file:

       $ cat /mnt/galaxyTools/clim_anomaly/1.0.0/env.sh
       export PATH=/mnt/galaxyTools/clim_anomaly/1.0.0:$PATH
       export CLASSPATH=/mnt/galaxyTools/clim_anomaly/1.0.0:$CLASSPATH

  6. Next, create a directory for your Galaxy wrapper. The wrapper directories are located in 
    /opt/galaxy/tools.

       $ mkdir 

    /opt/galaxy/tools

    /clim_anomaly


  7.  Create a Galaxy wrapper in your Galaxy wrapper directory. If you haven't already, please take a few minutes to read about how to do this from the Galaxy documentation.

  8. Add requirements to the Galaxy wrapper. This will tell Galaxy to grab the tools from the /mnt/galaxyTools directory you created. Example:

      <requirements>
        <requirement type="package">clim_anomaly</requirement>
        <requirement type="package">R</requirement>
      </requirements>

    Every application will at least need to require itself. Some scripts will have additional requirements, like in this case, where clim_anomaly requires R.

  9. The command line in your wrapper should always assume that the executable you're running is available in your path. Here is the full wrapper:

    <tool id="clim_anomaly" name="Plot Climate Scenarios Anomaly">
    <description>Climate Anomaly for Scenarios</description>
    <requirements>
    <requirement type="package">clim_anomaly</requirement>
    <requirement type="package">R</requirement>
    </requirements>
    <command>ClimAnomaly.sh $futureacebdata $baseacebdata $climate_variable $pngoutput</command>
    <inputs>
    <param name="futureacebdata" type="data" format="json" label="Input future Survey Data" />
    <param name="baseacebdata" type="data" format="json" label="Input baseline Survey Data" />
    <param name="climate_variable" type="select" label="Climate Variable">
    <option value="TMAX">Maximum Temperature (TMAX)</option>
    <option value="TMIN">Minimum Temperature (TMIN)</option>
    <option value="SRAD">Solar Radiation (SRAD)</option>
    <option value="RAIN">Precipitation (PRCP)</option>
    </param>
    </inputs>
    <outputs>
    <data format="png" name="pngoutput" label="Climate Scenario Anamoly"/>
    </outputs> 
    </tool>


  10. Edit /opt/galaxy/tool_conf.xml and add a reference to the new wrapper you just created. More information about this is included in the Galaxy documentation. We wanted our tool to be created in a new section of tools, so we added the following lines:

    <section id="ria" name="RIA">
       <tool file="clim_anomaly/clim_anomaly.xml" />
    </section>
Restart galaxy by running 'sudo /etc/init.d/galaxy restart' and you should see your tool available.
Comments