toil.lib.trs

Contains functions for integrating Toil with GA4GH Tool Registry Service servers, for fetching workflows.

Attributes

logger

TRS_ROOT

Functions

is_trs_workflow(workflow)

Returns True if a workflow string smells like TRS.

extract_trs_spec(workflow)

Parse a Dockstore workflow URL or TSR ID to a string that is definitely a TRS ID.

parse_trs_spec(trs_spec)

Parse a TRS ID to workflow and optional version.

compose_trs_spec(trs_workflow_id, trs_version)

Compose a TRS ID from a workflow ID and version ID.

find_workflow(workflow[, supported_languages])

Given a Dockstore URL or TRS identifier, get the root WDL or CWL URL for the workflow, along with the TRS workflow ID and version.

fetch_workflow(trs_workflow_id, trs_version, language)

Returns a URL or local path to a workflow's primary descriptor file.

resolve_workflow(workflow[, supported_languages])

Find the real workflow URL or filename from a command line argument.

Module Contents

toil.lib.trs.logger
toil.lib.trs.TRS_ROOT = 'https://dockstore.org'
toil.lib.trs.is_trs_workflow(workflow)[source]

Returns True if a workflow string smells like TRS.

Detects Dockstore page URLs and strings that could be Dockstore TRS IDs.

Parameters:

workflow (str)

Return type:

bool

toil.lib.trs.extract_trs_spec(workflow)[source]

Parse a Dockstore workflow URL or TSR ID to a string that is definitely a TRS ID.

Parameters:

workflow (str)

Return type:

str

toil.lib.trs.parse_trs_spec(trs_spec)[source]

Parse a TRS ID to workflow and optional version.

Parameters:

trs_spec (str)

Return type:

tuple[str, Optional[str]]

toil.lib.trs.compose_trs_spec(trs_workflow_id, trs_version)[source]

Compose a TRS ID from a workflow ID and version ID.

Parameters:
  • trs_workflow_id (str)

  • trs_version (str)

Return type:

str

toil.lib.trs.find_workflow(workflow, supported_languages=None)[source]

Given a Dockstore URL or TRS identifier, get the root WDL or CWL URL for the workflow, along with the TRS workflow ID and version.

Accepts inputs like:

Assumes the input is actually one of the supported formats. See is_trs_workflow().

TODO: Needs to handle multi-workflow files if Dockstore can.

Raises:
  • FileNotFoundError – if the workflow or version doesn’t exist.

  • ValueError – if the version is not specified but cannot be automatically determined.

Parameters:
  • workflow (str)

  • supported_languages (Optional[set[str]])

Return type:

tuple[str, str, str]

toil.lib.trs.fetch_workflow(trs_workflow_id, trs_version, language)[source]

Returns a URL or local path to a workflow’s primary descriptor file.

The file will be in context with its required files so it can actually run.

Raises:

FileNotFoundError – if the workflow or version doesn’t exist.

Parameters:
  • trs_workflow_id (str)

  • trs_version (str)

  • language (str)

Return type:

str

toil.lib.trs.resolve_workflow(workflow, supported_languages=None)[source]

Find the real workflow URL or filename from a command line argument.

Transform a workflow URL or path that might actually be a Dockstore page URL or TRS specifier to an actual URL or path to a workflow document, and optional TRS specifier.

Accepts inputs like

Raises:

FileNotFoundError – if the workflow or version should be in Dockstore but doesn’t seem to exist.

Parameters:
  • workflow (str)

  • supported_languages (Optional[set[str]])

Return type:

tuple[str, Optional[str]]