I have a pipeline that has a problematic rule. I can't use wildcards in the output, and so I am unable to map the input to the output. The problem is Snakemake launch a job for each one of the combinations. However, I the tool outputs the three required files. I was able to sort the problem with 'dynamic', but I would prefer to
mapping: {'a': ['a_1', 'a_2', 'a_3'], 'b': ['b_1', 'b_2', 'b_3']}
rule build:
input:
ini=rules.create_ini.output,
bam=lambda wildcards:
expand('mappings/{names}.bam', names=mapping[wildcards.cond],
cond=wildcards.cond)
output:
dynamic('tool/{cond}/{names}.tool')
params:
output='{cond}'
shell:
'''
module load tool
tool build --conf {input.ini} --output {params.output} # < here
'''
The tool produces three files, not one and Snakemake is launching six jobs instead two.