Reputation: 1151
I am using snakemake to run my pipeline.
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
"""
In the next_rule
the software wants only the folder where the files are and not the file name, but since snakemake does not take as input the previous rule it says that the files do not exist
. Is there a way to tell snakemake to run a rule in order without necessary taking the previous output as input?
Upvotes: 1
Views: 1202
Reputation: 9062
You could extract the directory name within the shell script:
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?
Maybe you could come up with some logic to do that but I think you would go against the purpose and design principles of snakemake.
Upvotes: 1