LoginSignup
4
1

More than 5 years have passed since last update.

CWL User Guide 1: Introduction と 2: First Example をやってみた

Last updated at Posted at 2017-12-01

Common Workflow Language(CWL) User Guide について

Common Workflow Language User Guide

公式サイトにあるドキュメントで、いろいろなことが21ステップで学習できます。

各ステップには以下がかならずついているので、学習の目安になると思います。

  • 何が学習できるのか(冒頭QuestionsとObjectives)
  • 最後に Key Points

1ステップにつき、5分から10分くらいで終わるようにできていて、目安の時間では3時間15分で全部終わります。

実際に試したところ大体それくらいの時間でおわりました。

ぜひ試してみてください。

いろいろなことが学習できます。

アドベントカレンダーの私の担当分は、1ステップが1日なっています。

CWL User Guide 1: Introduction

Common Workflow Language User Guide: Introduction

CWL とは何か、といったようなことが書いてあります。
Key Points のところは、ぜひ読んだほうが良いです。

Key Points を引用すると次のようにかいてあります。

* CWL describes command line tools and workflows.
* CWL is not software.
* Descriptions in CWL aid portability between environments

CWLを記述し、それを動かす部分はないです。

2にはいる前に、CWLを動かす環境を整備

pythonがすでに使えるのであれば

pip install cwltool

これだけで、必要なものがはいります。
あとは、dockerを使うサンプルもあるので、でてきたときにdockerをいれたいとおもいます。

また、vagrant が使えるのであれば、

manabuishii/vagrant-cwl-impl-test

git clone https://github.com/manabuishii/vagrant-cwl-impl-test.git
cd vagrant-cwl-impl-test
vagrant up

これで、cwltoolも含めて必要なものがはいった仮想マシンができあがります。

User Guide のなかでは、cwl-runner と書いてありますが、今回のCWL Advent Calendar 2017はcwltoolを使って、すすめてみようとおもいます。
これについては、後述の予定です。

データについて

User Guideを進めていくと、前のステップの結果を使うといったことがでてきます。
途中の日からでもはじめられるように、必要なデータをいれたレポジトリをつくりました。

manabuishii/cwl_user_guide_work

git clone https://github.com/manabuishii/cwl_user_guide_work.git

CWL User Guide 2: First Example

Common Workflow Language User Guide: First Example

この回では Hello world! を表示します。
そのためにCWLを記述したファイルと、パラメータを記述したファイルの2つのファイルを用意します。

この回では
Hello world! を表示するための書き方について1行1行解説してあります。
Key Points もぜひ読んで下さい。

CWL ファイル、1st-tool.cwl

1st-tool.cwl
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool
baseCommand: echo
inputs:
  message:
    type: string
    inputBinding:
      position: 1
outputs: []

パラメータ用のファイル、echo-job.yml

echo-job.yml
message: Hello world!

結果

$ cwltool 1st-tool.cwl echo-job.yml
/usr/local/bin/cwltool 1.0.20171107133715
Resolved '1st-tool.cwl' to 'file:///home/vagrant/cwl_user_guide_work/02-1st-example/1st-tool.cwl'
[job 1st-tool.cwl] /tmp/tmppJq7QV$ echo \
    'Hello world!'
Hello world!
[job 1st-tool.cwl] completed success
{}
Final process status is success

使ったファイル

cwl_user_guide_work/02-1st-example at master · manabuishii/cwl_user_guide_work

少し試してみよう

echo-job.ymlHello world! 部分を変更して、もう1度実行してみましょう。
表示されるメッセージがかわることが確認できるとおもいます。

次回へ続きます

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1