如何在 snakemake 中引用规则的输出
How to reference the output of a rule in snakemake
我想知道是否可以将一条规则的输出直接用作下一条规则的输入,而不必再次指定路径。
我想也许这样的事情会奏效,但在我的测试中没有:
rule A:
input:
in_file = "path/to/in_file"
output:
out_file = "path/to/out_file"
shell:
"...."
rule B:
input:
in_file = A.output.out_file # reference the output of rule A doesnt work like this
# in_file = "path/to/out_file" -> this works but is less elegant i think
output:
out_file = "path/to/out_file"
shell:
"...."
感谢任何帮助或见解!
干杯!
也许这就是您正在寻找的语法:
rule B:
input:
in_file = rules.A.output.out_file,
...
虽然我更喜欢硬编码文件名,因为它使脚本更具可读性。
我想知道是否可以将一条规则的输出直接用作下一条规则的输入,而不必再次指定路径。
我想也许这样的事情会奏效,但在我的测试中没有:
rule A:
input:
in_file = "path/to/in_file"
output:
out_file = "path/to/out_file"
shell:
"...."
rule B:
input:
in_file = A.output.out_file # reference the output of rule A doesnt work like this
# in_file = "path/to/out_file" -> this works but is less elegant i think
output:
out_file = "path/to/out_file"
shell:
"...."
感谢任何帮助或见解!
干杯!
也许这就是您正在寻找的语法:
rule B:
input:
in_file = rules.A.output.out_file,
...
虽然我更喜欢硬编码文件名,因为它使脚本更具可读性。