Snakemake 运行规则顺序
Snakemake run rule in order
我正在使用 snakemake 运行 我的管道。
rule fisrt_rule:
input: "{sample}/path/to/{sample}.txt"
output: "{sample}/path/to/{sample}.stat"
shell:
"""
do something
"""
rule next_rule:
input:
folder="{sample}/path/to/",
output:
raw="{sample}/path/to/{sample}.raw.txt"
shell:
"""
do something
"""
在 next_rule
中,软件只需要文件所在的文件夹而不是文件名,但是由于 snakemake 没有将先前的规则作为输入,所以它说 files do not exist
。有没有办法告诉 snakemake 按顺序 运行 一个规则,而不需要将先前的输出作为输入?
您可以在 shell 脚本中提取目录名称:
rule next_rule:
input:
folder= "{sample}/path/to/{sample}.stat",
output:
raw= "{sample}/path/to/{sample}.raw.txt"
shell:
"""
folder=`dirname {input.folder}`
do something $folder
"""
Is there a way to tell snakemake to run a rule in order without necessary taking the previous output as input?
也许你可以想出一些逻辑来做到这一点,但我认为你会违背 snakemake 的目的和设计原则。
我正在使用 snakemake 运行 我的管道。
rule fisrt_rule:
input: "{sample}/path/to/{sample}.txt"
output: "{sample}/path/to/{sample}.stat"
shell:
"""
do something
"""
rule next_rule:
input:
folder="{sample}/path/to/",
output:
raw="{sample}/path/to/{sample}.raw.txt"
shell:
"""
do something
"""
在 next_rule
中,软件只需要文件所在的文件夹而不是文件名,但是由于 snakemake 没有将先前的规则作为输入,所以它说 files do not exist
。有没有办法告诉 snakemake 按顺序 运行 一个规则,而不需要将先前的输出作为输入?
您可以在 shell 脚本中提取目录名称:
rule next_rule:
input:
folder= "{sample}/path/to/{sample}.stat",
output:
raw= "{sample}/path/to/{sample}.raw.txt"
shell:
"""
folder=`dirname {input.folder}`
do something $folder
"""
Is there a way to tell snakemake to run a rule in order without necessary taking the previous output as input?
也许你可以想出一些逻辑来做到这一点,但我认为你会违背 snakemake 的目的和设计原则。