Reputation: 1765
I have a set of inputs: [A, B, C, D]
And a set of outputs: [1, 2, 3, 4]
I want the input/output pairs to be: A1, B2, C3, D4 for a rule.
How do I do that in a snakefile?
Upvotes: 1
Views: 44
Reputation: 9062
It would help to gave more details and some example code of your problem. Anyway, I would put the letter/number pairs in a dictionary or dataframe and use a lambda function to access the number corresponding to a letter:
numbers = ['1', '2', '3', '4']
letters = ['A', 'B', 'C', 'D']
ln = dict(zip(numbers, letters))
rule all:
input:
expand('{number}.txt', number= numbers),
rule out:
input:
letter= lambda wc: ln[wc.number],
output:
'{number}.txt'
shell:
"""
echo {input.letter} > {output}
"""
Upvotes: 2