ephemeris package

Submodules

ephemeris.common_parser module

ephemeris.common_parser.get_common_args(login_required=True)[source]

ephemeris.generate_tool_list_from_ga_workflow_files module

Tool to generate tools from workflows

ephemeris.generate_tool_list_from_ga_workflow_files.generate_tool_list_from_workflow(workflow_files, panel_label, output_file)[source]
Return type:object
ephemeris.generate_tool_list_from_ga_workflow_files.get_workflow_dictionary(json_file)[source]
ephemeris.generate_tool_list_from_ga_workflow_files.main()[source]
ephemeris.generate_tool_list_from_ga_workflow_files.print_yaml_tool_list(tool_dictionary, output_file)[source]
ephemeris.generate_tool_list_from_ga_workflow_files.reduce_tool_list(tool_list)[source]
ephemeris.generate_tool_list_from_ga_workflow_files.translate_workflow_dictionary_to_tool_list(tool_dictionary, panel_label)[source]

ephemeris.get_tool_list_from_galaxy module

Tool to extract a tool list from galaxy.

class ephemeris.get_tool_list_from_galaxy.GiToToolYaml(url, output_file, include_tool_panel_section_id=False, skip_tool_panel_section_name=True, skip_changeset_revision=False)[source]
filter_section_name_or_id_or_changeset()[source]
get_repo_from_tool(tool)[source]

Get the minimum items required for re-installing a (list of) tools

get_repos_from_section(section)[source]
get_repositories()[source]

Toolbox elements returned by api/tools may be of class ToolSection or Tool. Parse these accordingly to get a list of repositories.

merge_tool_changeset_revisions()[source]

Each installed changeset revision of a tool is listed individually. Merge revisions of the same tool into a list.

toolbox

Gets the toolbox elements from <galaxy_url>/api/tools

write_to_yaml()[source]
ephemeris.get_tool_list_from_galaxy.check_galaxy_version(galaxy_url)[source]
ephemeris.get_tool_list_from_galaxy.main()[source]

ephemeris.run_data_managers module

Run-data-managers is a tool for provisioning data on a galaxy instance.

Run-data-managers has the ability to reload the datatables after a data manager has finished. It is therefore able to run multiple data managers that are interdependent. When a reference genome is needed for bwa-mem for example, Run-data-managers can first run a data manager to fetch the fasta file, reload the data table and run another data manager that indexes the fasta file for bwa-mem.

Run-data-managers needs a yaml that specifies what data managers are run and with which settings. An example file can be found here.

By default run-data-managers skips entries in the yaml file that have already been run. It checks it in the following way: * If the data manager has input variables “name” or “sequence_name” it will check if the “name” column in the data table already has this entry.

“name” will take precedence over “sequence_name”.
  • If the data manager has input variables “value”, “sequence_id” or ‘dbkey’ it will check if the “value” column in the data table already has this entry. Value takes precedence over sequence_id which takes precedence over dbkey.
  • If none of the above input variables are specified the data manager will always run.
ephemeris.run_data_managers.data_table_entry_exists(tool_data_client, data_table_name, entry, column='value')[source]

Checks whether an entry exists in the a specified column in the data_table.

ephemeris.run_data_managers.get_name_from_inputs(input_dict)[source]

Returns the value that will most likely be recorded in the “name” column of the datatable. Or returns False

ephemeris.run_data_managers.get_value_from_inputs(input_dict)[source]

Returns the value that will most likely be recorded in the “value” column of the datatable. Or returns False

ephemeris.run_data_managers.input_entries_exist_in_data_tables(tool_data_client, data_tables, input_dict)[source]

Checks whether name and value entries from the input are already present in the data tables. If an entry is missing in of the tables, this function returns False

ephemeris.run_data_managers.main()[source]
ephemeris.run_data_managers.parse_items(items, genomes)[source]
ephemeris.run_data_managers.run_dm(args)[source]
ephemeris.run_data_managers.wait(gi, job)[source]

Waits until a data_manager is finished or failed. It will check the state of the created datasets every 30s.

ephemeris.setup_data_libraries module

Tool to setup data libraries on a galaxy instance

ephemeris.setup_data_libraries.main()[source]
ephemeris.setup_data_libraries.setup_data_libraries(gi, data)[source]

Load files into a Galaxy data library. By default all test-data tools from all installed tools will be linked into a data library.

ephemeris.shed_install module

NOTE: While shed-install can be used to run data managers, it is recommended to use run-data-managers instead.

