如何编写没有输出的 Snakemake 规则?
我的 Snakefile 有一个 print_to_screen
规则没有明确的输出文件。下面是一个简化的例子:
rule all:
placeholder_output # What should I put here?
rule create_file:
output:
"file.txt"
shell:
"echo Hello World! > {output}"
rule print_to_screen: # This rule has no output
input:
"file.txt"
shell:
"cat {input}"
如何编写print_to_screen
规则,使其触发其他规则,意思是:
- 它可以作为其他规则中的输入,所以运行
snakemake {placeholder_output}
也会触发之前的规则create_file
? - 它可以包含在
rule all
中,因此运行snakemake
会触发所有规则?
My Snakefile has a print_to_screen
rule with no explicit output file. The following is a simplified example:
rule all:
placeholder_output # What should I put here?
rule create_file:
output:
"file.txt"
shell:
"echo Hello World! > {output}"
rule print_to_screen: # This rule has no output
input:
"file.txt"
shell:
"cat {input}"
How can I write the print_to_screen
rule so that it triggers other rules, meaning that:
- it can be used as an input in other rules, so running
snakemake {placeholder_output}
also triggers the previous rulecreate_file
? - it can be included in
rule all
, so runningsnakemake
triggers all rules?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
规则的
output
部分是可选的,但您需要将其设为第一个规则(将其定义为 Snakefile 中的第一个规则)才能生效:如果您需要一些灵活性(例如您有多个类似的规则)你应该使用 标志。
The
output
section of the rule is optional, but you need to make it the first rule (define it the first in your Snakefile) to take any effect:If you need some flexibility (for example you have several rules like that) you should use flags.