Galaxy API Documentation¶
Background¶
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 Application Programming Interface, or API.
Quickstart¶
Log in as your user, navigate to the API Keys page in the User menu, and generate a new API key. Make a note of the API key, and then pull up a terminal. Now we’ll use the display.py script in your galaxy/scripts/api directory for a short example:
% ./display.py my_key http://localhost:4096/api/histories
Collection Members
------------------
#1: /api/histories/8c49be448cfe29bc
name: Unnamed history
id: 8c49be448cfe29bc
#2: /api/histories/33b43b4e7093c91f
name: output test
id: 33b43b4e7093c91f
The result is a Collection of the histories of the user specified by the API key (you). To look at the details of a particular history, say #1 above, do the following:
% ./display.py my_key http://localhost:4096/api/histories/8c49be448cfe29bc
Member Information
------------------
state_details: {'ok': 1, 'failed_metadata': 0, 'upload': 0, 'discarded': 0, 'running': 0, 'setting_metadata': 0, 'error': 0, 'new': 0, 'queued': 0, 'empty': 0}
state: ok
contents_url: /api/histories/8c49be448cfe29bc/contents
id: 8c49be448cfe29bc
name: Unnamed history
This gives detailed information about the specific member in question, in this case the History. To view history contents, do the following:
% ./display.py my_key http://localhost:4096/api/histories/8c49be448cfe29bc/contents
Collection Members
------------------
#1: /api/histories/8c49be448cfe29bc/contents/6f91353f3eb0fa4a
name: Pasted Entry
type: file
id: 6f91353f3eb0fa4a
What we have here is another Collection of items containing all of the datasets in this particular history. Finally, to view details of a particular dataset in this collection, execute the following:
% ./display.py my_key http://localhost:4096/api/histories/8c49be448cfe29bc/contents/6f91353f3eb0fa4a
Member Information
------------------
misc_blurb: 1 line
name: Pasted Entry
data_type: txt
deleted: False
file_name: /Users/yoplait/work/galaxy-stock/database/files/000/dataset_82.dat
state: ok
download_url: /datasets/6f91353f3eb0fa4a/display?to_ext=txt
visible: True
genome_build: ?
model_class: HistoryDatasetAssociation
file_size: 17
metadata_data_lines: 1
id: 6f91353f3eb0fa4a
misc_info: uploaded txt file
metadata_dbkey: ?
And now you’ve successfully used the API to request and select a history, browse the contents of that history, and then look at detailed information about a particular dataset.
For a more comprehensive Data Library example, set the following option in your galaxy.ini as well, and restart galaxy again:
admin_users = you@example.org
library_import_dir = /path/to/some/directory
In the directory you specified for ‘library_import_dir’, create some subdirectories, and put (or symlink) files to import into Galaxy into those subdirectories.
In Galaxy, create an account that matches the address you put in ‘admin_users’, then browse to that user’s preferences and generate a new API Key. Copy the key to your clipboard and then use these scripts:
% ./display.py my_key http://localhost:4096/api/libraries
Collection Members
------------------
0 elements in collection
% ./library_create_library.py my_key http://localhost:4096/api/libraries api_test 'API Test Library'
Response
--------
/api/libraries/f3f73e481f432006
name: api_test
id: f3f73e481f432006
% ./display.py my_key http://localhost:4096/api/libraries
Collection Members
------------------
/api/libraries/f3f73e481f432006
name: api_test
id: f3f73e481f432006
% ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006
Member Information
------------------
synopsis: None
contents_url: /api/libraries/f3f73e481f432006/contents
description: API Test Library
name: api_test
% ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents
Collection Members
------------------
/api/libraries/f3f73e481f432006/contents/28202595c0d2591f61ddda595d2c3670
name: /
type: folder
id: 28202595c0d2591f61ddda595d2c3670
% ./library_create_folder.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents 28202595c0d2591f61ddda595d2c3670 api_test_folder1 'API Test Folder 1'
Response
--------
/api/libraries/f3f73e481f432006/contents/28202595c0d2591fa4f9089d2303fd89
name: api_test_folder1
id: 28202595c0d2591fa4f9089d2303fd89
% ./library_upload_from_import_dir.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents 28202595c0d2591fa4f9089d2303fd89 bed bed hg19
Response
--------
/api/libraries/f3f73e481f432006/contents/e9ef7fdb2db87d7b
name: 2.bed
id: e9ef7fdb2db87d7b
/api/libraries/f3f73e481f432006/contents/3b7f6a31f80a5018
name: 3.bed
id: 3b7f6a31f80a5018
% ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents
Collection Members
------------------
/api/libraries/f3f73e481f432006/contents/28202595c0d2591f61ddda595d2c3670
name: /
type: folder
id: 28202595c0d2591f61ddda595d2c3670
/api/libraries/f3f73e481f432006/contents/28202595c0d2591fa4f9089d2303fd89
name: /api_test_folder1
type: folder
id: 28202595c0d2591fa4f9089d2303fd89
/api/libraries/f3f73e481f432006/contents/e9ef7fdb2db87d7b
name: /api_test_folder1/2.bed
type: file
id: e9ef7fdb2db87d7b
/api/libraries/f3f73e481f432006/contents/3b7f6a31f80a5018
name: /api_test_folder1/3.bed
type: file
id: 3b7f6a31f80a5018
% ./display.py my_key http://localhost:4096/api/libraries/f3f73e481f432006/contents/e9ef7fdb2db87d7b
Member Information
------------------
misc_blurb: 68 regions
metadata_endCol: 3
data_type: bed
metadata_columns: 6
metadata_nameCol: 4
uploaded_by: nate@...
metadata_strandCol: 6
name: 2.bed
genome_build: hg19
metadata_comment_lines: None
metadata_startCol: 2
metadata_chromCol: 1
file_size: 4272
metadata_data_lines: 68
message:
metadata_dbkey: hg19
misc_info: uploaded bed file
date_uploaded: 2010-06-22T17:01:51.266119
metadata_column_types: str, int, int, str, int, str
Other parameters are valid when uploading, they are the same parameters as are used in the web form, like ‘link_data_only’ and etc.
The request and response format should be considered alpha and are subject to change.
API Design Guidelines¶
The following section outlines guidelines related to extending and/or modifing the Galaxy API. The Galaxy API has grown in an ad-hoc fashion over time by many contributors and so clients SHOULD NOT expect the API will conform to these guidelines - but developers contributing to the Galaxy API SHOULD follow these guidelines.
API functionality should include docstring documentation for consumption by readthedocs.org.
Developers should familiarize themselves with the HTTP status code definitions http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html. The API responses should properly set the status code according to the result - in particular 2XX responses should be used for successful requests, 4XX for various kinds of client errors, and 5XX for the errors on the server side.
If there is an error processing some part of request (one item in a list for instance), the status code should be set to reflect the error and the partial result may or may not be returned depending on the controller - this behavior should be documented.
API methods should throw a finite number of exceptions (defined in exceptions Package) and these should subclass MessageException and not paste/wsgi HTTP exceptions. When possible, the framework itself should be responsible catching these exceptions, setting the status code, and building an error response.
Error responses should not consist of plain text strings - they should be dictionaries describing the error and containing the following:
{ "status_code": 400, "err_code": 400007, "err_msg": "Request contained invalid parameter, action could not be completed.", "type": "error", "extra_error_info": "Extra information." }Various error conditions (once a format has been chosen and framework to enforce it in place) should be spelled out in this document.
Backward compatibility is important and should be maintained when possible. If changing behavior in a non-backward compatibile way please ensure one of the following holds - there is a strong reason to believe no consumers depend on a behavior, the behavior is effectively broken, or the API method being modified has not been part of a tagged dist release.
The following bullet points represent good practices more than guidelines, please consider them when modifying the API.
- Functionality should not be copied and pasted between controllers - consider refactoring functionality into associated classes or short of that into Mixins (http://en.wikipedia.org/wiki/Composition_over_inheritance) or into Managers (managers Package).
- API additions are more permanent changes to Galaxy than many other potential changes and so a second opinion on API changes should be sought. (Consider a pull request!)
- New API functionality should include functional tests. These functional tests should be implemented in Python and placed in test/functional/api. (Once such a framework is in place - it is not right now).
- Changes to reflect modifications to the API should be pushed upstream to the BioBlend project if possible.
Longer term goals/notes.
- It would be advantageous to have a clearer separation of anonymous and admin handling functionality.
- If at some point in the future, functionality needs to be added that breaks backward compatibility in a significant way to a component used by the community - a “dev” variant of the API will be established and the community should be alerted and given a timeframe for when the old behavior will be replaced with the new behavior.
- Consistent standards for range-based requests, batch requests, filtered requests, etc... should be established and documented here.
API Controllers¶
Galaxy offers the following API controllers:
annotations
Module¶
API operations on annotations.
-
class
galaxy.webapps.galaxy.api.annotations.
BaseAnnotationsController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesStoredWorkflowMixin
,galaxy.model.item_attrs.UsesAnnotations
-
class
galaxy.webapps.galaxy.api.annotations.
HistoryAnnotationsController
(app)[source]¶ Bases:
galaxy.webapps.galaxy.api.annotations.BaseAnnotationsController
-
controller_name
= 'history_annotations'¶
-
tagged_item_id
= 'history_id'¶
-
-
class
galaxy.webapps.galaxy.api.annotations.
HistoryContentAnnotationsController
(app)[source]¶ Bases:
galaxy.webapps.galaxy.api.annotations.BaseAnnotationsController
-
controller_name
= 'history_content_annotations'¶
-
tagged_item_id
= 'history_content_id'¶
-
-
class
galaxy.webapps.galaxy.api.annotations.
WorkflowAnnotationsController
(app)[source]¶ Bases:
galaxy.webapps.galaxy.api.annotations.BaseAnnotationsController
-
controller_name
= 'workflow_annotations'¶
-
tagged_item_id
= 'workflow_id'¶
-
authenticate
Module¶
API key retrieval through BaseAuth Sample usage:
curl –user zipzap@foo.com:password http://localhost:8080/api/authenticate/baseauth
Returns:
- {
- “api_key”: “baa4d6e3a156d3033f05736255f195f9”
}
configuration
Module¶
API operations allowing clients to determine Galaxy instance’s capabilities and configuration settings.
-
class
galaxy.webapps.galaxy.api.configuration.
ConfigurationController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
-
get_config_dict
(trans, return_admin=False, view=None, keys=None, default_view='all')[source]¶ Return a dictionary with (a subset of) current Galaxy settings.
If return_admin also include a subset of more sensitive keys. Pass in view (String) and comma seperated list of keys to control which configuration settings are returned.
-
dataset_collections
Module¶
-
class
galaxy.webapps.galaxy.api.dataset_collections.
DatasetCollectionsController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesLibraryMixinItems
-
create
(trans, *args, **kwargs)[source]¶ - POST /api/dataset_collections:
create a new dataset collection instance.
Parameters: payload (dict) – (optional) dictionary structure containing: * collection_type: dataset colltion type to create. * instance_type: Instance type - ‘history’ or ‘library’. * name: the new dataset collections’s name * datasets: object describing datasets for collection Return type: dict Returns: element view of new dataset collection
-
datasets
Module¶
datatypes
Module¶
API operations allowing clients to determine datatype supported by Galaxy.
-
class
galaxy.webapps.galaxy.api.datatypes.
DatatypesController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
-
index
(trans, *args, **kwargs)[source]¶ GET /api/datatypes Return an object containing upload datatypes.
-
extended_metadata
Module¶
API operations on annotations.
-
class
galaxy.webapps.galaxy.api.extended_metadata.
BaseExtendedMetadataController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesExtendedMetadataMixin
,galaxy.web.base.controller.UsesLibraryMixinItems
,galaxy.web.base.controller.UsesStoredWorkflowMixin
-
class
galaxy.webapps.galaxy.api.extended_metadata.
HistoryDatasetExtendMetadataController
(app)[source]¶ Bases:
galaxy.webapps.galaxy.api.extended_metadata.BaseExtendedMetadataController
-
controller_name
= 'history_dataset_extended_metadata'¶
-
exmeta_item_id
= 'history_content_id'¶
-
-
class
galaxy.webapps.galaxy.api.extended_metadata.
LibraryDatasetExtendMetadataController
(app)[source]¶ Bases:
galaxy.webapps.galaxy.api.extended_metadata.BaseExtendedMetadataController
-
controller_name
= 'library_dataset_extended_metadata'¶
-
exmeta_item_id
= 'library_content_id'¶
-
folder_contents
Module¶
API operations on the contents of a library folder.
-
class
galaxy.webapps.galaxy.api.folder_contents.
FolderContentsController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesLibraryMixin
,galaxy.web.base.controller.UsesLibraryMixinItems
Class controls retrieval, creation and updating of folder contents.
-
build_path
(trans, folder)[source]¶ Search the path upwards recursively and load the whole route of names and ids for breadcrumb building purposes.
Parameters: - folder – current folder for navigating up
- type – Galaxy LibraryFolder
Returns: list consisting of full path to the library
Type: list
-
create
(self, trans, library_id, payload, **kwd)[source]¶ - POST /api/folders/{encoded_id}/contents
create a new library file from an HDA
Parameters: payload – dictionary structure containing: Returns: a dictionary containing the id, name, and ‘show’ url of the new item Return type: dict Raises: ObjectAttributeInvalidException, InsufficientPermissionsException, ItemAccessibilityException, InternalServerError
-
index
(trans, *args, **kwargs)[source]¶ GET /api/folders/{encoded_folder_id}/contents
Displays a collection (list) of a folder’s contents (files and folders). Encoded folder ID is prepended with ‘F’ if it is a folder as opposed to a data set which does not have it. Full path is provided in response as a separate object providing data for breadcrumb path building.
Parameters: - folder_id (encoded string) – encoded ID of the folder which contents should be library_dataset_dict
- kwd (dict) – keyword dictionary with other params
Returns: dictionary containing all items and metadata
Type: dict
Raises: MalformedId, InconsistentDatabase, ObjectNotFound, InternalServerError
-
folders
Module¶
API operations on library folders.
-
class
galaxy.webapps.galaxy.api.folders.
FoldersController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesLibraryMixin
,galaxy.web.base.controller.UsesLibraryMixinItems
-
create
(self, trans, encoded_parent_folder_id, **kwd)[source]¶ *POST /api/folders/{encoded_parent_folder_id}
Create a new folder object underneath the one specified in the parameters.
Parameters: - encoded_parent_folder_id (an encoded id string (should be prefixed by ‘F’)) – the parent folder’s id (required)
- name (str) – the name of the new folder (required)
- description (str) – the description of the new folder
Returns: information about newly created folder, notably including ID
Return type: dictionary
Raises: RequestParameterMissingException
-
delete
(self, trans, id, **kwd)[source]¶ - DELETE /api/folders/{id}
marks the folder with the given
id
as deleted (or removes the deleted mark if the undelete param is true)
Note
Currently, only admin users can un/delete folders.
Parameters: - id (an encoded id string) – the encoded id of the folder to un/delete
- undelete (bool) – (optional) flag specifying whether the item should be deleted or undeleted, defaults to false:
Returns: detailed folder information
Return type: dictionary
Raises: ItemAccessibilityException, MalformedId, ObjectNotFound
-
get_permissions
(trans, *args, **kwargs)[source]¶ - GET /api/folders/{id}/permissions
Load all permissions for the given folder id and return it.
Parameters: - encoded_folder_id (an encoded id string) – the encoded id of the folder
- scope (string) – either ‘current’ or ‘available’
Returns: dictionary with all applicable permissions’ values
Return type: dictionary
Raises: ObjectNotFound, InsufficientPermissionsException
-
index
(trans, *args, **kwargs)[source]¶ *GET /api/folders/ This would normally display a list of folders. However, that would be across multiple libraries, so it’s not implemented.
-
set_permissions
(trans, *args, **kwargs)[source]¶ - def set_permissions( self, trans, encoded_folder_id, **kwd ):
- *POST /api/folders/{encoded_folder_id}/permissions
Parameters: - encoded_folder_id (an encoded id string) – the encoded id of the folder to set the permissions of
- action (string) – (required) describes what action should be performed available actions: set_permissions
- add_ids[] (string or list) – list of Role.id defining roles that should have add item permission on the folder
- manage_ids[] (string or list) – list of Role.id defining roles that should have manage permission on the folder
- modify_ids[] (string or list) – list of Role.id defining roles that should have modify permission on the folder
Return type: dictionary
Returns: dict of current roles for all available permission types.
Raises: RequestParameterInvalidException, ObjectNotFound, InsufficientPermissionsException, InternalServerError RequestParameterMissingException
-
forms
Module¶
API operations on FormDefinition objects.
ftp_files
Module¶
genomes
Module¶
-
class
galaxy.webapps.galaxy.api.genomes.
GenomesController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
RESTful controller for interactions with genome data.
group_roles
Module¶
API operations on Group objects.
-
class
galaxy.webapps.galaxy.api.group_roles.
GroupRolesAPIController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
-
delete
(trans, *args, **kwargs)[source]¶ DELETE /api/groups/{encoded_group_id}/roles/{encoded_role_id} Removes a role from a group
-
index
(trans, *args, **kwargs)[source]¶ GET /api/groups/{encoded_group_id}/roles Displays a collection (list) of groups.
-
group_users
Module¶
API operations on Group objects.
-
class
galaxy.webapps.galaxy.api.group_users.
GroupUsersAPIController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
-
delete
(trans, *args, **kwargs)[source]¶ DELETE /api/groups/{encoded_group_id}/users/{encoded_user_id} Removes a user from a group
-
index
(trans, *args, **kwargs)[source]¶ GET /api/groups/{encoded_group_id}/users Displays a collection (list) of groups.
-
groups
Module¶
API operations on Group objects.
-
class
galaxy.webapps.galaxy.api.groups.
GroupAPIController
(app)[source]¶
histories
Module¶
API operations on a history.
See also
-
class
galaxy.webapps.galaxy.api.histories.
HistoriesController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.ExportsHistoryMixin
,galaxy.web.base.controller.ImportsHistoryMixin
-
archive_download
(trans, *args, **kwargs)[source]¶ export_download( self, trans, id, jeha_id ) * GET /api/histories/{id}/exports/{jeha_id}:
If ready and available, return raw contents of exported history. Use/poll “PUT /api/histories/{id}/exports” to initiate the creation of such an export - when ready that route will return 200 status code (instead of 202) with a JSON dictionary containing a download_url.
-
archive_export
(trans, *args, **kwargs)[source]¶ export_archive( self, trans, id, payload ) * PUT /api/histories/{id}/exports:
start job (if needed) to create history export for corresponding history.Parameters: id (str) – the encoded id of the history to export Return type: dict Returns: object containing url to fetch export from.
-
create
(trans, payload)[source]¶ - POST /api/histories:
create a new history
Parameters: - payload (dict) – (optional) dictionary structure containing: * name: the new history’s name * history_id: the id of the history to copy * archive_source: the url that will generate the archive to import * archive_type: ‘url’ (default)
- keys – same as the use of keys in the index function above
- view – same as the use of view in the index function above
Return type: dict
Returns: element view of new history
-
delete
(self, trans, id, **kwd)[source]¶ - DELETE /api/histories/{id}
delete the history with the given
id
Note
Stops all active jobs in the history if purge is set.
Parameters: - id (str) – the encoded id of the history to delete
- kwd (dict) – (optional) dictionary structure containing extra parameters
You can purge a history, removing all it’s datasets from disk (if unshared), by passing in
purge=True
in the url.Parameters: - keys – same as the use of keys in the index function above
- view – same as the use of view in the index function above
Return type: dict
Returns: the deleted or purged history
-
index
(trans, deleted='False')[source]¶ - GET /api/histories:
return undeleted histories for the current user
- GET /api/histories/deleted:
return deleted histories for the current user
Note
Anonymous users are allowed to get their current history
Parameters: deleted (boolean) – if True, show only deleted histories, if False, non-deleted Return type: list Returns: list of dictionaries containing summary history information - The following are optional parameters:
- view: string, one of (‘summary’,’detailed’), defaults to ‘summary’
- controls which set of properties to return
- keys: comma separated strings, unused by default
- keys/names of individual properties to return
If neither keys or views are sent, the default view (set of keys) is returned. If both a view and keys are sent, the key list and the view’s keys are combined. If keys are send and no view, only those properties in keys are returned.
- For which properties are available see:
- galaxy/managers/histories/HistorySerializer
- The list returned can be filtered by using two optional parameters:
- q: string, generally a property name to filter by followed
- by an (often optional) hyphen and operator string.
qv: string, the value to filter by
- ..example:
To filter the list to only those created after 2015-01-29, the query string would look like:
‘?q=create_time-gt&qv=2015-01-29’- Multiple filters can be sent in using multiple q/qv pairs:
- ‘?q=create_time-gt&qv=2015-01-29&q=tag-has&qv=experiment-1’
- The list returned can be paginated using two optional parameters:
- limit: integer, defaults to no value and no limit (return all)
- how many items to return
- offset: integer, defaults to 0 and starts at the beginning
- skip the first ( offset - 1 ) items and begin returning at the Nth item
- ..example:
- limit and offset can be combined. Skip the first two and return five:
- ‘?limit=5&offset=3’
-
show
(trans, id, deleted='False')[source]¶ - GET /api/histories/{id}:
return the history with
id
- GET /api/histories/deleted/{id}:
return the deleted history with
id
- GET /api/histories/most_recently_used:
return the most recently used history
Parameters: - id (an encoded id string) – the encoded id of the history to query or the string ‘most_recently_used’
- deleted (boolean) – if True, allow information on a deleted history to be shown.
- keys – same as the use of keys in the index function above
- view – same as the use of view in the index function above
Return type: dictionary
Returns: detailed history information
-
undelete
(self, trans, id, **kwd)[source]¶ - POST /api/histories/deleted/{id}/undelete:
undelete history (that hasn’t been purged) with the given
id
Parameters: - id (str) – the encoded id of the history to undelete
- keys – same as the use of keys in the index function above
- view – same as the use of view in the index function above
Return type: str
Returns: ‘OK’ if the history was undeleted
-
update
(self, trans, id, payload, **kwd)[source]¶ - PUT /api/histories/{id}
updates the values for the history with the given
id
Parameters: - id (str) – the encoded id of the history to update
- payload (dict) –
a dictionary containing any or all the fields in
galaxy.model.History.to_dict()
and/or the following:- annotation: an annotation for the history
- keys – same as the use of keys in the index function above
- view – same as the use of view in the index function above
Return type: dict
Returns: an error object if an error occurred or a dictionary containing any values that were different from the original and, therefore, updated
-
history_contents
Module¶
API operations on the contents of a history.
-
class
galaxy.webapps.galaxy.api.history_contents.
HistoryContentsController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesLibraryMixin
,galaxy.web.base.controller.UsesLibraryMixinItems
,galaxy.web.base.controller.UsesTagsMixin
-
create
(self, trans, history_id, payload, **kwd)[source]¶ - POST /api/histories/{history_id}/contents/{type}
create a new HDA by copying an accessible LibraryDataset
Parameters: - history_id (str) – encoded id string of the new HDA’s History
- type (str) – Type of history content - ‘dataset’ (default) or ‘dataset_collection’.
- payload (dict) –
dictionary structure containing:: copy from library (for type ‘dataset’): ‘source’ = ‘library’ ‘content’ = [the encoded id from the library dataset]
copy from history dataset (for type ‘dataset’): ‘source’ = ‘hda’ ‘content’ = [the encoded id from the HDA]
copy from history dataset collection (for type ‘dataset_collection’) ‘source’ = ‘hdca’ ‘content’ = [the encoded id from the HDCA]
create new history dataset collection (for type ‘dataset_collection’) ‘source’ = ‘new_collection’ (default ‘source’ if type is
‘dataset_collection’ - no need to specify this)‘collection_type’ = For example, “list”, “paired”, “list:paired”. ‘name’ = Name of new dataset collection. ‘element_identifiers’ = Recursive list structure defining collection.
Each element must have ‘src’ which can be ‘hda’, ‘ldda’, ‘hdca’, or ‘new_collection’, as well as a ‘name’ which is the name of element (e.g. “forward” or “reverse” for paired datasets, or arbitrary sample names for instance for lists). For all src’s except ‘new_collection’ - a encoded ‘id’ attribute must be included wiht element as well. ‘new_collection’ sources must defined a ‘collection_type’ and their own list of (potentially) nested ‘element_identifiers’.
- ..note:
- Currently, a user can only copy an HDA from a history that the user owns.
Return type: dict Returns: dictionary containing detailed information for the new HDA
-
delete
(self, trans, history_id, id, **kwd)[source]¶ - DELETE /api/histories/{history_id}/contents/{id}
delete the HDA with the given
id
Note
Currently does not stop any active jobs for which this dataset is an output.
Parameters: - id (str) – the encoded id of the history to delete
- purge (bool) – if True, purge the HDA
- kwd (dict) –
(optional) dictionary structure containing:
- payload: a dictionary itself containing:
- purge: if True, purge the HDA
Note
that payload optionally can be placed in the query string of the request. This allows clients that strip the request body to still purge the dataset.
Return type: dict Returns: an error object if an error occurred or a dictionary containing: * id: the encoded id of the history, * deleted: if the history was marked as deleted, * purged: if the history was purged
-
index
(self, trans, history_id, ids=None, **kwd)[source]¶ - GET /api/histories/{history_id}/contents
return a list of HDA data for the history with the given
id
Note
Anonymous users are allowed to get their current history contents
If Ids is not given, index returns a list of summary objects for every HDA associated with the given history_id.
If ids is given, index returns a more complete json object for each HDA in the ids list.
Parameters: - history_id (str) – encoded id string of the HDA’s History
- ids (str) – (optional) a comma separated list of encoded HDA ids
- types (str) – (optional) kinds of contents to index (currently just dataset, but dataset_collection will be added shortly).
Return type: Returns: dictionaries containing summary or detailed HDA information
-
show
(self, trans, id, history_id, **kwd)[source]¶ - GET /api/histories/{history_id}/contents/{id}
return detailed information about an HDA within a history
Note
Anonymous users are allowed to get their current history contents
Parameters: - ids – the encoded id of the HDA to return
- history_id (str) – encoded id string of the HDA’s History
Return type: dict
Returns: dictionary containing detailed HDA information
-
update
(self, trans, history_id, id, payload, **kwd)[source]¶ - PUT /api/histories/{history_id}/contents/{id}
updates the values for the HDA with the given
id
Parameters: - history_id (str) – encoded id string of the HDA’s History
- id (str) – the encoded id of the history to undelete
- payload (dict) –
a dictionary containing any or all the fields in
galaxy.model.HistoryDatasetAssociation.to_dict()
and/or the following:- annotation: an annotation for the HDA
Return type: dict
Returns: an error object if an error occurred or a dictionary containing any values that were different from the original and, therefore, updated
-
item_tags
Module¶
API operations related to tagging items.
job_files
Module¶
API for asynchronous job running mechanisms can use to fetch or put files related to running and queued jobs.
-
class
galaxy.webapps.galaxy.api.job_files.
JobFilesAPIController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
This job files controller allows remote job running mechanisms to read and modify the current state of files for queued and running jobs. It is certainly not meant to represent part of Galaxy’s stable, user facing API.
Furthermore, even if a user key corresponds to the user running the job, it should not be accepted for authorization - this API allows access to low-level unfiltered files and such authorization would break Galaxy’s security model for tool execution.
-
create
(self, trans, job_id, payload, **kwargs)[source]¶ - POST /api/jobs/{job_id}/files
Populate an output file (formal dataset, task split part, working directory file (such as those related to metadata)). This should be a multipart post with a ‘file’ parameter containing the contents of the actual file to create.
Parameters: - job_id (str) – encoded id string of the job
- payload (dict) – dictionary structure containing:: ‘job_key’ = Key authenticating ‘path’ = Path to file to create.
- ..note:
- This API method is intended only for consumption by job runners, not end users.
Return type: dict Returns: an okay message
-
index
(self, trans, job_id, **kwargs)[source]¶ - GET /api/jobs/{job_id}/files
Get a file required to staging a job (proper datasets, extra inputs, task-split inputs, working directory files).
Parameters: - job_id (str) – encoded id string of the job
- path (str) – Path to file.
- job_key (str) – A key used to authenticate this request as acting on behalf or a job runner for the specified job.
- ..note:
- This API method is intended only for consumption by job runners, not end users.
Return type: binary Returns: contents of file
-
jobs
Module¶
API operations on a jobs.
See also
galaxy.model.Jobs
-
class
galaxy.webapps.galaxy.api.jobs.
JobController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesLibraryMixinItems
-
index
(trans, state=None, tool_id=None, history_id=None, date_range_min=None, date_range_max=None, user_details=False)[source]¶ - GET /api/jobs:
return jobs for current user
- !! if user is admin and user_details is True, then
return jobs for all galaxy users based on filtering - this is an extended service
Parameters: state (string or list) – limit listing of jobs to those that match one of the included states. If none, all are returned. - Valid Galaxy job states include:
- ‘new’, ‘upload’, ‘waiting’, ‘queued’, ‘running’, ‘ok’, ‘error’, ‘paused’, ‘deleted’, ‘deleted_new’
Parameters: - tool_id (string or list) – limit listing of jobs to those that match one of the included tool_ids. If none, all are returned.
- user_details (boolean) – if true, and requestor is an admin, will return external job id and user email.
- date_range_min (string ‘2014-01-01’) – limit the listing of jobs to those updated on or after requested date
- date_range_max (string ‘2014-12-31’) – limit the listing of jobs to those updated on or before requested date
- history_id (string) – limit listing of jobs to those that match the history_id. If none, all are returned.
Return type: Returns: list of dictionaries containing summary job information
-
inputs
(trans, *args, **kwargs)[source]¶ show( trans, id ) * GET /api/jobs/{job_id}/inputs
returns input datasets created by jobParameters: id (string) – Encoded job id Return type: dictionary Returns: dictionary containing input dataset associations
-
outputs
(trans, *args, **kwargs)[source]¶ show( trans, id ) * GET /api/jobs/{job_id}/outputs
returns output datasets created by jobParameters: id (string) – Encoded job id Return type: dictionary Returns: dictionary containing output dataset associations
-
search
(trans, payload)[source]¶ - POST /api/jobs/search:
return jobs for current user
Parameters: payload (dict) – Dictionary containing description of requested job. This is in the same format as a request to POST /apt/tools would take to initiate a job Return type: list Returns: list of dictionaries containing summary job information of the jobs that match the requested job run This method is designed to scan the list of previously run jobs and find records of jobs that had the exact some input parameters and datasets. This can be used to minimize the amount of repeated work, and simply recycle the old results.
-
lda_datasets
Module¶
API operations on the library datasets.
-
class
galaxy.webapps.galaxy.api.lda_datasets.
LibraryDatasetsController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesVisualizationMixin
-
delete
(trans, *args, **kwargs)[source]¶ delete( self, trans, encoded_dataset_id, **kwd ): * DELETE /api/libraries/datasets/{encoded_dataset_id}
Marks the dataset deleted or undeleted based on the value of the undelete flag. If the flag is not present it is considered False and the item is marked deleted.Parameters: encoded_dataset_id (an encoded id string) – the encoded id of the dataset to change Returns: dict containing information about the dataset Return type: dictionary
-
download
(self, trans, format, **kwd)[source]¶ GET /api/libraries/datasets/download/{format}
- POST /api/libraries/datasets/download/{format}
Downloads requested datasets (identified by encoded IDs) in requested format.
example:
GET localhost:8080/api/libraries/datasets/download/tbz?ld_ids%255B%255D=a0d84b45643a2678&ld_ids%255B%255D=fe38c84dcd46c828
Note
supported format values are: ‘zip’, ‘tgz’, ‘tbz’, ‘uncompressed’
Parameters: - format (string) – string representing requested archive format
- ld_ids[] (an array) – an array of encoded ids
Return type: file
Returns: either archive with the requested datasets packed inside or a single uncompressed dataset
Raises: MessageException, ItemDeletionException, ItemAccessibilityException, HTTPBadRequest, OSError, IOError, ObjectNotFound
-
load
(trans, *args, **kwargs)[source]¶ load( self, trans, **kwd ): * POST /api/libraries/datasets Load dataset from the given source into the library. Source can be:
- user directory - root folder specified in galaxy.ini as “$user_library_import_dir”
- example path: path/to/galaxy/$user_library_import_dir/user@example.com/{user can browse everything here} the folder with the user login has to be created beforehand
- (admin)import directory - root folder specified in galaxy ini as “$library_import_dir”
- example path: path/to/galaxy/$library_import_dir/{admin can browse everything here}
(admin)any absolute or relative path - option allowed with “allow_library_path_paste” in galaxy.ini
Parameters: - encoded_folder_id (an encoded id string) – the encoded id of the folder to import dataset(s) to
- source (str) – source the datasets should be loaded form
- link_data (bool) – flag whether to link the dataset to data or copy it to Galaxy, defaults to copy while linking is set to True all symlinks will be resolved _once_
- preserve_dirs (bool) – flag whether to preserve the directory structure when importing dir if False only datasets will be imported
- file_type (str) – file type of the loaded datasets, defaults to ‘auto’ (autodetect)
- dbkey (str) – dbkey of the loaded genome, defaults to ‘?’ (unknown)
Returns: dict containing information about the created upload job
Return type: dictionary
-
show
(self, trans, id, **kwd)[source]¶ - GET /api/libraries/datasets/{encoded_dataset_id}:
Displays information about the dataset identified by the encoded ID.
Parameters: id (an encoded id string) – the encoded id of the dataset to query Returns: detailed dataset information from base controller Return type: dictionary
-
show_roles
(trans, *args, **kwargs)[source]¶ show_roles( self, trans, id, **kwd ): * GET /api/libraries/datasets/{encoded_dataset_id}/permissions
Displays information about current or available roles for a given dataset permission.Parameters: - encoded_dataset_id (an encoded id string) – the encoded id of the dataset to query
- scope (string) – either ‘current’ or ‘available’
Return type: dictionary
Returns: either dict of current roles for all permission types or dict of available roles to choose from (is the same for any permission type)
-
show_version
(trans, *args, **kwargs)[source]¶ show_version( self, trans, encoded_dataset_id, encoded_ldda_id, **kwd ): * GET /api/libraries/datasets/:encoded_dataset_id/versions/:encoded_ldda_id
Displays information about specific version of the library_dataset (i.e. ldda).Parameters: - encoded_dataset_id (an encoded id string) – the encoded id of the dataset to query
- encoded_ldda_id (an encoded id string) – the encoded id of the ldda to query
Return type: dictionary
Returns: dict of ldda’s details
-
update_permissions
(trans, *args, **kwargs)[source]¶ - def update( self, trans, encoded_dataset_id, **kwd ):
- *POST /api/libraries/datasets/{encoded_dataset_id}/permissions
Parameters: - encoded_dataset_id (an encoded id string) – the encoded id of the dataset to update permissions of
- action (string) – (required) describes what action should be performed available actions: make_private, remove_restrictions, set_permissions
- access_ids[] (string or list) – list of Role.name defining roles that should have access permission on the dataset
- manage_ids[] (string or list) – list of Role.name defining roles that should have manage permission on the dataset
- modify_ids[] (string or list) – list of Role.name defining roles that should have modify permission on the library dataset item
Return type: dictionary
Returns: dict of current roles for all available permission types
Raises: RequestParameterInvalidException, ObjectNotFound, InsufficientPermissionsException, InternalServerError RequestParameterMissingException
-
libraries
Module¶
API operations on a data library.
-
class
galaxy.webapps.galaxy.api.libraries.
LibrariesController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
-
create
(self, trans, payload, **kwd)[source]¶ - POST /api/libraries:
Creates a new library. Only
name
parameter is required.
Note
Currently, only admin users can create libraries.
Parameters: payload (dict) – dictionary structure containing:: ‘name’: the new library’s name (required) ‘description’: the new library’s description (optional) ‘synopsis’: the new library’s synopsis (optional) Returns: detailed library information Return type: dict Raises: ItemAccessibilityException, RequestParameterMissingException
-
delete
(self, trans, id, **kwd)[source]¶ - DELETE /api/libraries/{id}
marks the library with the given
id
as deleted (or removes the deleted mark if the undelete param is true)
Note
Currently, only admin users can un/delete libraries.
Parameters: - id (an encoded id string) – the encoded id of the library to un/delete
- undelete (bool) – (optional) flag specifying whether the item should be deleted or undeleted, defaults to false:
Returns: detailed library information
Return type: dictionary
Raises: ItemAccessibilityException, MalformedId, ObjectNotFound
-
get_permissions
(trans, *args, **kwargs)[source]¶ - GET /api/libraries/{id}/permissions
Load all permissions for the given library id and return it.
Parameters: - encoded_library_id (an encoded id string) – the encoded id of the library
- scope (string) – either ‘current’ or ‘available’
- is_library_access (bool) – indicates whether the roles available for the library access are requested
Returns: dictionary with all applicable permissions’ values
Return type: dictionary
Raises: ObjectNotFound, InsufficientPermissionsException
-
index
(self, trans, **kwd)[source]¶ - GET /api/libraries:
Returns a list of summary data for all libraries.
Parameters: deleted (boolean (optional)) – if True, show only deleted
libraries, if False show onlynon-deleted
Returns: list of dictionaries containing library information Return type: list
-
set_permissions
(trans, *args, **kwargs)[source]¶ - def set_permissions( self, trans, encoded_dataset_id, **kwd ):
- *POST /api/libraries/{encoded_library_id}/permissions
Parameters: - encoded_library_id (an encoded id string) – the encoded id of the library to set the permissions of
- action (string) – (required) describes what action should be performed available actions: remove_restrictions, set_permissions
- access_ids[] (string or list) – list of Role.id defining roles that should have access permission on the library
- add_ids[] (string or list) – list of Role.id defining roles that should have add item permission on the library
- manage_ids[] (string or list) – list of Role.id defining roles that should have manage permission on the library
- modify_ids[] (string or list) – list of Role.id defining roles that should have modify permission on the library
Return type: dictionary
Returns: dict of current roles for all available permission types
Raises: RequestParameterInvalidException, ObjectNotFound, InsufficientPermissionsException, InternalServerError RequestParameterMissingException
-
set_permissions_old
(trans, library, payload, **kwd)[source]¶ * old implementation for backward compatibility *
POST /api/libraries/{encoded_library_id}/permissions Updates the library permissions.
-
show
(self, trans, id, deleted='False', **kwd)[source]¶ - GET /api/libraries/{encoded_id}:
returns detailed information about a library
- GET /api/libraries/deleted/{encoded_id}:
returns detailed information about a
deleted
library
Parameters: - id (an encoded id string) – the encoded id of the library
- deleted (boolean) – if True, allow information on a
deleted
library
Returns: detailed library information
Return type: dictionary
Raises: MalformedId, ObjectNotFound
-
update
(trans, *args, **kwargs)[source]¶ - PATCH /api/libraries/{encoded_id}
Updates the library defined by an
encoded_id
with the data in the payload.
Note
Currently, only admin users can update libraries. Also the library must not be deleted.
param id: the encoded id of the library type id: an encoded id string param payload: (required) dictionary structure containing:: ‘name’: new library’s name, cannot be empty ‘description’: new library’s description ‘synopsis’: new library’s synopsis type payload: dict returns: detailed library information rtype: dict raises: ItemAccessibilityException, MalformedId, ObjectNotFound, RequestParameterInvalidException, RequestParameterMissingException
-
library_contents
Module¶
API operations on the contents of a data library.
-
class
galaxy.webapps.galaxy.api.library_contents.
LibraryContentsController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesLibraryMixin
,galaxy.web.base.controller.UsesLibraryMixinItems
-
create
(self, trans, library_id, payload, **kwd)[source]¶ - POST /api/libraries/{library_id}/contents:
create a new library file or folder
To copy an HDA into a library send
create_type
of ‘file’ and the HDA’s encoded id infrom_hda_id
(and optionallyldda_message
).Parameters: - library_id (str) – the encoded id of the library where to create the new item
- payload (dict) –
dictionary structure containing:
- folder_id: the encoded id of the parent folder of the new item
- create_type: the type of item to create (‘file’, ‘folder’ or ‘collection’)
- from_hda_id: (optional, only if create_type is ‘file’) the
- encoded id of an accessible HDA to copy into the library
- ldda_message: (optional) the new message attribute of the LDDA created
- extended_metadata: (optional) dub-dictionary containing any extended
- metadata to associate with the item
- upload_option: (optional) one of ‘upload_file’ (default), ‘upload_directory’ or ‘upload_paths’
- server_dir: (optional, only if upload_option is
- ‘upload_directory’) relative path of the subdirectory of Galaxy
library_import_dir
to upload. All and only the files (i.e. no subdirectories) contained in the specified directory will be uploaded.
- filesystem_paths: (optional, only if upload_option is
- ‘upload_paths’ and the user is an admin) file paths on the Galaxy server to upload to the library, one file per line
- link_data_only: (optional, only when upload_option is
- ‘upload_directory’ or ‘upload_paths’) either ‘copy_files’ (default) or ‘link_to_files’. Setting to ‘link_to_files’ symlinks instead of copying the files
- name: (optional, only if create_type is ‘folder’) name of the
- folder to create
- description: (optional, only if create_type is ‘folder’)
- description of the folder to create
Return type: dict
Returns: a dictionary containing the id, name, and ‘show’ url of the new item
-
delete
(self, trans, library_id, id, **kwd)[source]¶ - DELETE /api/libraries/{library_id}/contents/{id}
delete the LibraryDataset with the given
id
Parameters: - id (str) – the encoded id of the library dataset to delete
- kwd (dict) –
(optional) dictionary structure containing:
- payload: a dictionary itself containing:
- purge: if True, purge the LD
Return type: dict
Returns: an error object if an error occurred or a dictionary containing: * id: the encoded id of the library dataset, * deleted: if the library dataset was marked as deleted, * purged: if the library dataset was purged
-
index
(self, trans, library_id, **kwd)[source]¶ - GET /api/libraries/{library_id}/contents:
Returns a list of library files and folders.
Note
May be slow! Returns all content traversing recursively through all folders.
See also
galaxy.webapps.galaxy.api.FolderContentsController.index
for a non-recursive solutionParameters: library_id (str) – the encoded id of the library Returns: list of dictionaries of the form: * id: the encoded id of the library item * name: the ‘library path’ or relationship of the library item to the root- type: ‘file’ or ‘folder’
- url: the url to get detailed information on the library item
Return type: list Raises: MalformedId, InconsistentDatabase, RequestParameterInvalidException, InternalServerError
-
show
(self, trans, id, library_id, **kwd)[source]¶ - GET /api/libraries/{library_id}/contents/{id}
Returns information about library file or folder.
Parameters: - id (str) – the encoded id of the library item to return
- library_id (str) – the encoded id of the library that contains this item
Returns: detailed library item information
Return type: dict
-
update
(self, trans, id, library_id, payload, **kwd)[source]¶ - PUT /api/libraries/{library_id}/contents/{id}
create a ImplicitlyConvertedDatasetAssociation
Parameters: - id (str) – the encoded id of the library item to return
- library_id (str) – the encoded id of the library that contains this item
- payload (dict) – dictionary structure containing:: ‘converted_dataset_id’:
Return type: None
Returns: None
-
metrics
Module¶
API operations for for querying and recording user metrics from some client (typically a user’s browser).
-
class
galaxy.webapps.galaxy.api.metrics.
MetricsController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
-
create
(trans, payload)[source]¶ - POST /api/metrics:
record any metrics sent and return some status object
Note
Anonymous users can post metrics
Parameters: payload (dict) – (optional) dictionary structure containing: * metrics: a list containing dictionaries of the form:
** namespace: label indicating the source of the metric ** time: isoformat datetime when the metric was recorded ** level: an integer representing the metric’s log level ** args: a json string containing an array of extra dataReturn type: dict Returns: status object
-
debugging
= None¶ set to true to send additional debugging info to the log
-
page_revisions
Module¶
API for updating Galaxy Pages
-
class
galaxy.webapps.galaxy.api.page_revisions.
PageRevisionsController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.SharableItemSecurityMixin
,galaxy.model.item_attrs.UsesAnnotations
,galaxy.web.base.controller.SharableMixin
-
create
(self, trans, page_id, payload **kwd)[source]¶ - POST /api/pages/{page_id}/revisions
Create a new revision for a page
Parameters: - page_id – Add revision to Page with ID=page_id
- payload – A dictionary containing:: ‘title’ = New title of the page ‘content’ = New content of the page
Return type: dictionary
Returns: Dictionary with ‘success’ or ‘error’ element to indicate the result of the request
-
pages
Module¶
API for updating Galaxy Pages
-
class
galaxy.webapps.galaxy.api.pages.
PagesController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.SharableItemSecurityMixin
,galaxy.model.item_attrs.UsesAnnotations
,galaxy.web.base.controller.SharableMixin
-
create
(self, trans, payload, **kwd)[source]¶ - POST /api/pages
Create a page and return dictionary containing Page summary
Parameters: payload – dictionary structure containing:: ‘slug’ = The title slug for the page URL, must be unique ‘title’ = Title of the page ‘content’ = HTML contents of the page ‘annotation’ = Annotation that will be attached to the page Return type: dict Returns: Dictionary return of the Page.to_dict call
-
delete
(self, trans, id, **kwd)[source]¶ - DELETE /api/pages/{id}
Create a page and return dictionary containing Page summary
Parameters: id – ID of page to be deleted Return type: dict Returns: Dictionary with ‘success’ or ‘error’ element to indicate the result of the request
-
provenance
Module¶
API operations provenance
quotas
Module¶
API operations on Quota objects.
-
class
galaxy.webapps.galaxy.api.quotas.
QuotaAPIController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controllers.admin.Admin
,galaxy.actions.admin.AdminActions
,galaxy.web.base.controller.UsesQuotaMixin
,galaxy.web.params.QuotaParamParser
-
index
(trans, *args, **kwargs)[source]¶ GET /api/quotas GET /api/quotas/deleted Displays a collection (list) of quotas.
-
show
(trans, *args, **kwargs)[source]¶ GET /api/quotas/{encoded_quota_id} GET /api/quotas/deleted/{encoded_quota_id} Displays information about a quota.
-
request_types
Module¶
API operations on RequestType objects.
-
class
galaxy.webapps.galaxy.api.request_types.
RequestTypeAPIController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
-
create
(trans, *args, **kwargs)[source]¶ POST /api/request_types Creates a new request type (external_service configuration).
-
requests
Module¶
API operations on a sample tracking system.
-
class
galaxy.webapps.galaxy.api.requests.
RequestsAPIController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
-
index
(trans, *args, **kwargs)[source]¶ GET /api/requests Displays a collection (list) of sequencing requests.
-
show
(trans, *args, **kwargs)[source]¶ GET /api/requests/{encoded_request_id} Displays details of a sequencing request.
-
update
(trans, *args, **kwargs)[source]¶ PUT /api/requests/{encoded_request_id} Updates a request state, sample state or sample dataset transfer status depending on the update_type
-
v
= ('REQUEST', 'request_state')¶
-
roles
Module¶
API operations on Role objects.
samples
Module¶
API operations for samples in the Galaxy sample tracking system.
-
class
galaxy.webapps.galaxy.api.samples.
SamplesAPIController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
-
index
(trans, *args, **kwargs)[source]¶ GET /api/requests/{encoded_request_id}/samples Displays a collection (list) of sample of a sequencing request.
-
k
= 'SAMPLE_DATASET'¶
-
update
(trans, *args, **kwargs)[source]¶ PUT /api/samples/{encoded_sample_id} Updates a sample or objects related ( mapped ) to a sample.
-
update_type_values
= ['sample_state', 'run_details', 'sample_dataset_transfer_status']¶
-
update_types
= <galaxy.util.bunch.Bunch object>¶
-
v
= ['sample_dataset_transfer_status']¶
-
search
Module¶
API for searching Galaxy Datasets
-
class
galaxy.webapps.galaxy.api.search.
SearchController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.SharableItemSecurityMixin
tool_data
Module¶
-
class
galaxy.webapps.galaxy.api.tool_data.
ToolData
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
RESTful controller for interactions with tool data
-
delete
(trans, *args, **kwargs)[source]¶ DELETE /api/tool_data/{id} Removes an item from a data table
Parameters: - id (str) – the id of the data table containing the item to delete
- kwd (dict) –
(required) dictionary structure containing:
- payload: a dictionary itself containing:
- values: <TAB> separated list of column contents, there must be a value for all the columns of the data table
-
tool_shed_repositories
Module¶
-
class
galaxy.webapps.galaxy.api.tool_shed_repositories.
ToolShedRepositoriesController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
RESTful controller for interactions with tool shed repositories.
-
exported_workflows
(trans, *args, **kwargs)[source]¶ GET /api/tool_shed_repositories/{encoded_tool_shed_repository_id}/exported_workflows
Display a list of dictionaries containing information about this tool shed repository’s exported workflows.
Parameters: id – the encoded id of the ToolShedRepository object
-
get_latest_installable_revision
(trans, *args, **kwargs)[source]¶ POST /api/tool_shed_repositories/get_latest_installable_revision Get the latest installable revision of a specified repository from a specified Tool Shed.
Parameters: key – the current Galaxy admin user’s API key The following parameters are included in the payload. :param tool_shed_url (required): the base URL of the Tool Shed from which to retrieve the Repository revision. :param name (required): the name of the Repository :param owner (required): the owner of the Repository
-
import_workflow
(trans, *args, **kwargs)[source]¶ POST /api/tool_shed_repositories/import_workflow
Import the specified exported workflow contained in the specified installed tool shed repository into Galaxy.
Parameters: - key – the API key of the Galaxy user with which the imported workflow will be associated.
- id – the encoded id of the ToolShedRepository object
The following parameters are included in the payload. :param index: the index location of the workflow tuple in the list of exported workflows stored in the metadata for the specified repository
-
import_workflows
(trans, *args, **kwargs)[source]¶ POST /api/tool_shed_repositories/import_workflows
Import all of the exported workflows contained in the specified installed tool shed repository into Galaxy.
Parameters: - key – the API key of the Galaxy user with which the imported workflows will be associated.
- id – the encoded id of the ToolShedRepository object
-
index
(trans, *args, **kwargs)[source]¶ GET /api/tool_shed_repositories Display a list of dictionaries containing information about installed tool shed repositories.
-
install_repository_revision
(trans, *args, **kwargs)[source]¶ POST /api/tool_shed_repositories/install_repository_revision Install a specified repository revision from a specified tool shed into Galaxy.
Parameters: key – the current Galaxy admin user’s API key The following parameters are included in the payload. :param tool_shed_url (required): the base URL of the Tool Shed from which to install the Repository :param name (required): the name of the Repository :param owner (required): the owner of the Repository :param changeset_revision (required): the changeset_revision of the RepositoryMetadata object associated with the Repository :param new_tool_panel_section_label (optional): label of a new section to be added to the Galaxy tool panel in which to load
tools contained in the Repository. Either this parameter must be an empty string or the tool_panel_section_id parameter must be an empty string or both must be an empty string (both cannot be used simultaneously).Parameters: - (optional) (shed_tool_conf) – id of the Galaxy tool panel section in which to load tools contained in the Repository. If this parameter is an empty string and the above new_tool_panel_section_label parameter is an empty string, tools will be loaded outside of any sections in the tool panel. Either this parameter must be an empty string or the tool_panel_section_id parameter must be an empty string of both must be an empty string (both cannot be used simultaneously).
- (optional) – Set to True if you want to install repository dependencies defined for the specified repository being installed. The default setting is False.
- (optional) – Set to True if you want to install tool dependencies defined for the specified repository being installed. The default setting is False.
- (optional) – The shed-related tool panel configuration file configured in the “tool_config_file” setting in the Galaxy config file (e.g., galaxy.ini). At least one shed-related tool panel config file is required to be configured. Setting this parameter to a specific file enables you to choose where the specified repository will be installed because the tool_path attribute of the <toolbox> from the specified file is used as the installation location (e.g., <toolbox tool_path=”../shed_tools”>). If this parameter is not set, a shed-related tool panel configuration file will be selected automatically.
-
install_repository_revisions
(trans, *args, **kwargs)[source]¶ POST /api/tool_shed_repositories/install_repository_revisions Install one or more specified repository revisions from one or more specified tool sheds into Galaxy. The received parameters must be ordered lists so that positional values in tool_shed_urls, names, owners and changeset_revisions are associated.
It’s questionable whether this method is needed as the above method for installing a single repository can probably cover all desired scenarios. We’ll keep this one around just in case...
Parameters: key – the current Galaxy admin user’s API key The following parameters are included in the payload. :param tool_shed_urls: the base URLs of the Tool Sheds from which to install a specified Repository :param names: the names of the Repositories to be installed :param owners: the owners of the Repositories to be installed :param changeset_revisions: the changeset_revisions of each RepositoryMetadata object associated with each Repository to be installed :param new_tool_panel_section_label: optional label of a new section to be added to the Galaxy tool panel in which to load
tools contained in the Repository. Either this parameter must be an empty string or the tool_panel_section_id parameter must be an empty string, as both cannot be used.Parameters: - tool_panel_section_id – optional id of the Galaxy tool panel section in which to load tools contained in the Repository. If not set, tools will be loaded outside of any sections in the tool panel. Either this parameter must be an empty string or the tool_panel_section_id parameter must be an empty string, as both cannot be used.
- (optional) (shed_tool_conf) – Set to True if you want to install repository dependencies defined for the specified repository being installed. The default setting is False.
- (optional) – Set to True if you want to install tool dependencies defined for the specified repository being installed. The default setting is False.
- (optional) – The shed-related tool panel configuration file configured in the “tool_config_file” setting in the Galaxy config file (e.g., galaxy.ini). At least one shed-related tool panel config file is required to be configured. Setting this parameter to a specific file enables you to choose where the specified repository will be installed because the tool_path attribute of the <toolbox> from the specified file is used as the installation location (e.g., <toolbox tool_path=”../shed_tools”>). If this parameter is not set, a shed-related tool panel configuration file will be selected automatically.
-
repair_repository_revision
(trans, *args, **kwargs)[source]¶ POST /api/tool_shed_repositories/repair_repository_revision Repair a specified repository revision previously installed into Galaxy.
Parameters: key – the current Galaxy admin user’s API key The following parameters are included in the payload. :param tool_shed_url (required): the base URL of the Tool Shed from which the Repository was installed :param name (required): the name of the Repository :param owner (required): the owner of the Repository :param changeset_revision (required): the changeset_revision of the RepositoryMetadata object associated with the Repository
-
tools
Module¶
users
Module¶
API operations on User objects.
-
class
galaxy.webapps.galaxy.api.users.
UserAPIController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesTagsMixin
,galaxy.web.base.controller.CreatesUsersMixin
,galaxy.web.base.controller.CreatesApiKeysMixin
-
anon_user_api_value
(trans)[source]¶ Returns data for an anonymous user, truncated to only usage and quota_percent
-
api_key
(trans, *args, **kwargs)[source]¶ POST /api/users/{encoded_user_id}/api_key Creates a new API key for specified user.
-
index
(trans, *args, **kwargs)[source]¶ GET /api/users GET /api/users/deleted Displays a collection (list) of users.
-
visualizations
Module¶
Visualizations resource control over the API.
NOTE!: this is a work in progress and functionality and data structures may change often.
-
class
galaxy.webapps.galaxy.api.visualizations.
VisualizationsController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesVisualizationMixin
,galaxy.web.base.controller.SharableMixin
,galaxy.model.item_attrs.UsesAnnotations
RESTful controller for interactions with visualizations.
workflows
Module¶
API operations for Workflows
-
class
galaxy.webapps.galaxy.api.workflows.
WorkflowsAPIController
(app)[source]¶ Bases:
galaxy.web.base.controller.BaseAPIController
,galaxy.web.base.controller.UsesStoredWorkflowMixin
,galaxy.model.item_attrs.UsesAnnotations
,galaxy.web.base.controller.SharableMixin
-
build_module
(trans, *args, **kwargs)[source]¶ POST /api/workflows/build_module Builds module details including a tool model for the workflow editor.
-
cancel_invocation
(trans, *args, **kwargs)[source]¶ DELETE /api/workflows/{workflow_id}/invocation/{invocation_id} Cancel the specified workflow invocation.
Parameters: - workflow_id (str) – the workflow id (required)
- invocation_id (str) – the usage id (required)
Raises: exceptions.MessageException, exceptions.ObjectNotFound
-
create
(trans, *args, **kwargs)[source]¶ POST /api/workflows
Run or create workflows from the api.
If installed_repository_file or from_history_id is specified a new workflow will be created for this user. Otherwise, workflow_id must be specified and this API method will cause a workflow to execute.
:param installed_repository_file The path of a workflow to import. Either workflow_id, installed_repository_file or from_history_id must be specified :type installed_repository_file str
Parameters: - workflow_id (str) – An existing workflow id. Either workflow_id, installed_repository_file or from_history_id must be specified
- parameters (dict) – If workflow_id is set - see _update_step_parameters()
- ds_map (dict) – If workflow_id is set - a dictionary mapping each input step id to a dictionary with 2 keys: ‘src’ (which can be ‘ldda’, ‘ld’ or ‘hda’) and ‘id’ (which should be the id of a LibraryDatasetDatasetAssociation, LibraryDataset or HistoryDatasetAssociation respectively)
- no_add_to_history (str) – If workflow_id is set - if present in the payload with any value, the input datasets will not be added to the selected history
- history (str) – If workflow_id is set - optional history where to run the workflow, either the name of a new history or “hist_id=HIST_ID” where HIST_ID is the id of an existing history. If not specified, the workflow will be run a new unnamed history
- replacement_params (dict) – If workflow_id is set - an optional dictionary used when renaming datasets
- from_history_id (str) – Id of history to extract a workflow from. Either workflow_id, installed_repository_file or from_history_id must be specified
- job_ids (str) – If from_history_id is set - optional list of jobs to include when extracting a workflow from history
- dataset_ids (str) – If from_history_id is set - optional list of HDA `hid`s corresponding to workflow inputs when extracting a workflow from history
- dataset_collection_ids (str) – If from_history_id is set - optional list of HDCA `hid`s corresponding to workflow inputs when extracting a workflow from history
- workflow_name (str) – If from_history_id is set - name of the workflow to create when extracting a workflow from history
-
delete
(trans, *args, **kwargs)[source]¶ DELETE /api/workflows/{encoded_workflow_id} Deletes a specified workflow Author: rpark
copied from galaxy.web.controllers.workflows.py (delete)
-
import_new_workflow_deprecated
(trans, *args, **kwargs)[source]¶ POST /api/workflows/upload Importing dynamic workflows from the api. Return newly generated workflow id. Author: rpark
# currently assumes payload[‘workflow’] is a json representation of a workflow to be inserted into the database
Deprecated in favor to POST /api/workflows with encoded ‘workflow’ in payload the same way.
POST /api/workflows/import Import a workflow shared by other users.
Parameters: workflow_id (str) – the workflow id (required) Raises: exceptions.MessageException, exceptions.ObjectNotFound
-
index
(trans, *args, **kwargs)[source]¶ GET /api/workflows
Displays a collection of workflows.
Parameters: show_published (boolean) – if True, show also published workflows
-
index_invocations
(trans, *args, **kwargs)[source]¶ GET /api/workflows/{workflow_id}/invocations
Get the list of the workflow invocations
Parameters: workflow_id (str) – the workflow id (required) Raises: exceptions.MessageException, exceptions.ObjectNotFound
-
invocation_step
(trans, *args, **kwargs)[source]¶ GET /api/workflows/{workflow_id}/invocation/{invocation_id}/steps/{step_id}
Parameters: - workflow_id (str) – the workflow id (required)
- invocation_id (str) – the invocation id (required)
- step_id (str) – encoded id of the WorkflowInvocationStep (required)
- payload – payload containing update action information for running workflow.
Raises: exceptions.MessageException, exceptions.ObjectNotFound
-
invoke
(trans, *args, **kwargs)[source]¶ POST /api/workflows/{encoded_workflow_id}/invocations
Schedule the workflow specified by workflow_id to run.
-
show
(trans, *args, **kwargs)[source]¶ GET /api/workflows/{encoded_workflow_id}
Displays information needed to run a workflow from the command line.
-
show_invocation
(trans, *args, **kwargs)[source]¶ GET /api/workflows/{workflow_id}/invocation/{invocation_id} Get detailed description of workflow invocation
Parameters: - workflow_id (str) – the workflow id (required)
- invocation_id (str) – the invocation id (required)
Raises: exceptions.MessageException, exceptions.ObjectNotFound
-
update
(trans, *args, **kwargs)[source]¶ - PUT /api/workflows/{id}
updates the workflow stored with
id
Parameters: - id (str) – the encoded id of the workflow to update
- payload (dict) –
a dictionary containing any or all the * workflow the json description of the workflow as would be
produced by GET workflows/<id>/download or given to POST workflowsThe workflow contents will be updated to target this.
Return type: dict
Returns: serialized version of the workflow
-
update_invocation_step
(trans, *args, **kwargs)[source]¶ PUT /api/workflows/{workflow_id}/invocation/{invocation_id}/steps/{step_id} Update state of running workflow step invocation - still very nebulous but this would be for stuff like confirming paused steps can proceed etc....
Parameters: - workflow_id (str) – the workflow id (required)
- invocation_id (str) – the usage id (required)
- step_id (str) – encoded id of the WorkflowInvocationStep (required)
Raises: exceptions.MessageException, exceptions.ObjectNotFound
-