问题命令的输出在哪里?如何保存命令的输出信息?目标学习如何描述和处理工具的输出。
工具的输出是运行工具后应该返回的输出参数列表。每个参数都有一个用于参数名称的id,以及描述对该参数有效的值类型的类型。
当一个工具在CWL下运行时,开始的工作目录是指定的输出目录。底层的工具或脚本必须以在输出目录中创建的文件的形式记录其结果。CWL工具返回的输出参数要么是输出文件本身,要么来自于检查这些文件的内容。
下面的示例进行演示如何返回从tar文件中提取的文件。
向baseCommand传递强制性参数 在前面的示例中,baseCommand只是一个字符串,所有参数都作为CWL输入传递。我们可以使用字符串数组代替单个字符串。第一个元素是要运行的命令,任何后续元素都是强制性的命令行参数
tar.cwl
#!/usr/bin/env cwl-runnercwlVersion: v1.0class: CommandLineToolbaseCommand: [tar, --extract]inputs:tarfile:type: FileinputBinding:prefix: --fileoutputs:example_out:type: FileoutputBinding:glob: hello.txt
tar-job.yml
tarfile:class: Filepath: hello.tar
接下来,为示例创建一个tar文件,并在命令行中使用cwl-runner调用输入对象:
$ touch hello.txt && tar -cvf hello.tar hello.txt$ cwl-runner tar.cwl tar-job.yml[job tar.cwl] /tmp/tmpqOeawQ$ tar \--extract --file \/tmp/tmpGDk8Y1/stg80bbad20-494d-47af-8075-dffc32df03a3/hello.tar[job tar.cwl] completed success{"example_out": {"location": "file:///home/me/cwl/user_guide/hello.txt","basename": "hello.txt","class": "File","checksum": "sha1$da39a3ee5e6b4b0d3255bfef95601890afd80709","size": 0,"path": "/home/me/cwl/user_guide/hello.txt"}}Final process status is success
字段outputBinding描述如何设置每个输出参数的值。
outputs:example_out:type: FileoutputBinding:glob: hello.txt
glob字段由输出目录中的文件名称组成。如果你事先不知道文件名,你可以使用通配符模式,如glob: ‘*.txt’。
