title: Access specific element of a list returned by a function in Snakemake
body: <p>In my Snakemake workflow, I have defined a function that uses a file produced previously during the workflow, parses it and returns a list of 2 elements, for example :</p>
  <pre class="lang-py prettyprint-override"><code>def get_param_value(wildcards) :
      # do stuff with the wildcards and some files
      return [&quot;element1&quot;,&quot;element2&quot;]
  </code></pre>
  <p>I would then like to use each value of the returned list as independent <code>params</code> in a subsequent rule, such as :</p>
  <pre><code>rule example :
      input :
          'input_file.txt'
      output :
          'output_file.txt'
      params :
          param1 = &quot;element1&quot;, # First element of the list returned by get_param_value function
          param2 = &quot;element2&quot; # Second element of the list returned by get_param_value function
      shell :
          'somecommand -i {input} -smth1 {params.param1} -smth2 {params.param2} -o {output} ;'
  </code></pre>
  <p>I have tried using the function directly in the rule, with</p>
  <pre><code>params :
      param1 = get_param_value[0],
      param2 = get_param_value[1]
  </code></pre>
  <p>but I get a <code>TypeError : 'function' object is not subscriptable</code> (which is expected because it's a function).</p>
  <p>Do you have a workaround for this ?</p>