我正在编写一个使用多个命令的snakemake规则,如下所示:
rule RULE1:
input: 'path/to/input.file'
output: 'path/to/output.file'
shell: 'path/to/command1 {input} | /path/to/command2 | /path/to/command3 {output}'
如果/path/to/command1
确实很长,则规则会变得有些笨拙。有没有办法在其他地方指定它cmd1='/path/to/command1'
并{cmd1}
在规则中使用?我知道,我可以使用类似的东西params: cmd1='/path/to/command1'
并按如下方式使用它:
rule RULE1:
input: 'path/to/input.file'
output: 'path/to/output.file'
params:
cmd1='/path/to/command1',
cmd2='/path/to/command2',
cmd3='/path/to/command3'
shell: '{cmd1} {input} | {cmd2}| {cmd3} {output}'
但是该解决方法要求我为每个规则分别指定它,并且不能使用相对路径。
做这种事情的标准方法是什么?
该shell
指令将字符串作为参数,您可以构造它,但是您更喜欢例如
cmd1= 'foo'
cmd2= 'bar'
rule one:
...
shell:
cmd1 + ' {input}' + ' | ' + cmd2 + ' > {output}'
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句