Generating output based on changed input files in Snakemake is easy:
rule all: input: [f'out_{i}.txt' for i in range(10)] rule make_input: output: 'in_{i}.txt' shell: 'touch {output}' rule make_output_parallel: input: 'in_{i}.txt' output: 'out_{i}.txt' shell: 'touch {output}' In this case, make_output will only run for instances where in_{i}.txt have changed.
But suppose the 'out_{i}.txt' cannot be generated in parallel and I want to generate them in a single step, like,
rule make_output_one_step: input: [f'in_{i}.txt' for i in range(10)] output: [f'out_{i}.txt' for i in range(10)] shell: 'touch {output}' If only one of the in_{i}.txt files have changed, I don't need to regenerate all 10 of them. How can I adjust make_output_one_step.output to generate only the needed files?
make_outputnoralldepend on any in_{i}.txt file. There is no "generating output based on changed input files" in your script.make_outputdoesn't depend on the input de facto. Next, themake_inputproduces exactly the same files, so the timestamp de facto is not important. And finally I don't see any reason in your intention "to generate them in a single step". I see a logical fallacy.