Warning

This document is for an old release 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.cwl package

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

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

galaxy.tool_util.cwl.tool_proxy_from_persistent_representation(persisted_tool, strict_cwl_validation=True, tool_directory=None)[source]

Load a ToolProxy from a previously persisted representation.

galaxy.tool_util.cwl.workflow_proxy(workflow_path, strict_cwl_validation=True)[source]
galaxy.tool_util.cwl.handle_outputs(job_directory=None)[source]
galaxy.tool_util.cwl.to_cwl_job(tool, param_dict, local_working_directory)[source]

tool is Galaxy’s representation of the tool and param_dict is the parameter dictionary with wrapped values.

galaxy.tool_util.cwl.to_galaxy_parameters(tool, as_dict)[source]

Tool is Galaxy’s representation of the tool and as_dict is a Galaxified representation of the input json (no paths, HDA references for instance).

galaxy.tool_util.cwl.needs_shell_quoting(string, pos=0, endpos=9223372036854775807)

Scan through string looking for a match, and return a corresponding match object instance.

Return None if no position in the string matches.

Submodules

galaxy.tool_util.cwl.cwltool_deps module

Logic for dealing with cwltool as an optional dependency.

Use this as the import interface for cwltool and just call ensure_cwltool_available() before using any of the imported functionality at runtime.

galaxy.tool_util.cwl.cwltool_deps.default_loader(fetcher_constructor: Optional[Callable[[Dict[str, Union[str, rdflib.graph.Graph, bool]], requests.sessions.Session], schema_salad.fetcher.Fetcher]] = None, enable_dev: bool = False, doc_cache: bool = True)schema_salad.ref_resolver.Loader[source]
galaxy.tool_util.cwl.cwltool_deps.ensure_cwltool_available()[source]

Assert optional dependencies proxied via this module are available at runtime.

Throw an ImportError with a description of the problem if they do not exist.

galaxy.tool_util.cwl.cwltool_deps.getdefault(val, default)[source]
class galaxy.tool_util.cwl.cwltool_deps.LoadingContext(kwargs: Optional[Dict[str, Any]] = None)[source]

Bases: cwltool.context.ContextBase

__init__(kwargs: Optional[Dict[str, Any]] = None)None[source]

Initialize the LoadingContext from the kwargs.

copy()[source]
galaxy.tool_util.cwl.cwltool_deps.needs_shell_quoting(string, pos=0, endpos=9223372036854775807)

Scan through string looking for a match, and return a corresponding match object instance.

Return None if no position in the string matches.

galaxy.tool_util.cwl.cwltool_deps.resolve_and_validate_document(loadingContext: cwltool.context.LoadingContext, workflowobj: Union[ruamel.yaml.comments.CommentedMap, ruamel.yaml.comments.CommentedSeq], uri: str, preprocess_only: bool = False, skip_schemas: Optional[bool] = None)Tuple[cwltool.context.LoadingContext, str][source]

Validate a CWL document.

class galaxy.tool_util.cwl.cwltool_deps.RuntimeContext(kwargs: Optional[Dict[str, Any]] = None)[source]

Bases: cwltool.context.ContextBase

__init__(kwargs: Optional[Dict[str, Any]] = None)None[source]

Initialize the RuntimeContext from the kwargs.

copy()[source]
class galaxy.tool_util.cwl.cwltool_deps.StdFsAccess(basedir: str)[source]

Bases: object

Local filesystem implementation.

__init__(basedir: str)None[source]

Perform operations with respect to a base directory.

glob(pattern: str)List[str][source]
open(fn: str, mode: str)IO[Any][source]
exists(fn: str)bool[source]
size(fn: str)int[source]
isfile(fn: str)bool[source]
isdir(fn: str)bool[source]
listdir(fn: str)List[str][source]
join(path, *paths)[source]
realpath(path: str)str[source]
docker_compatible_realpath(path: str)str[source]

galaxy.tool_util.cwl.parser module

This module provides proxy objects around objects from the common workflow language reference implementation library cwltool. These proxies adapt cwltool to Galaxy features and abstract the library away from the rest of the framework.

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

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

galaxy.tool_util.cwl.parser.load_job_proxy(job_directory, strict_cwl_validation=True)[source]

galaxy.tool_util.cwl.representation module

This module is responsible for converting between Galaxy’s tool input description and the CWL description for a job json.

class galaxy.tool_util.cwl.representation.INPUT_TYPE(value)[source]

Bases: str, enum.Enum

An enumeration.

DATA = 'data'
INTEGER = 'integer'
FLOAT = 'float'
TEXT = 'text'
BOOLEAN = 'boolean'
SELECT = 'select'
FIELD = 'field'
CONDITIONAL = 'conditional'
DATA_COLLECTON = 'data_collection'
class galaxy.tool_util.cwl.representation.TypeRepresentation(name, galaxy_param_type, label, collection_type)[source]

Bases: tuple

property name

Alias for field number 0

property galaxy_param_type

Alias for field number 1

property label

Alias for field number 2

property collection_type

Alias for field number 3

property uses_param
galaxy.tool_util.cwl.representation.type_representation_from_name(type_representation_name)[source]
galaxy.tool_util.cwl.representation.type_descriptions_for_field_types(field_types)[source]
galaxy.tool_util.cwl.representation.dataset_wrapper_to_file_json(inputs_dir, dataset_wrapper)[source]
galaxy.tool_util.cwl.representation.dataset_wrapper_to_directory_json(inputs_dir, dataset_wrapper)[source]
galaxy.tool_util.cwl.representation.collection_wrapper_to_array(inputs_dir, wrapped_value)[source]
galaxy.tool_util.cwl.representation.collection_wrapper_to_record(inputs_dir, wrapped_value)[source]
galaxy.tool_util.cwl.representation.to_cwl_job(tool, param_dict, local_working_directory)[source]

