Introduction
The Swift-Galaxy integration project aims to build tools which can be used to
leverage the best features of Swift and
Galaxy combined. We start with building a generic
Galaxy tool, called foreach
which allows user to compose Galaxy workflows
such that each computation stage in the workflow is executed by Swift. User can
compose Galaxy tool and pick up arbitrary executables and dataset to run the
executable over. User can also run the executable over a list of items such as
string or file parameters.
Note
|
This document can be found here. |
Swift-Galaxy foreach
Mechanism
The basic mechanism is that the tool user-interface will accept parameters and
will pass them along to a backend Swift "generator". This generator program
will run the parameters over Swift source and configuration templates. As a
result, the right source and configuration files are produced in a temporary
directory (/tmp/tmpname
). This is then executed and the results collected.
There are two ways the foreach
Swift tool can be utilized. First, over a range
of numbers. The tool is used to run any arbitrary executable via Swift foreach
loop over a range of numbers. The executable will run with number in range as
commandline argument, one at a time. Furthermore, user can add arbitrary string
arguments in addition to the number argument to the call to executable.
The second way runs the foreach
loop over a list of items read from an input
file. These items can be file references or simple strings. The tool will pass
one item at a time to the executable as argument parameter and run them all in
parallel. This is similar to the above described number range except that the
iteration takes place over a list of items provided as a file.
Installation
This installation recipe assumes that you have Galaxy preinstalled. If not, installation instructions for Galaxy can be found here.
Step 0. Checkout the swift-galaxy SVN directory as follows:
svn co https://svn.ci.uchicago.edu/svn/vdl2/SwiftApps/swift-galaxy
Step 1. Create a symbolic link to the swift-galaxy/swift
directory from
galaxy’s tools
directory. For example, if Galaxy top level directory is
galaxy-dist
and swift directory is $HOME/swift-galaxy/swift:
cd galaxy-dist/tools
ln -s $HOME/swift-galaxy/swift swift
The advantage of symbolic links is that as users update the tool directory via
svn up
, they need not worry about reinstallation. Updates in installation
gets automatically propagated to Galaxy.
Step 2. Add the tool definitions of the tools contained in this Swift to
Galaxy’s tool_conf.xml. This can be done by copying the text in
<section>...</section>
from the tool_conf.xml in swift-galaxy directory and
paste it to the tool_conf.xml of the Galaxy directory. In the current installation, the text to be copied is:
<section name="swift" id="swift">
<tool file="swift/genswift.xml" />
<tool file="swift/genericswift.xml" />
<tool file="swift/swiftforeach.xml" />
</section>
Step 3. (Re)start Galaxy.
sh run.sh
In the Galaxy Web GUI, you should see the tools in a toolset titled Swift.
Screenshots
The following screenshot shows overall look-and-feel of the Swift-Galaxy tool in the Galaxy web GUI.
The rest of this section walks you through each of the components shown in the above screen and their utility. The following screenshot shows execution location selector. User can select one or more execution locations from the list as their target execution site.
The following screenshot shows a dialog box to add Swift-level commandline arguments to be passed to the script.
The following screenshot shows a selection dropdown list to chose the execution interpreter from. The interpreters currently supported and tested are shell, java and python. Upcoming are R and matlab.
The following screenshot shows the selection for an executable. User can upload an executable and select it from the list.
The following screenshot shows a selection for range of numbers or list of items to chose from. User can select one and the corresponding dialog box will appear below.
The following screenshot shows a dialog for string or file type arguments. A user can add string and filetype arguments to their executable and the commandline will be built accordingly.
The following screenshot shows a dialog box to enter the directory location for results of execution. The Swift output files will be placed here:
An example
A simple Hello World Swift tool to run with Galaxy.
To set up with your Galaxy environment follow the steps below: Prerequisite: Sun/Oracle java. Should work with IBM java but not tested. To test your java version:
java -version
Typical output is:
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
Step 1. Download and install Swift where Galaxy server is running. From a command prompt the following wget will pull the latest release from here.
Step 2. SVN checkout the swift-galaxy directory and copy the Swift tool directory to Galaxy’s tools directory:
svn co https://svn.ci.uchicago.edu/svn/vdl2/SwiftApps/swift-galaxy
cp -r swift-galaxy/swift /location/of/galaxy-server/tools/
Step 3. Edit the tool_conf.xml
file present at the top-level of galaxy directory tree to add the following lines between the <toolbox>
and </toolbox>
xml tags:
<section name="swift-galaxy" id="swift-galaxy">
<tool file="currdir/nameoftoolfile.xml" />
</section>
Step 4. Restart the Galaxy server. The swift-galaxy tool should be available in the tool box of Galaxy GUI.
Step 5. Invoke it by entering any number in the dialog box or leaving it to default.
Step 6. For examples of other Galaxy-Swift tools, look into the swift directoty.
Troubleshoot
Each tool generates a set of Swift source and configuration files. These files are placed in a unique directory with a random name generated on the fly. The location of the directory is in /tmp
and it is prefixed with name swift-gal.
. The suffix is a four letter random number. You can run Swift from this directory to reproduce possible issues as follows:
swift -tc.file tc -sites.file sites.xml -config cf script.swift
Feel free to contact Swift support if issues persist.
Upcoming Features
-
Mixing the order of file and string arguments
-
Optionally allowing user to not use range number as arguments
-
Providing more Swift patterns, eg.
if-else
conditionals