toil.cwl.utils

Utility functions used for Toil’s CWL interpreter.

Module Contents

Functions

visit_top_cwl_class(rec, classes, op)

Apply the given operation to all top-level CWL objects with the given named CWL class.

visit_cwl_class_and_reduce(rec, classes, op_down, op_up)

Apply the given operations to all CWL objects with the given named CWL class.

download_structure(file_store, index, existing, ...)

Download nested dictionary from the Toil file store to a local path.

Attributes

logger

CWL_UNSUPPORTED_REQUIREMENT_EXIT_CODE

CWL_UNSUPPORTED_REQUIREMENT_EXCEPTION

DownReturnType

UpReturnType

DirectoryStructure

toil.cwl.utils.logger
toil.cwl.utils.CWL_UNSUPPORTED_REQUIREMENT_EXIT_CODE = 33
exception toil.cwl.utils.CWLUnsupportedException[source]

Bases: Exception

digraph inheritanceaba341841e { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "CWLUnsupportedException" [URL="#toil.cwl.utils.CWLUnsupportedException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Fallback exception."]; }

Fallback exception.

toil.cwl.utils.CWL_UNSUPPORTED_REQUIREMENT_EXCEPTION: Union[Type[cwltool.errors.UnsupportedRequirement], Type[CWLUnsupportedException]]
toil.cwl.utils.visit_top_cwl_class(rec, classes, op)[source]

Apply the given operation to all top-level CWL objects with the given named CWL class.

Like cwltool’s visit_class but doesn’t look inside any object visited.

Parameters
  • rec (Any) –

  • classes (Iterable[str]) –

  • op (Callable[[Any], Any]) –

Return type

None

toil.cwl.utils.DownReturnType
toil.cwl.utils.UpReturnType
toil.cwl.utils.visit_cwl_class_and_reduce(rec, classes, op_down, op_up)[source]

Apply the given operations to all CWL objects with the given named CWL class.

Applies the down operation top-down, and the up operation bottom-up, and passes the down operation’s result and a list of the up operation results for all child keys (flattening across lists and collapsing nodes of non-matching classes) to the up operation.

Returns

The flattened list of up operation results from all calls.

Parameters
  • rec (Any) –

  • classes (Iterable[str]) –

  • op_down (Callable[[Any], DownReturnType]) –

  • op_up (Callable[[Any, DownReturnType, List[UpReturnType]], UpReturnType]) –

Return type

List[UpReturnType]

toil.cwl.utils.DirectoryStructure
toil.cwl.utils.download_structure(file_store, index, existing, dir_dict, into_dir)[source]

Download nested dictionary from the Toil file store to a local path.

Parameters
  • file_store (toil.fileStores.abstractFileStore.AbstractFileStore) – The Toil file store to download from.

  • index (Dict[str, str]) – Maps from downloaded file path back to input Toil URI.

  • existing (Dict[str, str]) – Maps from file_store_id URI to downloaded file path.

  • dir_dict (DirectoryStructure) – a dict from string to string (for files) or dict (for

  • into_dir (str) –

Return type

None

subdirectories) describing a directory structure.

Parameters
Return type

None

into.