我想用cwl(通用工作流语言)编写一个简单的命令包装器。我想做以下例子:
wc input.txt > input.txt.wc
wc some_folder/some_other_input > some_folder/some_other_input.wc
所以,基本上我希望代码在输入文件名后添加.wc并将其用作输出文件名。我写了下面的代码,但它没有用。 (见下面的错误信息)。任何人都知道如何解决它?
wc2.cwl
cwlVersion: cwl:draft-3
class: CommandLineTool
baseCommand: wc
inputs:
- id: inputfile
type: File
inputBinding:
position: 1
- id: outfilename
type: string
inputBinding:
valueFrom: ${ $(inputs.inputfile.path) + '.wc' }
outputs:
- id: outputfile
type: File
outputBinding:
glob: $(inputs.outfilename)
stdout: $(inputs.outfilename)
WC2-job1.yml
inputfile:
class: File
path: input.txt
生成
$ cwl-runner wc2.cwl wc2-job1.yml
/home/ec2-user/venv/cwl/bin/cwl-runner 1.0.20160504183010
I'm sorry, I couldn't load this CWL file, try again with --debug for more information.
mapping values are not allowed here
in "file:///home/ec2-user/cwl.examples/hello.workflow2/wc2.cwl", line 11, column 19
答案 0 :(得分:0)
stdout:$(inputs.outfilename) 成为, stdout:$(inputs ['outfilename'])
答案 1 :(得分:0)
根据Common Workflow Language User Guide: Capturing Standard Output
和https://www.commonwl.org/v1.0/CommandLineTool.html#stdout中列出的示例,
要指定用于捕获标准输出的文件名,请定义stdout: filename
和outputs: type: stdout
:
wc2.cwl
cwlVersion: cwl:v1.0
class: CommandLineTool
baseCommand: wc
inputs:
- id: inputfile
type: File
inputBinding:
position: 1
outputs:
- id: outputfile
type: stdout
stdout: $(inputs.inputfile.basename).wc