A script to automate installation of tool repositories from a Galaxy Tool Shed into an instance of Galaxy. Galaxy instance details and the installed tools can be provided in one of three ways:

  1. In the YAML format via dedicated files (a sample can be found here).
  2. On the command line as dedicated script options (see the usage help).
  3. As a single composite parameter to the script. The parameter must be a single, YAML-formatted string with the keys corresponding to the keys available for use in the YAML formatted file (for example: –yaml_tool “{‘owner’: ‘kellrott’, ‘tool_shed_url’: ‘https://testtoolshed.g2.bx.psu.edu’, ‘tool_panel_section_id’: ‘peak_calling’, ‘name’: ‘synapse_interface’}”).

Only one of the methods can be used with each invocation of the script but if more than one are provided are provided, precedence will correspond to order of the items in the list above. When installing tools, Galaxy expects any tool_panel_section_id provided when installing a tool to already exist in the configuration. If the section does not exist, the tool will be installed outside any section. See shed_tool_conf.xml.sample in this directory for a sample of such file. Before running this script to install the tools, make sure to place such file into Galaxy’s configuration directory and set Galaxy configuration option tool_config_file to include it.

class ephemeris.shed_install.InstallToolManager(tools_info, gi, default_install_tool_dependencies=False, default_install_resolver_dependencies=True, default_install_repository_dependencies=True, require_tool_panel_info=True)[source]

Bases: object

create_tool_install_payload(tool_info)[source]

For each listed tool (tool_info) we generate a payload that contains all required parameters, filling up missing parameters with user-defined and/or default settings. Return None if a required parameter is missing

get_changeset_revision(tool)[source]

Select the correct changeset revision for a tool, and make sure the tool exists (i.e a request to the tool shed with name and owner returns a list of revisions). Return tool or None, if the tool could not be found on the specified tool shed.

install_tools()[source]
class ephemeris.shed_install.ProgressConsoleHandler(stream=None)[source]

Bases: logging.StreamHandler

A handler class which allows the cursor to stay on one line for selected messages

emit(record)[source]
on_same_line = False
ephemeris.shed_install.dump_to_yaml_file(content, file_name)[source]

Dump YAML-compatible content to file_name.

ephemeris.shed_install.galaxy_instance(url=None, api_key=None)[source]

Get an instance of the GalaxyInstance object. If the arguments are not provided, load the default values using load_input_file method.

ephemeris.shed_install.get_install_tool_manager(options)[source]

Parse the default input file and proceed to install listed tools. :type options: OptionParser object :param options: command line arguments parsed by OptionParser

ephemeris.shed_install.install_repository_revision(tool, tsc)[source]

Adjusts tool dictionary to bioblend signature and installs single tool

ephemeris.shed_install.installed_tool_revisions(gi=None, omit=None)[source]

Get a list of tool revisions installed from a Tool Shed on a Galaxy instance. Included are all the tool revisions that were installed from a Tool Shed and are available from /api/tool_shed_repositories url on the given instance of Galaxy. :type gi: GalaxyInstance object :param gi: A GalaxyInstance object as retured by galaxy_instance method. :type omit: list of strings :param omit: A list of strings that, if found in a tool name, will result

in the tool not being included in the returned list.
Return type:list of dicts
Returns:Each dict in the returned list will have the following keys: name, owner, tool_shed_url, revisions.

See also

this method returns a subset of data returned by installed_tools function

ephemeris.shed_install.installed_tools(gi, omit=None)[source]

Get a list of tools on a Galaxy instance. :type gi: GalaxyInstance object :param gi: A GalaxyInstance object as retured by galaxy_instance method. :type omit: list of strings :param omit: A list of strings that, if found in a tool name, will result

in the tool not being included in the returned list.
Return type:dict
Returns:The returned dictionary contains the following keys, each containing a list of dictionaries:
  • tool_panel_shed_tools with a list of tools available in the

tool panel that were installed on the target Galaxy instance from the Tool Shed; - tool_panel_custom_tools with a list of tools available in the tool panel that were not installed via the Tool Shed; - shed_tools with a list of tools returned from the installed_tool_revisions function and complemented with a tool_panel_section_id key as matched with the list of tools from the first element of the returned triplet. Note that the two lists (shed_tools and tool_panel_shed_tools) are likely to be different and hence not every element in the shed_tools will have the tool_panel_section_id!

See also

installed_tool_revisions (this function also returns the output of the installed_tool_revisions function, as shed_tools key).

ephemeris.shed_install.load_input_file(tool_list_file='tool_list.yaml')[source]

Load YAML from the tool_list_file and return a dict with the content.

ephemeris.shed_install.log_tool_install_error(tool, start, msg, errored_tools)[source]

Log failed tool installations

ephemeris.shed_install.log_tool_install_success(tool, start, installed_tools)[source]

Log successfull tool installation. Tools that finish in error still count as successfull installs currently.

ephemeris.shed_install.run_data_managers(options)[source]

Run Galaxy Data Manager to download, index, and install reference genome data into Galaxy. :type options: OptionParser object :param options: command line arguments parsed by OptionParser

ephemeris.shed_install.script_main()[source]
ephemeris.shed_install.setup_global_logger(include_file=False)[source]
ephemeris.shed_install.the_same_tool(tool_1_info, tool_2_info)[source]

Given two dicts containing info about tools, determine if they are the same tool. Each of the dicts must have the following keys: name, owner, and (either tool_shed or tool_shed_url).

ephemeris.shed_install.tool_shed_client(gi=None)[source]

Get an instance of the ToolShedClient on a given Galaxy instance. If no value is provided for the galaxy_instance, use the default provided via load_input_file.

ephemeris.shed_install.wait_for_install(tool, tsc, timeout=3600)[source]

If nginx times out, we look into the list of installed repositories and try to determine if a tool of the same namer/owner is still installing. Returns True if install finished, returns False when timeout is exceeded.

ephemeris.sleep module

Utility to do a blocking sleep until a Galaxy instance is responsive. This is useful in docker images, in RUN steps, where one needs to wait for a currently starting Galaxy to be alive, before API requests can be made successfully.

The script functions by making repeated requests to http(s)://fqdn/api/version, an API which requires no authentication to access.

ephemeris.sleep.main()[source]

Main function

ephemeris.workflow_install module

Tool to install workflows on a Galaxy instance.

ephemeris.workflow_install.import_workflow(gi, path)[source]

Given a connection to a Galaxy Instance (gi) and a path to a Galaxy workflow file, this function will import the worklfow into Galaxy.

ephemeris.workflow_install.main()[source]

This script uses bioblend to import .ga workflow files into a running instance of Galaxy

Module contents

ephemeris.get_galaxy_connection(args)[source]

Return a Galaxy connection, given a user or an API key.