diff --git a/tools/samtools/view/Snakefile b/tools/samtools/view/Snakefile new file mode 100644 index 0000000000000000000000000000000000000000..7fd8bfbb0a1803e50a8b9a7018c5ea284c9e9165 --- /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 0000000000000000000000000000000000000000..c8212cee7f7ade5cd8c2e313c392ace92a28a346 --- /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 0000000000000000000000000000000000000000..e31325bb134b60f613d8d223975244990a53418d --- /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"