Galaxy の Planemo Virtual Applianceを利用する その1でPlanemo Virtual Applianceの利用方法と入力ファイルと出力ファイルがそれぞれ1ファイルの場合の処理方法に触れた
以下はDocker を利用したPlanemo Virtual Applianceの中での操作
入力ファイルが複数の場合
入力ファイルが2つで、出力ファイルが1つの例を考える
入力ファイルの作成
# seq 1 9 > target1.txt
# seq 11 19 > target2.txt
# paste target1.txt target2.txt > result.txt
target1.txtには各行に1から9までの数字、target2.txtには各行に11から19までの数字
この2つのファイルのそれぞれの行の数字をタブ区切りで並べた1つのファイルを作るためのGalaxyのxmlファイルを作成する
2つの入力ファイルを処理する場合には、--example_input
を2回指定すれば良い
# planemo tool_init --force \
--id 'paste' \
--name 'Paste two files to one (paste command)' \
--example_command 'paste target1.txt target2.txt > result.txt' \
--example_input target1.txt \
--example_input target2.txt \
--example_output result.txt \
--test_case
Tool written to paste.xml
Copying test-file target1.txt
cp 'target1.txt' 'test-data'
Copying test-file target2.txt
cp 'target2.txt' 'test-data'
Copying test-file result.txt
cp 'result.txt' 'test-data'
lint
作成されたxmlの構文をplanemo lintでチェックする
# planemo lint paste.xml
Linting tool /opt/galaxy/tools/planemo/twofiles/paste.xml
Applying linter tests... CHECK
.. CHECK: 1 test(s) found.
Applying linter output... CHECK
.. INFO: 1 outputs found.
Applying linter inputs... CHECK
.. INFO: Found 2 input parameters.
Applying linter help... WARNING
.. WARNING: Help contains TODO text.
.. CHECK: Tool contains help section.
.. CHECK: Help contains valid reStructuredText.
Applying linter general... CHECK
.. CHECK: Tool defines a version [0.1.0].
.. CHECK: Tool defines a name [Paste two files to one (paste command)].
.. CHECK: Tool defines an id [paste].
.. CHECK: Tool targets 16.01 Galaxy profile.
Applying linter command... CHECK
.. INFO: Tool contains a command.
Applying linter citations... WARNING
.. WARNING: No citations found, consider adding citations to your tool.
Applying linter tool_xsd... CHECK
.. INFO: File validates against XML schema.
Failed linting
lintでWarningが出力されているが、理由はGalaxy の Planemo Virtual Applianceを利用する その1のそれと同じなので、ここではそのままテストを実行
...
部分は省略
# planemo test paste.xml
...
All 1 test(s) executed passed.
paste[0]: passed
テストが成功した
入力ファイルや出力ファイルの数に応じて、planemo tool_init
に下記の
-
--example_input
入力ファイル -
--example_output
出力ファイル
オプションをそれぞれ必要な数だけ繰り返し指定すれば良い
今日はここまで