text: user2005: I have a folder where the hdf5 files inputs are (matrices of scRNAseq raw UMI counts). There is a python script that loads them, splits them into multiple matrices, normalizes them, and saves as csv files. When the name pattern of the output files is known, things are easy, I know how to do that, but when one input (hdf5 file) can produce various number of outputs (csv files) I am not sure how to approach the issue. Currently my Snakemake file relevant part looks the following way:
  hdf5_files,=glob_wildcards('/main/{hdf5_file}.hdf5') 
  
  rule all:
    input:
  --->  expand('data_files/normalized/{hdf5_file}.csv', hdf5_file=hdf5_files)
      ...
  
  rule normalization:
    input:
       script = 'python/normalize.py',
       path = '/main/{hdf5_file}.hdf5'
    output:
  --->  path = 'data_files/normalized/{hdf5_file}.csv'
    shell:
       "python {input.script} -data {input.path} -path {output.path}"
  
  Above I highlighted the 2 lines that I am not sure now how I should write. Any suggestions would be greatly appreciated.
  
  user292: Could you give an example of names of input files and output files of normalize.py ?
  It seems to me that your case could be similar to the one described about the dynamic output:
  https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#dynamic-files
  Here you would probably use it for the output of normalization and for the input of all (with a wildcard different from hdf5_file).
  Disclaimer: I haven't had the opportunity to use this feature so far.
  
original_text: 2005: <p>I have a folder where the <code>hdf5</code> files inputs are (matrices of <code>scRNAseq</code> raw <code>UMI</code> counts). There is a <code>python</code> script that loads them, splits them into multiple matrices, normalizes them, and saves as <code>csv</code> files. When the name pattern of the output files is known, things are easy, I know how to do that, but when one input (<code>hdf5</code> file) can produce various number of outputs (<code>csv</code> files) I am not sure how to approach the issue. Currently my <code>Snakemake</code> file relevant part looks the following way:</p>
  
  <pre><code>hdf5_files,=glob_wildcards('/main/{hdf5_file}.hdf5') 
  
  rule all:
    input:
  ---&gt;  expand('data_files/normalized/{hdf5_file}.csv', hdf5_file=hdf5_files)
      ...
  
  rule normalization:
    input:
       script = 'python/normalize.py',
       path = '/main/{hdf5_file}.hdf5'
    output:
  ---&gt;  path = 'data_files/normalized/{hdf5_file}.csv'
    shell:
       "python {input.script} -data {input.path} -path {output.path}"
  </code></pre>
  
  <p>Above I highlighted the <code>2</code> lines that I am not sure now how I should write. Any suggestions would be greatly appreciated.</p>
   292: <p>Could you give an example of names of input files and output files of <code>normalize.py</code> ?</p>
  
  <p>It seems to me that your case could be similar to the one described about the <code>dynamic</code> output:</p>
  
  <p><a href="https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#dynamic-files" rel="nofollow noreferrer">https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#dynamic-files</a></p>
  
  <p>Here you would probably use it for the output of <code>normalization</code> and for the input of <code>all</code> (with a wildcard different from <code>hdf5_file</code>).</p>
  
  <p>Disclaimer: I haven't had the opportunity to use this feature so far.</p>
  