Warning

This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

galaxy.tool_util.parser package

Package responsible for parsing tools from files/abstract tool sources.

galaxy.tool_util.parser.get_input_source(content)[source]

Wrap dicts or XML elements as InputSource if needed.

If the supplied content is already an InputSource object, it is simply returned. This allow Galaxy to uniformly consume using the tool input source interface.

galaxy.tool_util.parser.get_tool_source(config_file: str | PathLike | None = None, xml_tree: ElementTree | None = None, enable_beta_formats: bool = True, tool_location_fetcher: ToolLocationFetcher | None = None, macro_paths: List[str] | None = None, tool_source_class: str | None = None, raw_tool_source: str | None = None) ToolSource[source]

Return a ToolSource object corresponding to supplied source.

The supplied source may be specified as a file path (using the config_file parameter) or as an XML object loaded with load_tool_with_refereces.

galaxy.tool_util.parser.get_tool_source_from_representation(tool_format, tool_representation)[source]
class galaxy.tool_util.parser.RequiredFiles(includes: List[Dict], excludes: List[Dict], extend_default_excludes: bool)[source]

Bases: object

__init__(includes: List[Dict], excludes: List[Dict], extend_default_excludes: bool)[source]
static from_dict(as_dict)[source]
find_required_files(tool_directory: str) List[str][source]
class galaxy.tool_util.parser.ToolOutputCollectionPart(output_collection_def, element_identifier, output_def, parent_ids=None)[source]

Bases: object

__init__(output_collection_def, element_identifier, output_def, parent_ids=None)[source]
property effective_output_name
static is_named_collection_part_name(name)[source]
static split_output_name(name)[source]
class galaxy.tool_util.parser.ToolSource[source]

Bases: object

This interface represents an abstract source to parse tool information from.

language: str
abstract parse_id() str | None[source]

Parse an ID describing the abstract tool. This is not the GUID tracked by the tool shed but the simple id (there may be multiple tools loaded in Galaxy with this same simple id).

abstract parse_version() str | None[source]

Parse a version describing the abstract tool.

parse_tool_module() Tuple[str, str] | None[source]

Load Tool class from a custom module. (Optional).

If not None, return pair containing module and class (as strings).

parse_action_module()[source]

Load Tool class from a custom module. (Optional).

If not None, return pair containing module and class (as strings).

parse_tool_type() str | None[source]

Load simple tool type string (e.g. ‘data_source’, ‘default’).

abstract parse_name() str[source]

Parse a short name for tool (required).

abstract parse_description() str[source]

Parse a description for tool. Longer than name, shorted than help.

We parse this out as “” if it isn’t explicitly declared.

parse_edam_operations() List[str][source]

Parse list of edam operation codes.

parse_edam_topics() List[str][source]

Parse list of edam topic codes.

abstract parse_xrefs() List[XrefDict][source]

Parse list of external resource URIs and types.

parse_display_interface(default)[source]

Parse display_interface - fallback to default for the tool type (supplied as default parameter) if not specified.

parse_require_login(default)[source]

Parse whether the tool requires login (as a bool).

parse_request_param_translation_elem()[source]

Return an XML element describing require parameter translation.

If we wish to support this feature for non-XML based tools this should be converted to return some sort of object interface instead of a RAW XML element.

abstract parse_command()[source]

Return string contianing command to run.

parse_expression()[source]

Return string contianing command to run.

abstract parse_environment_variables()[source]

Return environment variable templates to expose.

parse_home_target()[source]

Should be “job_home”, “shared_home”, “job_tmp”, “pwd”, or None.

parse_tmp_target()[source]

Should be “pwd”, “shared_home”, “job_tmp”, “job_tmp_if_explicit”, or None.

parse_tmp_directory_vars()[source]

Directories to override if a tmp_target is not None.

parse_docker_env_pass_through()[source]
abstract parse_interpreter()[source]

Return string containing the interpreter to prepend to the command (for instance this might be ‘python’ to run a Python wrapper located adjacent to the tool).

abstract parse_interactivetool()[source]

Return InteractiveTool entry point templates to expose.

parse_redirect_url_params_elem()[source]

Return an XML element describing redirect_url_params.

If we wish to support this feature for non-XML based tools this should be converted to return some sort of object interface instead of a RAW XML element.

parse_version_command()[source]

Parse command used to determine version of primary application driving the tool. Return None to not generate or record such a command.

parse_version_command_interpreter()[source]

Parse command used to determine version of primary application driving the tool. Return None to not generate or record such a command.

parse_parallelism()[source]

Return a galaxy.jobs.ParallismInfo object describing task splitting or None.

parse_hidden()[source]

Return boolean indicating whether tool should be hidden in the tool menu.

parse_sanitize()[source]

Return boolean indicating whether tool should be sanitized or not.

parse_refresh()[source]

Return boolean indicating … I have no clue…

parse_required_files() RequiredFiles | None[source]

Parse explicit RequiredFiles object or return None to let Galaxy decide implicit logic.

abstract parse_requirements_and_containers() Tuple[ToolRequirements, List[ContainerDescription], List[ResourceRequirement]][source]

Return triple of ToolRequirement, ContainerDescription and ResourceRequirement lists.

abstract parse_input_pages() PagesSource[source]

Return a PagesSource representing inputs by page for tool.

parse_provided_metadata_style()[source]

Return style of tool provided metadata file (e.g. galaxy.json).

A value of of “default” indicates the newer galaxy.json style (the default for XML-based tools with profile >= 17.09) and a value of “legacy” indicates the older galaxy.json style.

A short description of these two styles can be found at https://github.com/galaxyproject/galaxy/pull/4437.

parse_provided_metadata_file()[source]

Return location of provided metadata file (e.g. galaxy.json).

abstract parse_outputs(tool)[source]

Return a pair of output and output collections ordered dictionaries for use by Tool.

abstract parse_strict_shell()[source]

Return True if tool commands should be executed with set -e.

abstract parse_stdio()[source]

Builds lists of ToolStdioExitCode and ToolStdioRegex objects to describe tool execution error conditions.

abstract parse_help() HelpContent | None[source]

Return help text for tool or None if the tool doesn’t define help text.

The returned object contains the help text and an indication if it is reStructuredText (restructuredtext), Markdown (markdown), or plain text (plain_text).

abstract parse_profile() str[source]

Return tool profile version as Galaxy major e.g. 16.01 or 16.04.

abstract parse_license() str | None[source]

Return license corresponding to tool wrapper.

parse_citations() List[Citation][source]

Return a list of citations.

abstract parse_python_template_version() Version | None[source]

Return minimum python version that the tool template has been developed against.

parse_creator()[source]

Return list of metadata relating to creator/author of tool.

Result should be list of schema.org data model Person or Organization objects.

property macro_paths
property source_path
paths_and_modtimes()[source]
parse_tests_to_dict() ToolSourceTests[source]
abstract to_string() str[source]

Return the tool source as a string

class galaxy.tool_util.parser.XrefDict[source]

Bases: TypedDict

value: str
reftype: str

Submodules

galaxy.tool_util.parser.cwl module

class galaxy.tool_util.parser.cwl.CwlToolSource(tool_file=None, strict_cwl_validation=True, tool_proxy: ToolProxy | None = None)[source]

