'snakemake: only run the rules that connect one upstream rule (point A) with one downstream rule (point B)
I have a snakemake workflow in which made a change in only one rule, so that its output is not slightly different than what was earlier. Now I need to re-run the downstream rules that depended on this rule. For those rules, I want to know a functionality in snakemake that (1) identifies the rules to rerun i.e. all the downstream rules that depend on the rule I changed and (2) simply re-runs them while overwriting their output files.
For this, I searched through the snakemake's documentation. I could find an option that seemed relevant:
--forceall, -F
Force the execution of the selected (or the first) rule and all rules it is dependent on regardless of already created output.
But it was not useful, because this command would run the rules that are upstream (dependent) of the rule I changed. This is exactly the opposite of what I wanted. If I provide the downstream rule to this option, then I guess it will re-run all of its dependent rules, some of which are needed to be re-run.
Question: Is there a way in snakemake to set a "start" rule (point A) and "end" rule (point B) and only re-run the rules that are connecting the two?
Possible solution (but an undesirable one):
I could manually figure out which rules I want to re-run and provide them to --forcerun option.
--forcerun, -R
Force the re-execution or creation of the given rules or files. Use this option if you changed a rule and want to have all its output in your workflow updated.
But manual interventions like this would not be good for the reproducibility of the workflow. Ideally, I would like if snakemake could do this by itself.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
