From deffb1ddcdc6284352c5d3f1e7b038f9e537db56 Mon Sep 17 00:00:00 2001 From: Kenzo-Hugo Hillion <hillion.kenzo@gmail.com> Date: Tue, 20 Jul 2021 14:36:09 +0200 Subject: [PATCH] start snakemake for samtools view --- tools/samtools/view/Snakefile | 19 +++++++++++++++++ tools/samtools/view/example_usage/Snakefile | 21 +++++++++++++++++++ tools/samtools/view/example_usage/config.yaml | 15 +++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 tools/samtools/view/Snakefile create mode 100644 tools/samtools/view/example_usage/Snakefile create mode 100644 tools/samtools/view/example_usage/config.yaml diff --git a/tools/samtools/view/Snakefile b/tools/samtools/view/Snakefile new file mode 100644 index 0000000..7fd8bfb --- /dev/null +++ b/tools/samtools/view/Snakefile @@ -0,0 +1,19 @@ +__samtools_view_exec_command = config.get('samtools_view', {}).get('exec_command', 'samtools view') +__samtools_view_modules = config.get('samtools_view', {}).get('modules') +__samtools_view_options = config.get('samtools_view', {}).get('options', "") + +rule samtools_view: + input: + __samtools_view_input + output: + __samtools_view_output + params: + exec_command = __samtools_view_exec_command, + modules = __samtools_view_modules, + options = __samtools_view_options + run: + command = [] + if params.modules: + command.append("module load {params.modules}") + command.append("{params.exec_command} {params.options} {input} > {output}") + shell(" && ".join(command)) \ No newline at end of file diff --git a/tools/samtools/view/example_usage/Snakefile b/tools/samtools/view/example_usage/Snakefile new file mode 100644 index 0000000..c8212ce --- /dev/null +++ b/tools/samtools/view/example_usage/Snakefile @@ -0,0 +1,21 @@ +configfile: "config.yaml" + +# ==== Snakefile path ==== +__samtools_view_rules = config.get("snakefiles", {}).get("samtools_view") + +__main_output_dir = config.get('output_dir', 'output') + +# ==== Main config ==== +SAMPLES = config.get('samples') +__input_dir = config.get('input_dir', 'data') + +# ==== Samtools view ==== +__samtools_view_input = +__samtools_view_output = + +__samtools_view_input = expand("{dir}/{{sample}}.emapper.seed_orthologs".format(dir=__input_dir), sample=SAMPLES) +__samtools_view_output = "{dir}/{file_name}".format(dir=__samtools_view_output_dir, file_name=__samtools_view_merged_name) +include: __samtools_view_rules + +rule all: + input: "{dir}/{file_name}".format(dir=__samtools_view_output_dir, file_name=__samtools_view_merged_name) diff --git a/tools/samtools/view/example_usage/config.yaml b/tools/samtools/view/example_usage/config.yaml new file mode 100644 index 0000000..e31325b --- /dev/null +++ b/tools/samtools/view/example_usage/config.yaml @@ -0,0 +1,15 @@ +snakefiles: + samtools_view: /pasteur/zeus/projets/p02/metasig/gitlab/snakemake/tools/samtools/view/Snakefile + +input_dir: /some/input/directory +output_dir: /some/output/directory + +samples: +- test_00000 +- test_00001 +- test_00002 + +samtools_view: + exec_command: samtools view + modules: samtools + options: "-b -f 4" -- GitLab