Bases: ToolSource

language: str = 'yaml'
__init__(tool_file=None, strict_cwl_validation=True, tool_proxy: ToolProxy | None = None)[source]
property source_path
property tool_proxy: ToolProxy
parse_tool_type()[source]

Load simple tool type string (e.g. ‘data_source’, ‘default’).

parse_id()[source]

Parse an ID describing the abstract tool. This is not the GUID tracked by the tool shed but the simple id (there may be multiple tools loaded in Galaxy with this same simple id).

parse_name()[source]

Parse a short name for tool (required).

parse_command()[source]

Return string contianing command to run.

parse_environment_variables()[source]

Return environment variable templates to expose.

parse_edam_operations()[source]

Parse list of edam operation codes.

parse_edam_topics()[source]

Parse list of edam topic codes.

parse_help()[source]

Return help text for tool or None if the tool doesn’t define help text.

The returned object contains the help text and an indication if it is reStructuredText (restructuredtext), Markdown (markdown), or plain text (plain_text).

parse_sanitize()[source]

Return boolean indicating whether tool should be sanitized or not.

parse_strict_shell()[source]

Return True if tool commands should be executed with set -e.

parse_stdio()[source]

Builds lists of ToolStdioExitCode and ToolStdioRegex objects to describe tool execution error conditions.

parse_interpreter()[source]

Return string containing the interpreter to prepend to the command (for instance this might be ‘python’ to run a Python wrapper located adjacent to the tool).

parse_version()[source]

Parse a version describing the abstract tool.

parse_description()[source]

Parse a description for tool. Longer than name, shorted than help.

We parse this out as “” if it isn’t explicitly declared.

parse_interactivetool()[source]

Return InteractiveTool entry point templates to expose.

parse_input_pages() PagesSource[source]

Return a PagesSource representing inputs by page for tool.

parse_outputs(tool)[source]

Return a pair of output and output collections ordered dictionaries for use by Tool.

parse_requirements_and_containers()[source]

Return triple of ToolRequirement, ContainerDescription and ResourceRequirement lists.

parse_profile()[source]

Return tool profile version as Galaxy major e.g. 16.01 or 16.04.

parse_xrefs()[source]

Parse list of external resource URIs and types.

parse_license()[source]

Return license corresponding to tool wrapper.

parse_python_template_version()[source]

Return minimum python version that the tool template has been developed against.

to_string()[source]

Return the tool source as a string

galaxy.tool_util.parser.cwl.tool_proxy(tool_path=None, tool_object=None, strict_cwl_validation=True, tool_directory=None, uuid=None) ToolProxy[source]

Provide a proxy object to cwltool data structures to just grab relevant data.

galaxy.tool_util.parser.factory module

Constructors for concrete tool and input source objects.

galaxy.tool_util.parser.factory.get_tool_source(config_file: str | PathLike | None = None, xml_tree: ElementTree | None = None, enable_beta_formats: bool = True, tool_location_fetcher: ToolLocationFetcher | None = None, macro_paths: List[str] | None = None, tool_source_class: str | None = None, raw_tool_source: str | None = None) ToolSource[source]

Return a ToolSource object corresponding to supplied source.

The supplied source may be specified as a file path (using the config_file parameter) or as an XML object loaded with load_tool_with_refereces.

galaxy.tool_util.parser.factory.get_input_source(content)[source]

Wrap dicts or XML elements as InputSource if needed.

If the supplied content is already an InputSource object, it is simply returned. This allow Galaxy to uniformly consume using the tool input source interface.

galaxy.tool_util.parser.interface module

class galaxy.tool_util.parser.interface.AssertionDict[source]

Bases: TypedDict

tag: str
attributes: Dict[str, Any]
children: List[AssertionDict] | None
class galaxy.tool_util.parser.interface.OutputCompareType(value)[source]

Bases: str, Enum

An enumeration.

diff = 'diff'
re_match = 're_match'
sim_size = 'sim_size'
re_match_multiline = 're_match_multiline'
contains = 'contains'
image_diff = 'image_diff'
class galaxy.tool_util.parser.interface.ToolSourceTestOutputAttributes[source]

Bases: TypedDict

object: typing_extensions.NotRequired[Any | None]
compare: OutputCompareType
lines_diff: int
delta: int
delta_frac: float | None
sort: bool
decompress: bool
location: typing_extensions.NotRequired[str | None]
ftype: typing_extensions.NotRequired[str | None]
eps: float
metric: str
pin_labels: Any | None
count: int | None
metadata: Dict[str, Any]
md5: str | None
checksum: str | None
primary_datasets: Dict[str, Any]
elements: Dict[str, Any]
assert_list: List[AssertionDict] | None
extra_files: List[Dict[str, Any]]
class galaxy.tool_util.parser.interface.ToolSourceTestOutput[source]

Bases: TypedDict

name: str
value: str | None
attributes: ToolSourceTestOutputAttributes
class galaxy.tool_util.parser.interface.ToolSourceTestInput[source]

Bases: TypedDict

name: str
value: Any | None
attributes: Dict[str, Any]
class galaxy.tool_util.parser.interface.ToolSourceTest[source]

Bases: TypedDict

inputs: List[ToolSourceTestInput]
outputs: List[ToolSourceTestOutput]
output_collections: List[Any]
stdout: List[AssertionDict] | None
stderr: List[AssertionDict] | None
expect_exit_code: str | int | None
expect_failure: bool
expect_test_failure: bool
maxseconds: str | int | None
expect_num_outputs: str | int | None
command: List[AssertionDict] | None
command_version: List[AssertionDict] | None
class galaxy.tool_util.parser.interface.ToolSourceTests[source]

Bases: TypedDict

tests: List[ToolSourceTest]
class galaxy.tool_util.parser.interface.XrefDict[source]

Bases: TypedDict

value: str
reftype: str
class galaxy.tool_util.parser.interface.Citation(*, type: str, content: str)[source]

Bases: BaseModel

type: str
content: str
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'content': FieldInfo(annotation=str, required=True), 'type': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class galaxy.tool_util.parser.interface.HelpContent(*, format: typing_extensions.Literal[restructuredtext, plain_text, markdown], content: str)[source]

Bases: BaseModel

