A base representation of an instance of Galaxy, identified by a URL and a user’s API key.
After you have created an GalaxyInstance object, access various modules via the class fields (see the source for the most up-to-date list): libraries, histories, workflows, datasets, and users are the minimum set supported. For example, to work with histories, and get a list of all the user’s histories, the following should be done:
from bioblend import galaxy
gi = galaxy.GalaxyInstance(url='http://127.0.0.1:8000', key='your_api_key')
hl = gi.histories.get_histories()
print "List of histories:", hl
Parameters: |
|
---|
A base representation of an instance of Galaxy, identified by a URL and a user’s API key.
After you have created an GalaxyInstance object, access various modules via the class fields (see the source for the most up-to-date list): libraries, histories, workflows, datasets, and users are the minimum set supported. For example, to work with histories, and get a list of all the user’s histories, the following should be done:
from bioblend import galaxy
gi = galaxy.GalaxyInstance(url='http://127.0.0.1:8000', key='your_api_key')
hl = gi.histories.get_histories()
print "List of histories:", hl
Parameters: |
|
---|
Make a DELETE request using the provided url and the optional arguments. The payload must be a dict that can be converted into a JSON object (via simplejson.dumps)
If the params are not provided, use default_params class field. If params are provided and the provided dict does not have key key, the default self.key value will be included in what’s passed to the server via the request.
Make a GET request using the provided url.
If the params are not provided, use default_params class field. If params are provided and the provided dict does not have key key, the default self.key value will be included in what’s passed to the server via the request.
Make a POST request using the provided url and payload. The payload must be a dict that contains the request values. The payload dict may contain file handles (in which case the files_attached flag must be set to true).
If the params are not provided, use default_params class field. If params are provided and the provided dict does not have key key, the default self.key value will be included in what’s passed to the server via the request.
The return value will contain the response body as a JSON object.
Contains possible interactions with the Galaxy Data Libraries
Create a folder in the given library and the base folder. If base_folder_id is not provided, the new folder will be created in the root folder.
Create a data library with the properties defined in the arguments. Return a list of JSON dicts, looking like so:
[{"id": "f740ab636b360a70",
"name": "Library from bioblend",
"url": "/api/libraries/f740ab636b360a70"}]
Get all the libraries or filter for specific one(s) via the provided name or ID. Provide only one argument: name or library_id.
If name is set and multiple names match the given name, all the libraries matching the argument will be returned.
Return a list of JSON formatted dicts each containing basic information about a library.
Get information about a library.
If want to get contents of the library (rather than just the library details), set contents to True.
Return a list of JSON formatted dicts containing library details.
Upload pasted_contents to a data library as a new file. If folder_id is not specified, the file will be placed in the root folder.
Read local file contents from file_local_path and upload data to a library. If folder_id is not specified, the file will be placed in the root folder.
Upload a file to a library from a path on the server where Galaxy is running. If folder_id is not provided, the file will be placed in the root folder.
Note that for this method to work, the Galaxy instance you’re connecting to must have the configuration option library_import_dir set in universe_wsgi.ini. The value of that configuration option should be a base directory from where more specific directories can be specified as part of the server_dir argument. All and only the files (ie, no folders) specified by the server_dir argument will be uploaded to the data library.
Upload a file to a library from a URL. If folder_id is not specified, the file will be uploaded to the root folder.
Upload a file from filesystem paths already present on the Galaxy server.
Provides API access for the ‘Upload files from filesystem paths’ approach.
Contains possible interactions with the Galaxy Histories
Delete a history.
If purge is set to True, also purge the history. Note that for the purge option to work, allow_user_dataset_purge option must be set in the Galaxy’s configuration file universe_wsgi.ini
Returns the current user’s most recently used history object (not deleted)
Get all histories or filter the specific one(s) via the provided name or history_id. Provide only one argument, name or history_id, but not both.
If deleted is set to True, return histories that have been deleted.
Return a list of history element dicts. If more than one history matches the given name, return the list of all the histories with the given name.
Returns the state of this history as a dictionary, with the following keys. ‘state’ = This is the current state of the history, such as ok, error, new etc. ‘state_details’ = Contains individual statistics for various dataset states. ‘percent_complete’ = The overall number of datasets processed to completion.
Get details about a given history dataset. The required history_id can be obtained from the datasets’s history content details.
Contains possible interactions with the Galaxy Workflows
Exports a workflow in json format
Parameters: | workflow_id (string) – Encoded workflow ID |
---|
Exports a workflow in json format to a given local path.
Parameters: |
|
---|
Get a list of all workflows
Return type: | list |
---|---|
Returns: | A list of workflow dicts.
For example:[{u'id': u'92c56938c2f9b315',
u'name': u'Simple',
u'url': u'/api/workflows/92c56938c2f9b315'}]
|
Imports a new workflow given the path to a file containing a previously exported workflow.
Imports a new workflow given a json representation of a previously exported workflow.
Run the workflow identified by workflow_id
Parameters: |
|
---|---|
Return type: | dict |
Returns: | A dict containing the history ID where the outputs are placed as well as output dataset IDs. For example: {u'history': u'64177123325c9cfd',
u'outputs': [u'aa4d3084af404259']}
|
Display information needed to run a workflow
Parameters: | workflow_id (string) – Encoded workflow ID |
---|---|
Return type: | list |
Returns: | A description of the workflow and its inputs as a JSON object.
For example:{u'id': u'92c56938c2f9b315',
u'inputs': {u'23': {u'label': u'Input Dataset', u'value': u''}},
u'name': u'Simple',
u'url': u'/api/workflows/92c56938c2f9b315'}
|
Contains possible interactions with the Galaxy Datasets
Downloads the dataset identified by ‘id’.
Parameters: |
|
---|---|
Return type: | dict |
Returns: | If a file_path argument is not provided, returns a dict containing the file_content. Otherwise returns nothing. |
Contains possible interaction dealing with Galaxy users.
These methods must be executed by a registered Galaxy admin user.
Create a new Galaxy user.
Note
For this method to work, the Galaxy instance must have allow_user_creation and use_remote_user options set to True in the universe_wsgi.ini configuration file. Also note that setting use_remote_user will require an upstream authentication proxy server; however, if you do not have one, access to Galaxy via a browser will not be possible.
Get a list of all registered users. If deleted is set to True, get a list of deleted users.
Return type: | list |
---|---|
Returns: | A list of dicts with user details.
For example:[{u'email': u'a_user@example.com',
u'id': u'dda47097d9189f15',
u'url': u'/api/users/dda47097d9189f15'}]
|