Reputation: 83
I am trying to create a snakemake rule that produces 3 output files for each given seed. I currently have the following:
SIM_OUTPUT = ["summary", "tripinfo", "vehroute"]
SEEDS = [1,2]
single_seed = 1
rule sumo_sim_1:
input:
config = "two-hours-ad-hoc.sumo.cfg"
output:
expand("xml/{file}.{seed}.xml", seed = single_seed, file=SIM_OUTPUT)
shell:
" sumo -c {input.config} --seed {single_seed}"
"--summary-output {output[0]} "
"--tripinfo-output {output[1]} "
"--vehroute-output {output[2]} "
The above code works for a single seed, but I cant get/think of a way to work for multiple seeds.
Upvotes: -1
Views: 1349
Reputation: 3701
First you need to change your rule to make use of your seed wildcard like so
rule sumo_sim_1:
output:
"xml/summary.{seed}.xml",
"xml/tripinfo.{seed}.xml",
"xml/vehroute.{seed}.xml",
shell:
" sumo -c {input.config} --seed {wildcards.seed} "
"--summary-output {output[0]} "
"--tripinfo-output {output[1]} "
"--vehroute-output {output[2]} "
And then your downstream rule(s) can just specify the seed necessary for their input, like so:
rule all:
input:
["xml/summary.1.xml", "xml/summary.2.xml", "xml/tripinfo.1.xml", "xml/tripinfo.2.xml", "xml/vehroute.1.xml", "xml/vehroute.2.xml"]
Upvotes: 1