I am building a pipeline that consists of 4 iterations of three rules. Instead of copying and pasting the three rules 4 times and slightly changing the variables in each rule, is it possible to have a rule function, which takes in the variables that need to be changed, and return a rule?
I couldn't find the relevant documentation on the Internet.
rule A:
input:
OUTPUT_DIR + "/XR/{pop}.pull"
output:
OUTPUT_DIR + "/XR/{pop}.nemo"
shell:"./scriptA {input} {output}"
rule B:
input:
OUTPUT_DIR + "/XR/{pop}.pull",
OUTPUT_DIR + "/XR/{pop}.nemo",
output:
OUTPUT_DIR + "/XR/{pop}.freqs"
shell:"./scriptB {input[0]} {input[1]} {output}"
rule C:
input:
OUTPUT_DIR + "/XR/{pop}.pull",
OUTPUT_DIR + "/XR/{pop}.freqs",
output:
OUTPUT_DIR + "/XR/{pop}.impute"
shell:"./scriptC {input[0]} {input[1]} {output}"
The above code is one iteration. What if I want to do a second iteration, with some slight changes (say, only changes the XR
folder to XRQ
folder)?