Galaxy API
In addition to being accessible through a web interface, Galaxy can also be accessed programmatically, through shell scripts and other programs. The web interface is appropriate for things like exploratory analysis, visualization, construction of workflows, and rerunning workflows on new datasets.
The web interface is less suitable for things like:
- Connecting a Galaxy instance directly to your sequencer and running workflows whenever data is ready
- Running a workflow against multiple datasets (which can be done with the web interface, but is tedious)
- When the analysis involves complex control, such as looping and branching.
The Galaxy API addresses these and other situations by exposing Galaxy internals through an additional interface, known as an Applications Programming Interface, or API.
Enabling
To use the API, you must first generate an API Key for the account you want to access Galaxy from. Please note that this key acts as an alternate means to access your account, and should be treated with the same care as your login password. You can do so in the UI under user preferences (while logged in).
Alternatively You can retrieve your API key by sending baseauth GET request to /api/authenticate/baseauth
Working with API
- Quickstart
- API source code documentation - Documentation auto-generated for the API source code. The API source code itself can be found here and is by its nature the most up-to-date and complete source of information.
- The BioBlend documentation is the most updated and best documented source of information on consuming the Galaxy API.
Programming Language Bindings
Various language specific libraries for interfacing with the Galaxy API have been developed by the Galaxy community:
-
BioBlend contains a set of Python bindings
- BioBlend: automating pipeline analyses within Galaxy and CloudMan. Sloggett, et. al.
- BioBlend.objects: metacomputing with Galaxy. Leo, et. al.
- Parsec is a CLI tool that will allow you to use Galaxy from command line.
- blend4j contains Java bindings largely modeled after BioBlend. JavaDocs
- blend4php contains PHP bindings.
- The Galaxy code itself contains JavaScript bindings.
Examples
Code
Many examples and API utility scripts are shipped with Galaxy and BioBlend. You can browse them here and here respectively.
Open Source Projects
- Refinery (builds and runs workflows using bioblend)
- The Galaxy IPython Docker Runtime (leverages bioblend to interface with Galaxy's history).
- Molgenis (supports exporting to Galaxy via blend4j)
- trait_workflow_runner (used to run Galaxy workflows from transMART via blend4j).
- clj-blend (a Clojure library built on blend4j).
HTTP Methods
HTTP methods correspond to operations in Galaxy. Operations are implemented as standalone scripts (in scripts/api/) and as routines in scripts/api/common.py.
HTTP Method | common.py Routine | Standalone |
---|---|---|
GET | display() | display.py |
PUT | update() | update.py |
POST | submit() | create.py |
DELETE | delete() | delete.py |
Galaxy's API behind a proxy
You have to make sure that the API calls are passing through the proxy by adding the following lines to the Apache config file:
<Location "/api">
Satisfy Any
Allow from all
</Location>
Replace /api
with /api/galaxy
when serving Galaxy at a sub directory (such as /galaxy/
).