# How to concatename file names in Snakemake?

I want to pass a series of files (e.g., a, b) to a program prog like: prog a,b.

Is there a way to do this in Snakemake?

My attempt is:

rule run_prog:
input: "a", "b"
output: "output"
run: "prog {input}"


But the actual command Snakemake generated is prog a b instead of prog a,b.

Any solution to pass a comma concatenated file names to Snakemake?

• run: "prog {input[0]},{input[1]}" ? – Chris_Rands Apr 20 at 12:51
• @Chris_Rands that works, is there a general solution, as there can be ~20 input files. Thanks! – zhanxw Apr 20 at 15:22

rule run_prog:

• This works great. It works for f"prog {','.join(input.variable)}" if I define variable under input: section. Can you explain why have to use input[:] instead of input? – zhanxw Apr 22 at 3:19
• Right, using input by itself is the same ! I edited my answer. – cmdoret Apr 22 at 9:28