2016-05-07 6 views
0

cwl(共通ワークフロー言語)を使用して簡単なコマンドラッパーを作成したいと思います。基本的に私は、コードを入力ファイル名の後に.wc入れて、出力ファイル名としてそれを使いたい、入力文字列をcwlで変更してstdoutを指定する

wc input.txt > input.txt.wc 
wc some_folder/some_other_input > some_folder/some_other_input.wc 

ので:私は、たとえば次の操作を実行します。私は次のコードを書いたが、うまくいかなかった。 (下記のエラーメッセージ参照)。誰でもそれを修正する方法がありますか? CWL入力で

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

■作成したコマンドラインに表示されるパラメータを定義する必要があります。 wcストリームを標準出力に転送する場合、入力にoutfilenameを指定する必要はありません。 wcのすべてのパラメータを表示するには、man wcをチェックしてください。

これはあなたが使用できる解決策ですが、私は完璧だとは思わない!

wc2.cwl

#!/usr/bin/env cwl-runner 
cwlVersion: cwl:draft-3 
class: CommandLineTool 
baseCommand: wc 
requirements: 
    - class: InlineJavascriptRequirement 

stdout: $(inputs.inputfile.path.replace(/^.*[\\\/]/, '').replace(/\.[^/.]+$/, '') + '.wc') 
inputs: 
    - id: inputfile 
    type: File 
    inputBinding: 
     position: 1 
outputs: 
    - id: outputfile 
    type: File 
    outputBinding: 
     glob: $(inputs.inputfile.path.replace(/^.*[\\\/]/, '').replace(/\.[^/.]+$/, '') + '.wc') 
0

STDOUT:$(inputs.outfilename) STDOUT、なるように:$(入力[ 'outFileNameは'])

+3

は、あなたの答えに、について説明を追加してください。 –

関連する問題