Reputation: 13
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:
snakemake {placeholder_output}
also triggers the previous rule create_file
?rule all
, so running snakemake
triggers all rules?Upvotes: 1
Views: 897
Reputation: 6584
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:
rule print_to_screen:
input:
"file.txt"
shell:
"cat {input}"
rule create_file:
output:
"file.txt"
shell:
"echo Hello World! > {output}"
If you need some flexibility (for example you have several rules like that) you should use flags.
Upvotes: 1