tool is Galaxy’s representation of the tool and param_dict is the parameter dictionary with wrapped values.

galaxy.tool_util.cwl.representation.to_galaxy_parameters(tool, as_dict)[source]

Tool is Galaxy’s representation of the tool and as_dict is a Galaxified representation of the input json (no paths, HDA references for instance).

galaxy.tool_util.cwl.representation.field_to_field_type(field)[source]

galaxy.tool_util.cwl.runnable module

Lighter-weight variant of Planemo runnable outputs.

galaxy.tool_util.cwl.runnable.get_outputs(path)[source]
class galaxy.tool_util.cwl.runnable.CwlWorkflowOutput(label)[source]

Bases: object

__init__(label)[source]

Initialize self. See help(type(self)) for accurate signature.

get_id()[source]
class galaxy.tool_util.cwl.runnable.ToolOutput(tool_output)[source]

Bases: object

__init__(tool_output)[source]

Initialize self. See help(type(self)) for accurate signature.

get_id()[source]

galaxy.tool_util.cwl.runtime_actions module

galaxy.tool_util.cwl.runtime_actions.handle_outputs(job_directory=None)[source]

galaxy.tool_util.cwl.schema module

Abstraction around cwltool and related libraries for loading a CWL artifact.

class galaxy.tool_util.cwl.schema.RawProcessReference(loading_context, process_object, uri)

Bases: tuple

property loading_context

Alias for field number 0

property process_object

Alias for field number 1

property uri

Alias for field number 2

class galaxy.tool_util.cwl.schema.ResolvedProcessDefinition(loading_context, uri, raw_process_reference)

Bases: tuple

property loading_context

Alias for field number 0

property raw_process_reference

Alias for field number 2

property uri

Alias for field number 1

class galaxy.tool_util.cwl.schema.SchemaLoader(strict=True, validate=True)[source]

Bases: object

__init__(strict=True, validate=True)[source]

Initialize self. See help(type(self)) for accurate signature.

property raw_document_loader
loading_context()[source]
raw_process_reference(path, loading_context=None)[source]
raw_process_reference_for_object(process_object, uri=None, loading_context=None)[source]
process_definition(raw_process_reference)[source]
tool(**kwds)[source]

galaxy.tool_util.cwl.util module

Client-centric CWL-related utilities.

Used to share code between the Galaxy test framework and other Galaxy CWL clients (e.g. Planemo).

galaxy.tool_util.cwl.util.set_basename_and_derived_properties(properties, basename)[source]
galaxy.tool_util.cwl.util.output_properties(path=None, content=None, basename=None, pseduo_location=False)[source]
galaxy.tool_util.cwl.util.abs_path_or_uri(path_or_uri, relative_to)[source]

Return an absolute path if this isn’t a URI, otherwise keep the URI the same.

galaxy.tool_util.cwl.util.abs_path(path_or_uri, relative_to)[source]
galaxy.tool_util.cwl.util.path_or_uri_to_uri(path_or_uri)[source]
galaxy.tool_util.cwl.util.galactic_job_json(job, test_data_directory, upload_func, collection_create_func, tool_or_workflow='workflow')[source]

Adapt a CWL job object to the Galaxy API.

CWL derived tools in Galaxy can consume a job description sort of like CWL job objects via the API but paths need to be replaced with datasets and records and arrays with collection references. This function will stage files and modify the job description to adapt to these changes for Galaxy.

class galaxy.tool_util.cwl.util.FileLiteralTarget(contents, path=None, **kwargs)[source]

Bases: object

__init__(contents, path=None, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

class galaxy.tool_util.cwl.util.FileUploadTarget(path, secondary_files=None, **kwargs)[source]

Bases: object

__init__(path, secondary_files=None, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

class galaxy.tool_util.cwl.util.ObjectUploadTarget(the_object)[source]

Bases: object

__init__(the_object)[source]

Initialize self. See help(type(self)) for accurate signature.

class galaxy.tool_util.cwl.util.DirectoryUploadTarget(tar_path)[source]

Bases: object

__init__(tar_path)[source]

Initialize self. See help(type(self)) for accurate signature.

class galaxy.tool_util.cwl.util.GalaxyOutput(history_id, history_content_type, history_content_id, metadata)

Bases: tuple

property history_content_id

Alias for field number 2

property history_content_type

Alias for field number 1

property history_id

Alias for field number 0

property metadata

Alias for field number 3

galaxy.tool_util.cwl.util.tool_response_to_output(tool_response, history_id, output_id)[source]
galaxy.tool_util.cwl.util.invocation_to_output(invocation, history_id, output_id)[source]
galaxy.tool_util.cwl.util.output_to_cwl_json(galaxy_output, get_metadata, get_dataset, get_extra_files, pseduo_location=False)[source]

Convert objects in a Galaxy history into a CWL object.

Useful in running conformance tests and implementing the cwl-runner interface via Galaxy.

galaxy.tool_util.cwl.util.download_output(galaxy_output, get_metadata, get_dataset, get_extra_files, output_path)[source]
galaxy.tool_util.cwl.util.guess_artifact_type(path)[source]