Galaxy Tool Development and Deployment

Preparing a Tool

What follows is a specific example of how to prepare a tool for inclusion in Galaxy.

Acquiring the Sources

As a staging area for the sources you wish to acquire, it is recommended you move out of the Galaxy installation directory.

$ cd /opt/sw/Galaxy

In this example, two Git repositories are cloned.

$ git clone
Cloning into screed...
remote: Counting objects: 1821, done.
remote: Compressing objects: 100% (661/661), done.
remote: Total 1821 (delta 1192), reused 1758 (delta 1136)
Receiving objects: 100% (1821/1821), 372.63 KiB, done.
Resolving deltas: 100% (1192/1192), done.
$ git clone
Cloning into khmer...
remote: Counting objects: 7450, done.
remote: Compressing objects: 100% (2363/2363), done.
remote: Total 7450 (delta 5197), reused 7262 (delta 5025)
Receiving objects: 100% (7450/7450), 62.33 MiB | 724 KiB/s, done.
Resolving deltas: 100% (5197/5197), done.

Building Eggs

If you have a distutils-based Python package, then you can apply a patch similar to following to use the setuptools package, which should have been installed into your Python virtual environment.

diff --git a/python/ b/python/
index 4ff584a..94326c7 100644
--- a/python/
+++ b/python/
@@ -1,4 +1,7 @@
-from distutils.core import setup, Extension
+    from setuptools import setup, Extension
+except ImportError:
+    from distutils.core import setup, Extension

 # the c++ extension module (needs to be linked in with ktable.o ...)
 extension_mod = Extension("khmer._khmermodule",

Build the egg(s) for your Python package. For example:

$ (cd screed && python bdist_egg)
$ (cd khmer && make && cd python && python bdist_egg)

Yes, python install could be used to install the packages into the Python virtual environment which we are using. However, the intention is to simulate how Galaxy would use Python eggs in a production environment. For this purpose, we want to have eggs on hand.

Copy the eggs into Galaxy’s egg basket. For example:

$ cp khmer/python/dist/khmer-0.4-py2.7-linux-x86_64.egg galaxy-dist/eggs
$ cp screed/dist/screed-0.7-py2.7.egg galaxy-dist/eggs

Development of New Tools

Creating Tool Categories

Before you can place any tools into your tool shed, you need to provide one or more categories in which the tools can be placed. To do this, login to the tool shed server. Click on the Admin menu in the menu bar across the top of the web page. A sidebar with various administrative tasks will present itself. Find the Categories section and click on the Manage categories link. You should see a Categories frame appear. In the upper right-hand corner of the frame is a button labeled Add new category. Create categories, have fun.

Adding a New Tool Repository

Once you have created your desired categories, click on the Repositories menu in the menu bar along the top of the web page. A sidebar with various repository-related actions should appear. Find the Available Actions section and click on the Create new repository link. Fill out the required metadata and then click the Save button. You should get a message indicating that your repository has been created. In the upper, right-hand corner of the resulting frame, you should notice a button, labeled Upload files to repository. Click on this button. You can upload a plain Unix tar file or a gzip- or bzip2-compressed variant thereof.

Editing a Tool Repository

Your first tool shed’s repository is stored at database/community_files/000/repo_1. For your convenience, you can edit the repository’s files directly in that location. When you are finished, you should commit your changes as the user who created the repository.

$ hg ci -u eric -m "Fix directory structure."


In the above, you will want to replace the argument to the -u option with the display name of your Galaxy user account. When you registered for the account, this was the fourth field that you were asked to fill out; it is not your email address.

Refreshing Tool Shed Records

After you commit changes, you need to make the Galaxy tool shed database aware of the changes. To do this, you need to be viewing your repository. In the upper, right corner of the frame, there is a Respository Actions button. Click on this button and select the Reset all respository metadata menu itme from the dropdown menu. (This is not as scary as it sounds.)

Deployment of New Tools

Staging a Tool to the Main Galaxy Server

Once you have developed something that you are satisfied with, you may wish to stage it over to the main Galaxy server. To do this, switch over to your web page for the main server and go into the administrator tasks. Select the Browse repositories menu item from the dropdown menu for your tool shed. You should see the tool repository that you added in the category to which you added it. Click on the button bearing the name of your tool repository and select the Preview and install menu item. In the upper, right corner of the resulting frame, click on the Install to local Galaxy button.

That’s it. If everything worked, then your tool should appear under the category which you selected in the sidebar associated with the Analyze Data menu.