diff --git a/tools/strainphlan/sample2markers/README.md b/tools/strainphlan/sample2markers/README.md index 8ef1f3bc248135cc747226d5935e2cbd48388886..78053e7abaa77d06229244c7f000712d9b8885dd 100644 --- a/tools/strainphlan/sample2markers/README.md +++ b/tools/strainphlan/sample2markers/README.md @@ -2,6 +2,9 @@ This step will reconstruct all species strains found in metaphlan output sam file and store them in a pickle file (*.pkl). Those strains are referred as sample-reconstructed strains. +.. **Note**: output pkl file is written should be written in a individual directory since the script tries + to create and write into a `tmp` dir that leads to error when running sample2markers.py in parallel. + ### Help section ``` diff --git a/tools/strainphlan/strainphlan/Snakefile b/tools/strainphlan/strainphlan/Snakefile new file mode 100644 index 0000000000000000000000000000000000000000..bf6d4effd2eb379e47496aa2666a4ce357421b2e --- /dev/null +++ b/tools/strainphlan/strainphlan/Snakefile @@ -0,0 +1,25 @@ +__strainphlan_exec_command = config.get('strainphlan', {}).get('exec_command', 'strainphlan') +__strainphlan_modules = config.get('strainphlan', {}).get('modules') +__strainphlan_options = config.get('strainphlan', {}).get('options', "") +__strainphlan_threads = config.get('strainphlan', {}).get('threads', 1) + + +rule strainphlan: + input: + __strainphlan_input + output: + __strainphlan_output + params: + exec_command = __strainphlan_exec_command, + modules = __strainphlan_modules, + clade = __strainphlan_clade, + output_dir = __strainphlan_output_dir, + options = __strainphlan_options + threads: + __strainphlan_threads + run: + command = [] + if params.modules: + command.append("module load {params.modules}") + command.append("{params.exec_command} -s {input} -n {threads} -c {params.clade} {params.options} -o {params.output_dir}") + shell(" && ".join(command)) diff --git a/tools/strainphlan/strainphlan/config.yaml b/tools/strainphlan/strainphlan/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9094c16763ca77b1005040ca87affe372d2f64e7 --- /dev/null +++ b/tools/strainphlan/strainphlan/config.yaml @@ -0,0 +1,5 @@ +input_dir: data + +strainphlan: + threads: 4 + exec_command: sample2markers.py