I’m writing a Snakemake pipeline to run some simulations. The key points are that:
(1) I run simulations across a space of values of parameters A, B & C and in n replicates,
(2) I plot the results averaged across the replicates for each parameter combination,
(3) I want to combine the plots so that, for each combination of B & C, I produce a plot with panels for different values of A.
I’m getting a MissingInputException error associated with step 3.
A minimal version of my Snakefile looks as follows:
A_lst = [0.0, 0.1, 0.01]
B_lst = [0.0, 0.1, 0.01]
C_lst = [0.0, 0.1, 0.01]
seeds = [2,22,42]
rule all:
input:
expand("sims/A~{A}/B~{B}/C~{C}/{seed}.out", A=A_lst, B=B_lst, C=C_lst, seed=seeds),
expand("sims/A~{A}/B~{B}/C~{C}/plot.png", A=A_lst, B=B_lst, C=C_lst),
expand("plots/combined_B{B}_C{C}.png", B=B_lst, C=C_lst)
rule simulate:
output:
"sims/A~{A}/B~{B}/C~{C}/{seed}.out"
shell:
"simulator {wildcards.A} {wildcards.B} {wildcards.C} {wildcards.rep}"
rule plot:
input:
expand("sims/A~{{A}}/B~{{B}}/C~{{C}}/{seed}.out", seed=seeds)
output:
"sims/A~{A}/B~{B}/C~{C}/plot.png"
shell:
"scripts/plot.py"
rule combine_plots:
input:
expand("output/A~{A}/B~{{B}}/C~{{C}}/plot.png",
A=A_lst)
output:
"plots/combined_B{B}_C{C}.png"
script:
"scripts/combine_plots.py"
This gives the following error:
# executing snakemake -n --cores 1 --conda-frontend conda --use-conda
Building DAG of jobs...
MissingInputException in rule all in file /data/username/project/Snakefile, line 67:
Missing input files for rule all:
affected files:
plots/combined_B0.0_C0.0.png
This surprises me. I thought that the logic would be here as follows:
(1) ask for all possible parameter combination of plots/combined_B{B}_C{C}.png
(2) expand on A while matching the values of B & C from the output
…
The previous two rules work. However, everything to generate plots/combined_B0.0_C0.0.png also seems to be there? I would appreciate some explanation and a suggestion of how to fix it!
Thanks in advance!
Caroll is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.