未提供项目描述
项目描述
cwl-utils
Python Utilities and Autogenerated Classes for loading and parsing CWL v1.0, CWL v1.1, and CWL v1.2 documents.
需要Python 3.8+
安装
pip3 install cwl-utils
从源代码安装
git clone https://github.com/common-workflow-language/cwl-utils.git cd cwl-utils pip3 install .
用法
拉取所有引用的软件容器镜像
cwl-docker-extract 有助于缓存或预先拉取在 CWL CommandLineTool 或 CWL Workflow(包括所有引用的 CommandLineTools 和子 Workflows 等)中引用的所有软件容器镜像。
默认行为是使用 Docker 引擎下载并保存软件容器镜像为 Docker 格式。
cwl-docker-extract path_to_my_workflow.cwl
cwl-docker-extract --dir DIRECTORY path_to_my_workflow.cwl
或者,您可以使用 Singularity 软件容器引擎下载并保存软件容器镜像,并同时将它们转换为 Singularity 格式。
cwl-docker-extract --singularity --dir DIRECTORY path_to_my_workflow.cwl
打印所有引用的软件包
cwl-cite-extract 打印在指定的 CWL 文档中找到的所有软件包(递归地)。
目前,对于找到的所有 SoftwareRequirement,都会打印包名以及列出的任何规范和版本字段。
cwl-cite-extract path_to_my_workflow.cwl
用具体步骤替换 CWL 表达式
cwl-expression-refactor 重构 CWL 文档,使得任何 CWL 表达式评估都是独立的步骤(要么是 CWL ExpressionTools,要么是 CWL CommandLineTools)。这允许由不支持在具体步骤外进行内联表达式评估的 CWL 引擎执行,或者根本不支持 CWL 的可选 InlineJavascriptRequirement。
cwl-expression-refactor directory/path/to/save/outputs path_to_my_workflow.cwl [more_workflows.cwl]
拆分打包的 CWL 文档
cwl-graph-split 将打包的 CWL 文档文件拆分为多个文件。
打包的 CWL 文档使用 $graph 构造来包含多个 CWL Process 对象(Workflow、CommandLineTool、ExpressionTool、Operation)。通常,打包的 CWL 文档包含一个名为“main”的 CWL Workflow 以及工作流步骤(包括任何子工作流)。
cwl-graph-split --outdir optional/directory/path/to/save/outputs path_to_my_workflow.cwl
规范化 CWL 文档
cwl-normalizer 规范化一个或多个 CWL 文档,以便对于每个文档,都会生成一个包含其所有依赖项的 JSON 格式 CWL 文档,并升级到 CWL v1.2,如有必要。可选项以 cwl-expression-refactor 的方式将 CWL 表达式重构为单独的步骤。
cwl-normalizer directory/path/to/save/outputs path_to_my_workflow.cwl [more_workflows.cwl]
使用 CWL 解析器
from pathlib import Path
from ruamel import yaml
import sys
from cwl_utils.parser import load_document_by_uri, save
# File Input - This is the only thing you will need to adjust or take in as an input to your function:
cwl_file = Path("testdata/md5sum.cwl") # or a plain string works as well
# Import CWL Object
cwl_obj = load_document_by_uri(cwl_file)
# View CWL Object
print("List of object attributes:\n{}".format("\n".join(map(str, dir(cwl_obj)))))
# Export CWL Object into a built-in typed object
saved_obj = save(cwl_obj)
print(f"Export of the loaded CWL object: {saved_obj}.")
开发
重新生成解析器
要重新生成,请安装 schema_salad 包,并运行
cwl_utils/parser/cwl_v1_0.py 是通过 schema-salad-tool --codegen python https://github.com/common-workflow-language/common-workflow-language/raw/codegen/v1.0/CommonWorkflowLanguage.yml --codegen-parser-info "org.w3id.cwl.v1_0" > cwl_utils/parser/cwl_v1_0.py
cwl_utils/parser/cwl_v1_1.py 是通过 schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.1/raw/codegen/CommonWorkflowLanguage.yml --codegen-parser-info "org.w3id.cwl.v1_1" > cwl_utils/parser/cwl_v1_1.py
cwl_utils/parser/cwl_v1_2.py 是通过 schema-salad-tool --codegen python https://github.com/common-workflow-language/cwl-v1.2/raw/1.2.1_proposed/CommonWorkflowLanguage.yml --codegen-parser-info "org.w3id.cwl.v1_2" > cwl_utils/parser/cwl_v1_2.py
发布
要发布 CWLUtils,请在 cwl_utils/__meta__.py 中提升版本,并使用新版本标记该提交。gh-action-pypi-publish 应该发布该标记。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。