Answers.Body: <p>You can use join to convert the list of input file into a string. 
  I think this would work as expected.:</p>
  
  <pre class="lang-py prettyprint-override"><code>rule run_prog:
      input: "a", "b"
      output: "output"
      run: f"prog {','.join(input)}"
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T03:19:32.380Z
Answers.Text: 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`?
Answers.UserDisplayName: zhanxw
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T09:28:33.033Z
Answers.Text: Right, using `input` by itself is the same ! I edited my answer.
Answers.UserDisplayName: cmdoret
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-21T09:01:09.900Z
Answers.LastActivityDate: 2020-04-22T09:28:53.430Z
Answers.LastEditDate: 2020-04-22T09:28:53.430Z
Answers.UserDisplayName: cmdoret
Body: <p>I want to pass a series of files (e.g., <code>a</code>, <code>b</code>) to a program <code>prog</code> like: <code>prog a,b</code>.</p>
  
  <p>Is there a way to do this in Snakemake?</p>
  
  <p>My attempt is:</p>
  
  <pre><code>rule run_prog:
    input: "a", "b"
    output: "output"
    run: "prog {input}"
  </code></pre>
  
  <p>But the actual command Snakemake generated is <code>prog a b</code> instead of <code>prog a,b</code>.</p>
  
  <p>Any solution to pass a comma concatenated file names to Snakemake?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-20T12:51:22.383Z
Comments.Text: `run: "prog {input[0]},{input[1]}"` ?
Comments.UserDisplayName: Chris_Rands
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-04-20T15:22:58.003Z
Comments.Text: @Chris_Rands that works, is there a general solution, as there can be ~20 input files. Thanks!
Comments.UserDisplayName: zhanxw
Tags: <snakemake>
Title: How to concatename file names in Snakemake?
ThreadText: # How to concatename file names in Snakemake?
  
  (Asked by: username_0 on 2020-04-20)
  
  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?
  
  **Tags:** snakemake
  
  > **Comments:**
  > **username_1**: `run: "prog {input[0]},{input[1]}"` ?  
  > **username_0**: @username_1 that works, is there a general solution, as there can be ~20 input files. Thanks!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-04-21. Score: 1 | Accepted answer
  
  You can use join to convert the list of input file into a string.
  I think this would work as expected.:
  
  ```py
  rule run_prog:
      input: "a", "b"
      output: "output"
      run: f"prog {','.join(input)}"
  
  ```
  
  > **Comments:**
  > **username_0**: 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`?  
  > **username_2**: Right, using `input` by itself is the same ! I edited my answer.  
  
  ---
  
  