From bd2e900e69eb4fc28ee1963a2ac65b1e7fad046e Mon Sep 17 00:00:00 2001 From: Kenzo-Hugo Hillion <hillion.kenzo@gmail.com> Date: Fri, 18 Dec 2020 10:25:25 +0100 Subject: [PATCH] add rule for strainphlan --- tools/strainphlan/sample2markers/README.md | 3 +++ tools/strainphlan/strainphlan/Snakefile | 25 ++++++++++++++++++++++ tools/strainphlan/strainphlan/config.yaml | 5 +++++ 3 files changed, 33 insertions(+) create mode 100644 tools/strainphlan/strainphlan/Snakefile create mode 100644 tools/strainphlan/strainphlan/config.yaml diff --git a/tools/strainphlan/sample2markers/README.md b/tools/strainphlan/sample2markers/README.md index 8ef1f3b..78053e7 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 0000000..bf6d4ef --- /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 0000000..9094c16 --- /dev/null +++ b/tools/strainphlan/strainphlan/config.yaml @@ -0,0 +1,5 @@ +input_dir: data + +strainphlan: + threads: 4 + exec_command: sample2markers.py -- GitLab