format: typing_extensions.Literal[restructuredtext, plain_text, markdown]
content: str
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'content': FieldInfo(annotation=str, required=True), 'format': FieldInfo(annotation=Literal['restructuredtext', 'plain_text', 'markdown'], required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class galaxy.tool_util.parser.interface.ToolSource[source]

Bases: object

This interface represents an abstract source to parse tool information from.

language: str
abstract parse_id() str | None[source]

Parse an ID describing the abstract tool. This is not the GUID tracked by the tool shed but the simple id (there may be multiple tools loaded in Galaxy with this same simple id).

abstract parse_version() str | None[source]

Parse a version describing the abstract tool.

parse_tool_module() Tuple[str, str] | None[source]

Load Tool class from a custom module. (Optional).

If not None, return pair containing module and class (as strings).

parse_action_module()[source]

Load Tool class from a custom module. (Optional).

If not None, return pair containing module and class (as strings).

parse_tool_type() str | None[source]

Load simple tool type string (e.g. ‘data_source’, ‘default’).

abstract parse_name() str[source]

Parse a short name for tool (required).

abstract parse_description() str[source]

Parse a description for tool. Longer than name, shorted than help.

We parse this out as “” if it isn’t explicitly declared.

parse_edam_operations() List[str][source]

Parse list of edam operation codes.

parse_edam_topics() List[str][source]

Parse list of edam topic codes.

abstract parse_xrefs() List[XrefDict][source]

Parse list of external resource URIs and types.

parse_display_interface(default)[source]

Parse display_interface - fallback to default for the tool type (supplied as default parameter) if not specified.

parse_require_login(default)[source]

Parse whether the tool requires login (as a bool).

parse_request_param_translation_elem()[source]

Return an XML element describing require parameter translation.

If we wish to support this feature for non-XML based tools this should be converted to return some sort of object interface instead of a RAW XML element.

abstract parse_command()[source]

Return string contianing command to run.

parse_expression()[source]

Return string contianing command to run.

abstract parse_environment_variables()[source]

Return environment variable templates to expose.

parse_home_target()[source]

Should be “job_home”, “shared_home”, “job_tmp”, “pwd”, or None.

parse_tmp_target()[source]

Should be “pwd”, “shared_home”, “job_tmp”, “job_tmp_if_explicit”, or None.

parse_tmp_directory_vars()[source]

Directories to override if a tmp_target is not None.

parse_docker_env_pass_through()[source]
abstract parse_interpreter()[source]

Return string containing the interpreter to prepend to the command (for instance this might be ‘python’ to run a Python wrapper located adjacent to the tool).

abstract parse_interactivetool()[source]

Return InteractiveTool entry point templates to expose.

parse_redirect_url_params_elem()[source]

Return an XML element describing redirect_url_params.

If we wish to support this feature for non-XML based tools this should be converted to return some sort of object interface instead of a RAW XML element.

parse_version_command()[source]

Parse command used to determine version of primary application driving the tool. Return None to not generate or record such a command.

parse_version_command_interpreter()[source]

Parse command used to determine version of primary application driving the tool. Return None to not generate or record such a command.

parse_parallelism()[source]

Return a galaxy.jobs.ParallismInfo object describing task splitting or None.

parse_hidden()[source]

Return boolean indicating whether tool should be hidden in the tool menu.

parse_sanitize()[source]

Return boolean indicating whether tool should be sanitized or not.

parse_refresh()[source]

Return boolean indicating … I have no clue…

parse_required_files() RequiredFiles | None[source]

Parse explicit RequiredFiles object or return None to let Galaxy decide implicit logic.

abstract parse_requirements_and_containers() Tuple[ToolRequirements, List[ContainerDescription], List[ResourceRequirement]][source]

Return triple of ToolRequirement, ContainerDescription and ResourceRequirement lists.

abstract parse_input_pages() PagesSource[source]

Return a PagesSource representing inputs by page for tool.

parse_provided_metadata_style()[source]

Return style of tool provided metadata file (e.g. galaxy.json).

A value of of “default” indicates the newer galaxy.json style (the default for XML-based tools with profile >= 17.09) and a value of “legacy” indicates the older galaxy.json style.

A short description of these two styles can be found at https://github.com/galaxyproject/galaxy/pull/4437.

parse_provided_metadata_file()[source]

Return location of provided metadata file (e.g. galaxy.json).

abstract parse_outputs(tool)[source]

Return a pair of output and output collections ordered dictionaries for use by Tool.

abstract parse_strict_shell()[source]

Return True if tool commands should be executed with set -e.

abstract parse_stdio()[source]

Builds lists of ToolStdioExitCode and ToolStdioRegex objects to describe tool execution error conditions.

abstract parse_help() HelpContent | None[source]

Return help text for tool or None if the tool doesn’t define help text.

The returned object contains the help text and an indication if it is reStructuredText (restructuredtext), Markdown (markdown), or plain text (plain_text).

abstract parse_profile() str[source]

Return tool profile version as Galaxy major e.g. 16.01 or 16.04.

abstract parse_license() str | None[source]

Return license corresponding to tool wrapper.

parse_citations() List[Citation][source]

Return a list of citations.

abstract parse_python_template_version() Version | None[source]

Return minimum python version that the tool template has been developed against.

parse_creator()[source]

Return list of metadata relating to creator/author of tool.

Result should be list of schema.org data model Person or Organization objects.

property macro_paths
property source_path
paths_and_modtimes()[source]
parse_tests_to_dict() ToolSourceTests[source]
abstract to_string() str[source]

Return the tool source as a string

class galaxy.tool_util.parser.interface.PagesSource(page_sources)[source]

Bases: object

Contains a list of Pages - each a list of InputSources - each item in the outer list representing a page of inputs. Pages are deprecated so ideally this outer list will always be exactly a singleton.

__init__(page_sources)[source]
property inputs_defined
class galaxy.tool_util.parser.interface.DynamicOptions[source]

Bases: object

elem() Element[source]
abstract get_data_table_name() str | None[source]

If dynamic options are loaded from a data table, return the name.

abstract get_index_file_name() str | None[source]

If dynamic options are loaded from an index file, return the name.

class galaxy.tool_util.parser.interface.DrillDownDynamicOptions[source]

Bases: object

abstract from_code_block() str | None[source]

Get a code block to do an eval on.

class galaxy.tool_util.parser.interface.InputSource[source]

Bases: object

default_optional = False
elem()[source]
abstract get(key, value=None)[source]

Return simple named properties as string for this input source. keys to be supported depend on the parameter type.

abstract get_bool(key, default)[source]

Return simple named properties as boolean for this input source. keys to be supported depend on the parameter type.

abstract get_bool_or_none(key, default)[source]

Return simple named properties as boolean or none for this input source. keys to be supported depend on the parameter type.

parse_label()[source]
parse_name()[source]

Return name of an input source returns the name or if absent the argument property In the latter case, leading dashes are stripped and all remaining dashes are replaced by underscores.

abstract parse_input_type() str[source]

Return the type of this input.

parse_help()[source]
parse_sanitizer_elem()[source]

Return an XML description of sanitizers. This is a stop gap until we can rework galaxy.tools.parameters.sanitize to not explicitly depend on XML.

parse_validator_elems()[source]

Return an XML description of sanitizers. This is a stop gap until we can rework galaxy.tools.parameters.validation to not explicitly depend on XML.

parse_optional(default=None)[source]

Return boolean indicating whether parameter is optional.

parse_dynamic_options() DynamicOptions | None[source]

Return an optional element describing dynamic options.

These options are still very XML based but as they are adapted to the infrastructure, the return type here will evolve.

parse_drill_down_dynamic_options(tool_data_path: str | None = None) DrillDownDynamicOptions | None[source]
parse_static_options() List[Tuple[str, str, bool]][source]

Return list of static options if this is a select type without defining a dynamic options.

parse_drill_down_static_options(tool_data_path: str | None = None) List[DrillDownOptionsDict] | None[source]
parse_conversion_tuples()[source]

Return list of (name, extension) to describe explicit conversions.

parse_nested_inputs_source()[source]
parse_test_input_source() InputSource[source]
parse_when_input_sources()[source]
parse_default() Dict[str, Any] | None[source]
class galaxy.tool_util.parser.interface.PageSource[source]

Bases: object

parse_display()[source]
abstract parse_input_sources() List[InputSource][source]

Return a list of InputSource objects.

class galaxy.tool_util.parser.interface.TestCollectionDefElementDict[source]

Bases: TypedDict

element_identifier: str
element_definition: JsonTestCollectionDefDict | XmlTestCollectionDefDict | ToolSourceTestInput
class galaxy.tool_util.parser.interface.TestCollectionDefElementInternal[source]

Bases: TypedDict

element_identifier: str
element_definition: TestCollectionDef | ToolSourceTestInput
class galaxy.tool_util.parser.interface.XmlTestCollectionDefDict[source]

Bases: TypedDict

model_class: typing_extensions.Literal[TestCollectionDef]
attributes: Dict[str, Any]
collection_type: str
elements: List[TestCollectionDefElementDict]
name: str
class galaxy.tool_util.parser.interface.JsonTestDatasetDefDict

Bases: TypedDict

class: typing_extensions.Literal[File]
path: typing_extensions.NotRequired[str | None]
location: typing_extensions.NotRequired[str | None]
name: typing_extensions.NotRequired[str | None]
dbkey: typing_extensions.NotRequired[str | None]
filetype: typing_extensions.NotRequired[str | None]
composite_data: typing_extensions.NotRequired[List[str] | None]
tags: typing_extensions.NotRequired[List[str] | None]
class galaxy.tool_util.parser.interface.JsonTestCollectionDefDatasetElementDict

Bases: TypedDict

identifier: str
class: typing_extensions.Literal[File]
path: typing_extensions.NotRequired[str | None]
location: typing_extensions.NotRequired[str | None]
name: typing_extensions.NotRequired[str | None]
dbkey: typing_extensions.NotRequired[str | None]
filetype: typing_extensions.NotRequired[str | None]
composite_data: typing_extensions.NotRequired[List[str] | None]
tags: typing_extensions.NotRequired[List[str] | None]
class galaxy.tool_util.parser.interface.BaseJsonTestCollectionDefCollectionElementDict

Bases: TypedDict

class: typing_extensions.Literal[Collection]
collection_type: str
elements: typing_extensions.NotRequired[List[JsonTestCollectionDefDatasetElementDict | JsonTestCollectionDefCollectionElementDict] | None]
class galaxy.tool_util.parser.interface.JsonTestCollectionDefCollectionElementDict

Bases: TypedDict

identifier: str
class: typing_extensions.Literal[Collection]
collection_type: str
elements: typing_extensions.NotRequired[List[JsonTestCollectionDefDatasetElementDict | JsonTestCollectionDefCollectionElementDict] | None]
class galaxy.tool_util.parser.interface.JsonTestCollectionDefDict

Bases: TypedDict

class: typing_extensions.Literal[Collection]
collection_type: str
elements: typing_extensions.NotRequired[List[JsonTestCollectionDefDatasetElementDict | JsonTestCollectionDefCollectionElementDict] | None]
name: typing_extensions.NotRequired[str | None]
galaxy.tool_util.parser.interface.xml_data_input_to_json(xml_input: ToolSourceTestInput) JsonTestDatasetDefDict | None[source]
class galaxy.tool_util.parser.interface.TestCollectionDef(attrib, name, collection_type, elements)[source]

Bases: object

__init__(attrib, name, collection_type, elements)[source]
elements: List[TestCollectionDefElementInternal]
test_format_to_dict() JsonTestCollectionDefDict[source]
to_dict() XmlTestCollectionDefDict[source]
static from_dict(as_dict: JsonTestCollectionDefDict | XmlTestCollectionDefDict | JsonTestCollectionDefCollectionElementDict) TestCollectionDef[source]
collect_inputs()[source]
class galaxy.tool_util.parser.interface.RequiredFiles(includes: List[Dict], excludes: List[Dict], extend_default_excludes: bool)[source]

Bases: object

__init__(includes: List[Dict], excludes: List[Dict], extend_default_excludes: bool)[source]
static from_dict(as_dict)[source]
find_required_files(tool_directory: str) List[str][source]
class galaxy.tool_util.parser.interface.TestCollectionOutputDef(name, attrib, element_tests, element_count: int | None = None)[source]

Bases: object

__init__(name, attrib, element_tests, element_count: int | None = None)[source]
static from_dict(as_dict)[source]
static from_yaml_test_format(as_dict)[source]
to_dict()[source]
class galaxy.tool_util.parser.interface.DrillDownOptionsDict[source]

Bases: TypedDict

name: str | None
value: str
options: List[DrillDownOptionsDict]
selected: bool

galaxy.tool_util.parser.output_actions module

Support for dynamically modifying output attributes.

class galaxy.tool_util.parser.output_actions.ToolOutputActionGroup(parent, config_elem)[source]

Bases: object

Manages a set of tool output dataset actions directives

tag = 'group'
__init__(parent, config_elem)[source]
apply_action(output_dataset, other_values) None[source]
property tool
class galaxy.tool_util.parser.output_actions.ToolOutputActionConditionalWhen(parent, config_elem, value)[source]

Bases: ToolOutputActionGroup

tag = 'when'
classmethod from_elem(parent, when_elem)[source]

Loads the proper when by attributes of elem

__init__(parent, config_elem, value)[source]
is_case(other_values)[source]
get_ref(other_values)[source]
apply_action(output_dataset, other_values) None[source]
class galaxy.tool_util.parser.output_actions.ValueToolOutputActionConditionalWhen(parent, config_elem, value)[source]

Bases: ToolOutputActionConditionalWhen

tag = 'when value'
is_case(other_values) bool[source]
class galaxy.tool_util.parser.output_actions.DatatypeIsInstanceToolOutputActionConditionalWhen(parent, config_elem, value)[source]

Bases: ToolOutputActionConditionalWhen

tag = 'when datatype_isinstance'
__init__(parent, config_elem, value)[source]
is_case(other_values) bool[source]
class galaxy.tool_util.parser.output_actions.ToolOutputActionConditional(parent, config_elem)[source]

Bases: object

tag = 'conditional'
__init__(parent, config_elem)[source]
apply_action(output_dataset, other_values) None[source]
property tool
class galaxy.tool_util.parser.output_actions.ToolOutputAction(parent, elem)[source]

Bases: object

tag = 'action'
classmethod from_elem(parent, elem)[source]

Loads the proper action by the type attribute of elem

__init__(parent, elem)[source]
apply_action(output_dataset, other_values)[source]
property tool
class galaxy.tool_util.parser.output_actions.ToolOutputActionOption(parent, elem)[source]

Bases: object

tag = 'object'
classmethod from_elem(parent, elem)[source]

Loads the proper action by the type attribute of elem

__init__(parent, elem)[source]
get_value(other_values)[source]
property tool
class galaxy.tool_util.parser.output_actions.NullToolOutputActionOption(parent, elem)[source]

Bases: ToolOutputActionOption

tag = 'null_option'
get_value(other_values)[source]
class galaxy.tool_util.parser.output_actions.FromFileToolOutputActionOption(parent, elem)[source]

Bases: ToolOutputActionOption

tag = 'from_file'
__init__(parent, elem)[source]
get_value(other_values)[source]
class galaxy.tool_util.parser.output_actions.FromParamToolOutputActionOption(parent, elem)[source]

Bases: ToolOutputActionOption

tag = 'from_param'
__init__(parent, elem)[source]
get_value(other_values)[source]
class galaxy.tool_util.parser.output_actions.FromDataTableOutputActionOption(parent, elem)[source]

Bases: ToolOutputActionOption

tag = 'from_data_table'
__init__(parent, elem)[source]
get_value(other_values)[source]
class galaxy.tool_util.parser.output_actions.MetadataToolOutputAction(parent, elem)[source]

Bases: ToolOutputAction

tag = 'metadata'
__init__(parent, elem)[source]
apply_action(output_dataset, other_values) None[source]
class galaxy.tool_util.parser.output_actions.FormatToolOutputAction(parent, elem)[source]

Bases: ToolOutputAction

tag = 'format'
__init__(parent, elem)[source]
apply_action(output_dataset, other_values) None[source]
class galaxy.tool_util.parser.output_actions.ToolOutputActionOptionFilter(parent, elem)[source]

Bases: object

tag = 'filter'
classmethod from_elem(parent, elem)[source]

Loads the proper action by the type attribute of elem

__init__(parent, elem)[source]
filter_options(options, other_values)[source]
property tool
class galaxy.tool_util.parser.output_actions.ParamValueToolOutputActionOptionFilter(parent, elem)[source]

Bases: ToolOutputActionOptionFilter

tag = 'param_value'
__init__(parent, elem)[source]
filter_options(options, other_values)[source]
class galaxy.tool_util.parser.output_actions.InsertColumnToolOutputActionOptionFilter(parent, elem)[source]

Bases: ToolOutputActionOptionFilter

tag = 'insert_column'
__init__(parent, elem)[source]
filter_options(options, other_values)[source]
class galaxy.tool_util.parser.output_actions.MultipleSplitterFilter(parent, elem)[source]

Bases: ToolOutputActionOptionFilter

tag = 'multiple_splitter'
__init__(parent, elem)[source]
filter_options(options, other_values)[source]
class galaxy.tool_util.parser.output_actions.ColumnStripFilter(parent, elem)[source]

Bases: ToolOutputActionOptionFilter

tag = 'column_strip'
__init__(parent, elem)[source]
filter_options(options, other_values)[source]
class galaxy.tool_util.parser.output_actions.ColumnReplaceFilter(parent, elem)[source]

Bases: ToolOutputActionOptionFilter

tag = 'column_replace'
__init__(parent, elem)[source]
filter_options(options, other_values)[source]
class galaxy.tool_util.parser.output_actions.MetadataValueFilter(parent, elem)[source]

Bases: ToolOutputActionOptionFilter

tag = 'metadata_value'
__init__(parent, elem)[source]
filter_options(options, other_values)[source]
class galaxy.tool_util.parser.output_actions.BooleanFilter(parent, elem)[source]

Bases: ToolOutputActionOptionFilter

tag = 'boolean'
__init__(parent, elem)[source]
filter_options(options, other_values)[source]
galaxy.tool_util.parser.output_actions.action_type

alias of FormatToolOutputAction

galaxy.tool_util.parser.output_actions.filter_type

alias of ColumnReplaceFilter

galaxy.tool_util.parser.output_actions.option_type

alias of FromDataTableOutputActionOption

class galaxy.tool_util.parser.output_actions.StringFunctionFilter(parent, elem)[source]

Bases: ToolOutputActionOptionFilter

tag = 'string_function'
__init__(parent, elem)[source]
filter_options(options, other_values)[source]
galaxy.tool_util.parser.output_actions.parse_cast_attribute(cast)[source]
galaxy.tool_util.parser.output_actions.parse_compare_type(compare)[source]
galaxy.tool_util.parser.output_actions.compare_eq(value1, value2)[source]
galaxy.tool_util.parser.output_actions.compare_neq(value1, value2)[source]
galaxy.tool_util.parser.output_actions.compare_gt(value1, value2)[source]
galaxy.tool_util.parser.output_actions.compare_gte(value1, value2)[source]
galaxy.tool_util.parser.output_actions.compare_lt(value1, value2)[source]
galaxy.tool_util.parser.output_actions.compare_lte(value1, value2)[source]
galaxy.tool_util.parser.output_actions.compare_in(value1, value2)[source]
galaxy.tool_util.parser.output_actions.compare_startswith(value1, value2)[source]
galaxy.tool_util.parser.output_actions.compare_endswith(value1, value2)[source]

galaxy.tool_util.parser.output_collection_def module

This module define an abstract class for reasoning about Galaxy’s dataset collection after jobs are finished.

galaxy.tool_util.parser.output_collection_def.dataset_collector_descriptions_from_elem(elem, legacy=True)[source]
galaxy.tool_util.parser.output_collection_def.dataset_collector_descriptions_from_output_dict(as_dict)[source]
galaxy.tool_util.parser.output_collection_def.dataset_collector_descriptions_from_list(discover_datasets_dicts)[source]
galaxy.tool_util.parser.output_collection_def.dataset_collection_description(**kwargs)[source]
class galaxy.tool_util.parser.output_collection_def.DatasetCollectionDescription(**kwargs)[source]

Bases: object

discover_via: typing_extensions.Literal[tool_provided_metadata, pattern]
__init__(**kwargs)[source]
default_ext: str | None
default_visible: bool
assign_primary_output: bool
directory: str | None
recurse: bool
match_relative_path: bool
abstract to_model() FilePatternDatasetCollectionDescription | ToolProvidedMetadataDatasetCollection[source]
to_dict() dict[source]
property discover_patterns: List[str]
class galaxy.tool_util.parser.output_collection_def.ToolProvidedMetadataDatasetCollection(**kwargs)[source]

Bases: DatasetCollectionDescription

discover_via: typing_extensions.Literal[tool_provided_metadata, pattern] = 'tool_provided_metadata'
to_model() ToolProvidedMetadataDatasetCollection[source]
to_dict() dict[source]
default_ext: str | None
default_visible: bool
assign_primary_output: bool
directory: str | None
recurse: bool
match_relative_path: bool
class galaxy.tool_util.parser.output_collection_def.FilePatternDatasetCollectionDescription(**kwargs)[source]

Bases: DatasetCollectionDescription

discover_via: typing_extensions.Literal[tool_provided_metadata, pattern] = 'pattern'
__init__(**kwargs)[source]
pattern: str
sort_key: typing_extensions.Literal[filename, name, designation, dbkey]
sort_comp: typing_extensions.Literal[lexical, numeric]
to_model() FilePatternDatasetCollectionDescription[source]
property discover_patterns: List[str]

galaxy.tool_util.parser.output_objects module

class galaxy.tool_util.parser.output_objects.ChangeFormatModel[source]

Bases: TypedDict

value: str | None
format: str | None
input: str | None
input_dataset: str | None
check_attribute: str | None
class galaxy.tool_util.parser.output_objects.ToolOutputBase(name: str, label: str | None = None, filters: List[Element] | None = None, hidden: bool = False, from_expression: str | None = None)[source]

Bases: Dictifiable

__init__(name: str, label: str | None = None, filters: List[Element] | None = None, hidden: bool = False, from_expression: str | None = None) None[source]
name: str
label: str | None
hidden: bool
to_dict(view='collection', value_mapper=None, app=None)[source]

Return item dictionary.

property output_discover_patterns: List[str]
class galaxy.tool_util.parser.output_objects.ToolOutput(name: str, format: str | None = None, format_source: str | None = None, metadata_source: str | None = None, parent: str | None = None, label: str | None = None, filters: List[Element] | None = None, actions: ToolOutputActionGroup | None = None, hidden: bool = False, implicit: bool = False, from_expression: str | None = None)[source]

Bases: ToolOutputBase

Represents an output datasets produced by a tool. For backward compatibility this behaves as if it were the tuple:

(format, metadata_source, parent)
dict_collection_visible_keys = ['name', 'format', 'label', 'hidden', 'output_type', 'format_source', 'default_identifier_source', 'metadata_source', 'parent', 'count', 'from_work_dir']
__init__(name: str, format: str | None = None, format_source: str | None = None, metadata_source: str | None = None, parent: str | None = None, label: str | None = None, filters: List[Element] | None = None, actions: ToolOutputActionGroup | None = None, hidden: bool = False, implicit: bool = False, from_expression: str | None = None) None[source]
to_dict(view='collection', value_mapper=None, app=None)[source]

Return item dictionary.

to_model() ToolOutputDataset[source]
static from_dict(name: str, output_dict: Dict[str, Any], tool: object | None = None) ToolOutput[source]
property output_discover_patterns: List[str]
name: str
label: str | None
hidden: bool
class galaxy.tool_util.parser.output_objects.ToolExpressionOutput(name, output_type, from_expression, label=None, filters=None, actions=None, hidden=False)[source]

Bases: ToolOutputBase

dict_collection_visible_keys = ('name', 'format', 'label', 'hidden', 'output_type')
__init__(name, output_type, from_expression, label=None, filters=None, actions=None, hidden=False)[source]
to_model() ToolOutputDataset | ToolOutputCollection | ToolOutputText | ToolOutputInteger | ToolOutputFloat | ToolOutputBoolean[source]
name: str
label: str | None
hidden: bool
class galaxy.tool_util.parser.output_objects.ToolOutputCollection(name: str, structure: ToolOutputCollectionStructure, label: str | None = None, filters: List[Element] | None = None, hidden: bool = False, default_format: str = 'data', default_format_source: str | None = None, default_metadata_source: str | None = None, inherit_format: bool = False, inherit_metadata: bool = False)[source]

Bases: ToolOutputBase

Represents a HistoryDatasetCollectionAssociation of output datasets produced by a tool.

<outputs>
<collection type="list" label="${tool.name} on ${on_string} fasta">
    <discover_datasets pattern="__name__" ext="fasta" visible="True" directory="outputFiles" />
</collection>
<collection type="paired" label="${tool.name} on ${on_string} paired reads">
    <data name="forward" format="fastqsanger" />
    <data name="reverse" format="fastqsanger"/>
</collection>
<outputs>
dict_collection_visible_keys = ['name', 'format', 'label', 'hidden', 'output_type', 'default_format', 'default_format_source', 'default_metadata_source', 'inherit_format', 'inherit_metadata']
__init__(name: str, structure: ToolOutputCollectionStructure, label: str | None = None, filters: List[Element] | None = None, hidden: bool = False, default_format: str = 'data', default_format_source: str | None = None, default_metadata_source: str | None = None, inherit_format: bool = False, inherit_metadata: bool = False) None[source]
known_outputs(inputs, type_registry)[source]
property dynamic_structure
property dataset_collector_descriptions
to_dict(view='collection', value_mapper=None, app=None)[source]

Return item dictionary.

to_model() ToolOutputCollection[source]
static from_dict(name, output_dict, tool=None) ToolOutputCollection[source]
property output_discover_patterns: List[str]
name: str
label: str | None
hidden: bool
class galaxy.tool_util.parser.output_objects.ToolOutputCollectionStructure(collection_type: str | None, collection_type_source: str | None = None, collection_type_from_rules: str | None = None, structured_like: str | None = None, dataset_collector_descriptions: List[DatasetCollectionDescription] | None = None)[source]

Bases: object

__init__(collection_type: str | None, collection_type_source: str | None = None, collection_type_from_rules: str | None = None, structured_like: str | None = None, dataset_collector_descriptions: List[DatasetCollectionDescription] | None = None) None[source]
collection_type: str | None
collection_type_source: str | None
collection_type_from_rules: str | None
structured_like: str | None
dataset_collector_descriptions: List[DatasetCollectionDescription] | None
dynamic: bool
collection_prototype(inputs, type_registry)[source]
to_dict()[source]
to_model() ToolOutputCollectionStructure[source]
static from_dict(as_dict) ToolOutputCollectionStructure[source]
property output_discover_patterns: List[str]
class galaxy.tool_util.parser.output_objects.ToolOutputCollectionPart(output_collection_def, element_identifier, output_def, parent_ids=None)[source]

Bases: object

__init__(output_collection_def, element_identifier, output_def, parent_ids=None)[source]
property effective_output_name
static is_named_collection_part_name(name)[source]
static split_output_name(name)[source]

galaxy.tool_util.parser.stdio module

class galaxy.tool_util.parser.stdio.StdioErrorLevel[source]

Bases: object

These determine stdio-based error levels from matching on regular expressions and exit codes. They are meant to be used comparatively, such as showing that warning < fatal. This is really meant to just be an enum.

NO_ERROR = 0
LOG = 1
QC = 1.1
WARNING = 2
FATAL = 3
FATAL_OOM = 4
MAX = 4
descs = {0: 'No error', 1: 'Log', 1.1: 'QC', 2: 'Warning', 3: 'Fatal error', 4: 'Out of memory error'}
static desc(error_level)[source]
class galaxy.tool_util.parser.stdio.ToolStdioExitCode(as_dict=None)[source]

Bases: object

This is a container for the <stdio> element’s <exit_code> subelement. The exit_code element has a range of exit codes and the error level.

__init__(as_dict=None)[source]
to_dict()[source]
class galaxy.tool_util.parser.stdio.ToolStdioRegex(as_dict=None)[source]

Bases: object

This is a container for the <stdio> element’s regex subelement. The regex subelement has a “match” attribute, a “sources” attribute that contains “output” and/or “error”, and a “level” attribute that contains “warning” or “fatal”.

__init__(as_dict=None)[source]
to_dict()[source]
galaxy.tool_util.parser.stdio.error_on_exit_code(out_of_memory_exit_code=None)[source]
galaxy.tool_util.parser.stdio.aggressive_error_checks()[source]

galaxy.tool_util.parser.util module

galaxy.tool_util.parser.util.is_dict(item)[source]
galaxy.tool_util.parser.util.parse_profile_version(tool_source: ToolSource) float[source]
galaxy.tool_util.parser.util.parse_tool_version_with_defaults(id: str | None, tool_source: ToolSource, profile: Version | None = None) str[source]
galaxy.tool_util.parser.util.boolean_is_checked(input_source: InputSource)[source]
galaxy.tool_util.parser.util.boolean_true_and_false_values(input_source, profile: float | str | None = None) Tuple[str, str][source]
exception galaxy.tool_util.parser.util.ParameterParseException(message)[source]

Bases: Exception

__init__(message)[source]
message: str

galaxy.tool_util.parser.xml module

galaxy.tool_util.parser.xml.inject_validates(inject)[source]
galaxy.tool_util.parser.xml.destroy_tree(tree)[source]
galaxy.tool_util.parser.xml.parse_change_format(change_format: Iterable[Element]) List[ChangeFormatModel][source]
class galaxy.tool_util.parser.xml.XmlToolSource(xml_tree: ElementTree, source_path=None, macro_paths=None)[source]

Bases: ToolSource

Responsible for parsing a tool from classic Galaxy representation.

language: str = 'xml'
__init__(xml_tree: ElementTree, source_path=None, macro_paths=None)[source]
to_string()[source]

Return the tool source as a string

mem_optimize()[source]
parse_version() str | None[source]

Parse a version describing the abstract tool.

parse_id()[source]

Parse an ID describing the abstract tool. This is not the GUID tracked by the tool shed but the simple id (there may be multiple tools loaded in Galaxy with this same simple id).

parse_tool_module()[source]

Load Tool class from a custom module. (Optional).

If not None, return pair containing module and class (as strings).

parse_action_module()[source]

Load Tool class from a custom module. (Optional).

If not None, return pair containing module and class (as strings).

parse_tool_type()[source]

Load simple tool type string (e.g. ‘data_source’, ‘default’).

parse_name()[source]

Parse a short name for tool (required).

parse_edam_operations()[source]

Parse list of edam operation codes.

parse_edam_topics()[source]

Parse list of edam topic codes.

parse_xrefs() List[XrefDict][source]

Parse list of external resource URIs and types.

parse_description() str[source]

Parse a description for tool. Longer than name, shorted than help.

We parse this out as “” if it isn’t explicitly declared.

parse_display_interface(default)[source]

Parse display_interface - fallback to default for the tool type (supplied as default parameter) if not specified.

parse_require_login(default)[source]

Parse whether the tool requires login (as a bool).

parse_request_param_translation_elem()[source]

Return an XML element describing require parameter translation.

If we wish to support this feature for non-XML based tools this should be converted to return some sort of object interface instead of a RAW XML element.

parse_command()[source]

Return string contianing command to run.

parse_expression()[source]

Return string containing command to run.

parse_environment_variables()[source]

Return environment variable templates to expose.

parse_home_target()[source]

Should be “job_home”, “shared_home”, “job_tmp”, “pwd”, or None.

parse_tmp_target()[source]

Should be “pwd”, “shared_home”, “job_tmp”, “job_tmp_if_explicit”, or None.

parse_interpreter()[source]

Return string containing the interpreter to prepend to the command (for instance this might be ‘python’ to run a Python wrapper located adjacent to the tool).

parse_version_command()[source]

Parse command used to determine version of primary application driving the tool. Return None to not generate or record such a command.

parse_version_command_interpreter()[source]

Parse command used to determine version of primary application driving the tool. Return None to not generate or record such a command.

parse_parallelism()[source]

Return a galaxy.jobs.ParallismInfo object describing task splitting or None.

parse_interactivetool()[source]

Return InteractiveTool entry point templates to expose.

parse_hidden()[source]

Return boolean indicating whether tool should be hidden in the tool menu.

parse_redirect_url_params_elem()[source]

Return an XML element describing redirect_url_params.

If we wish to support this feature for non-XML based tools this should be converted to return some sort of object interface instead of a RAW XML element.

parse_sanitize()[source]

Return boolean indicating whether tool should be sanitized or not.

parse_refresh()[source]

Return boolean indicating … I have no clue…

parse_required_files() RequiredFiles | None[source]

Parse explicit RequiredFiles object or return None to let Galaxy decide implicit logic.

parse_requirements_and_containers()[source]

Return triple of ToolRequirement, ContainerDescription and ResourceRequirement lists.

parse_input_pages() XmlPagesSource[source]

Return a PagesSource representing inputs by page for tool.

parse_provided_metadata_style()[source]

Return style of tool provided metadata file (e.g. galaxy.json).

A value of of “default” indicates the newer galaxy.json style (the default for XML-based tools with profile >= 17.09) and a value of “legacy” indicates the older galaxy.json style.

A short description of these two styles can be found at https://github.com/galaxyproject/galaxy/pull/4437.

parse_provided_metadata_file()[source]

Return location of provided metadata file (e.g. galaxy.json).

parse_outputs(tool=None)[source]

Return a pair of output and output collections ordered dictionaries for use by Tool.

parse_stdio()[source]

parse error handling from command and stdio tag

returns list of exit codes, list of regexes

  • exit_codes contain all non-zero exit codes (:-1 and 1:) if detect_errors is default (if not legacy), exit_code, or aggressive

  • the oom_exit_code if given and detect_errors is exit_code

  • exit codes and regexes from the stdio tag these are prepended to the list, i.e. are evaluated prior to regexes and exit codes derived from the properties of the command tag. thus more specific regexes of the same or more severe error level are triggered first.

parse_strict_shell()[source]

Return True if tool commands should be executed with set -e.

parse_help() HelpContent | None[source]

Return help text for tool or None if the tool doesn’t define help text.

The returned object contains the help text and an indication if it is reStructuredText (restructuredtext), Markdown (markdown), or plain text (plain_text).

property macro_paths
property source_path
parse_tests_to_dict() ToolSourceTests[source]
parse_profile() str[source]

Return tool profile version as Galaxy major e.g. 16.01 or 16.04.

parse_license() str | None[source]

Return license corresponding to tool wrapper.

parse_citations() List[Citation][source]

Return a list of citations.

parse_python_template_version()[source]

Return minimum python version that the tool template has been developed against.

parse_creator()[source]

Return list of metadata relating to creator/author of tool.

Result should be list of schema.org data model Person or Organization objects.

class galaxy.tool_util.parser.xml.StdioParser(root)[source]

Bases: object

__init__(root)[source]
parse_stdio_exit_codes(stdio_elem)[source]

Parse the tool’s <stdio> element’s <exit_code> subelements. This will add all of those elements, if any, to self.stdio_exit_codes.

parse_stdio_regexes(stdio_elem)[source]

Look in the tool’s <stdio> elem for all <regex> subelements that define how to look for warnings and fatal errors in stdout and stderr. This will add all such regex elements to the Tols’s stdio_regexes list.

parse_error_level(err_level)[source]

Parses error level and returns error level enumeration. If unparsable, returns ‘fatal’

class galaxy.tool_util.parser.xml.XmlPagesSource(root)[source]

Bases: PagesSource

__init__(root)[source]
property inputs_defined
class galaxy.tool_util.parser.xml.XmlPageSource(parent_elem)[source]

Bases: PageSource

__init__(parent_elem)[source]
parse_display()[source]
parse_input_sources()[source]

Return a list of InputSource objects.

class galaxy.tool_util.parser.xml.XmlDynamicOptions(options_elem: Element)[source]

Bases: DynamicOptions

__init__(options_elem: Element)[source]
elem() Element[source]
get_data_table_name() str | None[source]

If dynamic options are loaded from a data table, return the name.

get_index_file_name() str | None[source]

If dynamic options are loaded from an index file, return the name.

class galaxy.tool_util.parser.xml.XmlInputSource(input_elem)[source]

Bases: InputSource

__init__(input_elem)[source]
parse_input_type()[source]

Return the type of this input.

elem()[source]
get(key, value=None)[source]

Return simple named properties as string for this input source. keys to be supported depend on the parameter type.

get_bool(key, default)[source]

Return simple named properties as boolean for this input source. keys to be supported depend on the parameter type.

get_bool_or_none(key, default)[source]

Return simple named properties as boolean or none for this input source. keys to be supported depend on the parameter type.

parse_label()[source]
parse_help()[source]
parse_sanitizer_elem()[source]

Return an XML description of sanitizers. This is a stop gap until we can rework galaxy.tools.parameters.sanitize to not explicitly depend on XML.

parse_validator_elems()[source]

Return an XML description of sanitizers. This is a stop gap until we can rework galaxy.tools.parameters.validation to not explicitly depend on XML.

parse_dynamic_options() XmlDynamicOptions | None[source]

Return a XmlDynamicOptions to describe dynamic options if options elem is available.

parse_static_options() List[Tuple[str, str, bool]][source]
>>> from galaxy.util import parse_xml_string_to_etree
>>> xml = '<param><option value="a">A</option><option value="b">B</option></param>'
>>> xis = XmlInputSource(parse_xml_string_to_etree(xml).getroot())
>>> xis.parse_static_options()
[('A', 'a', False), ('B', 'b', False)]
>>> xml = '<param><option value="a"/><option value="b"/><option value="a" selected="true"/></param>'
>>> xis = XmlInputSource(parse_xml_string_to_etree(xml).getroot())
>>> xis.parse_static_options()
[('a', 'a', True), ('b', 'b', False)]
parse_drill_down_dynamic_options(tool_data_path: str | None = None) DrillDownDynamicOptions | None[source]
parse_drill_down_static_options(tool_data_path: str | None = None) List[DrillDownOptionsDict] | None[source]
parse_optional(default=None)[source]

Return boolean indicating whether parameter is optional.

parse_conversion_tuples()[source]

Return list of (name, extension) to describe explicit conversions.

parse_nested_inputs_source()[source]
parse_test_input_source()[source]
parse_when_input_sources()[source]
parse_default() Dict[str, Any] | None[source]
class galaxy.tool_util.parser.xml.ParallelismInfo(tag)[source]

Bases: object

Stores the information (if any) for running multiple instances of the tool in parallel on the same set of inputs.

__init__(tag)[source]
galaxy.tool_util.parser.xml.parse_citation_elem(citation_elem: Element) Citation | None[source]
class galaxy.tool_util.parser.xml.XmlDrillDownDynamicOptions(code_block: str | None)[source]

Bases: DrillDownDynamicOptions

__init__(code_block: str | None)[source]
from_code_block() str | None[source]

Get a code block to do an eval on.

galaxy.tool_util.parser.yaml module

class galaxy.tool_util.parser.yaml.YamlToolSource(root_dict: Dict, source_path=None)[source]

Bases: ToolSource

language: str = 'yaml'
__init__(root_dict: Dict, source_path=None)[source]
property source_path
parse_tool_type()[source]

Load simple tool type string (e.g. ‘data_source’, ‘default’).

parse_id()[source]

Parse an ID describing the abstract tool. This is not the GUID tracked by the tool shed but the simple id (there may be multiple tools loaded in Galaxy with this same simple id).

parse_version() str | None[source]

Parse a version describing the abstract tool.

parse_name() str[source]

Parse a short name for tool (required).

parse_description() str[source]

Parse a description for tool. Longer than name, shorted than help.

We parse this out as “” if it isn’t explicitly declared.

parse_edam_operations() List[str][source]

Parse list of edam operation codes.

parse_edam_topics() List[str][source]

Parse list of edam topic codes.

parse_xrefs() List[XrefDict][source]

Parse list of external resource URIs and types.

parse_sanitize()[source]

Return boolean indicating whether tool should be sanitized or not.

parse_display_interface(default)[source]

Parse display_interface - fallback to default for the tool type (supplied as default parameter) if not specified.

parse_require_login(default)[source]

Parse whether the tool requires login (as a bool).

parse_command()[source]

Return string contianing command to run.

parse_expression()[source]

Return string contianing command to run.

parse_environment_variables()[source]

Return environment variable templates to expose.

parse_interpreter()[source]

Return string containing the interpreter to prepend to the command (for instance this might be ‘python’ to run a Python wrapper located adjacent to the tool).

parse_version_command()[source]

Parse command used to determine version of primary application driving the tool. Return None to not generate or record such a command.

parse_version_command_interpreter()[source]

Parse command used to determine version of primary application driving the tool. Return None to not generate or record such a command.

parse_requirements_and_containers()[source]

Return triple of ToolRequirement, ContainerDescription and ResourceRequirement lists.

parse_input_pages() PagesSource[source]

Return a PagesSource representing inputs by page for tool.

parse_strict_shell()[source]

Return True if tool commands should be executed with set -e.

parse_stdio()[source]

Builds lists of ToolStdioExitCode and ToolStdioRegex objects to describe tool execution error conditions.

parse_help() HelpContent | None[source]

Return help text for tool or None if the tool doesn’t define help text.

The returned object contains the help text and an indication if it is reStructuredText (restructuredtext), Markdown (markdown), or plain text (plain_text).

parse_outputs(tool)[source]

Return a pair of output and output collections ordered dictionaries for use by Tool.

parse_tests_to_dict() ToolSourceTests[source]
parse_profile() str[source]

Return tool profile version as Galaxy major e.g. 16.01 or 16.04.

parse_license() str | None[source]

Return license corresponding to tool wrapper.

parse_interactivetool()[source]

Return InteractiveTool entry point templates to expose.

parse_python_template_version()[source]

Return minimum python version that the tool template has been developed against.

to_string()[source]

Return the tool source as a string

galaxy.tool_util.parser.yaml.to_test_assert_list(assertions) List[AssertionDict] | None[source]
class galaxy.tool_util.parser.yaml.YamlPageSource(inputs_list)[source]

Bases: PageSource

__init__(inputs_list)[source]
parse_input_sources()[source]

Return a list of InputSource objects.

class galaxy.tool_util.parser.yaml.YamlInputSource(input_dict)[source]

Bases: InputSource

__init__(input_dict)[source]
get(key, default=None)[source]

Return simple named properties as string for this input source. keys to be supported depend on the parameter type.

get_bool(key, default)[source]

Return simple named properties as boolean for this input source. keys to be supported depend on the parameter type.

get_bool_or_none(key, default)[source]

Return simple named properties as boolean or none for this input source. keys to be supported depend on the parameter type.

parse_input_type()[source]

Return the type of this input.

parse_nested_inputs_source()[source]
parse_test_input_source()[source]
parse_when_input_sources()[source]
parse_static_options() List[Tuple[str, str, bool]][source]

Return list of static options if this is a select type without defining a dynamic options.

parse_default() Dict[str, Any] | None[source]