-1

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.

1
  • 1
    Do you need to specify the SIM_OUTPUT part through expand? With three files you could easily name and specify them individually in the output section (summary_output = "xml/summary.{seed}.xml" etc.) Commented Apr 4, 2022 at 12:13

1 Answer 1

1

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"] 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.