diff --git a/tools/metaphlan3/metaphlan/paired/Snakefile b/tools/metaphlan3/metaphlan/paired/Snakefile new file mode 100644 index 0000000000000000000000000000000000000000..55175901ad8cbe8aeb75453808d1b82196aa7810 --- /dev/null +++ b/tools/metaphlan3/metaphlan/paired/Snakefile @@ -0,0 +1,36 @@ +__metaphlan3_exec_command = config.get('metaphlan3', {}).get('exec_command', 'metaphlan') +__metaphlan3_modules = config.get('metaphlan3', {}).get('modules') +__metaphlan3_input_type = config['metaphlan3'].get('input_type', 'fastq') +__metaphlan3_options = config.get('metaphlan3', {}).get('options', "") +__metaphlan3_threads = config.get('metaphlan3', {}).get('threads', 1) + + +rule metaphlan3_paired: + """ + MetaPhlAn 3 can also natively handle paired-end metagenomes (but does not use the paired-end information), + and, more generally, metagenomes stored in multiple files (but you need to specify the --bowtie2out parameter): + + $ metaphlan metagenome_1.fastq,metagenome_2.fastq --bowtie2out metagenome.bowtie2.bz2 --nproc 5 + --input_type fastq > profiled_metagenome.txt + + """ + input: + r1 = __metaphlan3_input_r1, + r2 = __metaphlan3_input_r2 + output: + profile = __metaphlan3_output, + bowtie2out = __metaphlan3_output_bowtie2out, + sams = __metaphlan3_output_sams + params: + exec_command = __metaphlan3_exec_command, + modules = __metaphlan3_modules, + input_type = __metaphlan3_input_type, + options = __metaphlan3_options + threads: + __metaphlan3_threads + run: + command = [] + if params.modules: + command.append("module load {params.modules}") + command.append("{params.exec_command} --nproc {threads} --input_type {params.input_type} -s {output.sams} --bowtie2out {output.bowtie2out} {params.options} {input.r1},{input.r2} {output.profile}") + shell(" && ".join(command)) diff --git a/tools/metaphlan3/metaphlan/paired/config_example.yaml b/tools/metaphlan3/metaphlan/paired/config_example.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e484c95a99da7943f9d19c8bc18840187eb3289a --- /dev/null +++ b/tools/metaphlan3/metaphlan/paired/config_example.yaml @@ -0,0 +1,8 @@ +input_dir: data + +metaphlan3: + threads: 1 + input_type: fastq + options: "" + pair_suffix: "" + exec_command: metaphlan diff --git a/tools/metaphlan3/metaphlan/single/Snakefile b/tools/metaphlan3/metaphlan/single/Snakefile new file mode 100644 index 0000000000000000000000000000000000000000..3e86bedb85ca272e33b645e7f61479c3226fd7bf --- /dev/null +++ b/tools/metaphlan3/metaphlan/single/Snakefile @@ -0,0 +1,27 @@ +__metaphlan3_exec_command = config.get('metaphlan3', {}).get('exec_command', 'metaphlan') +__metaphlan3_modules = config.get('metaphlan3', {}).get('modules') +__metaphlan3_input_type = config['metaphlan3'].get('input_type', 'fastq') +__metaphlan3_options = config.get('metaphlan3', {}).get('options', "") +__metaphlan3_threads = config.get('metaphlan3', {}).get('threads', 1) + + +rule metaphlan3: + input: + __metaphlan3_input + output: + profile = __metaphlan3_output_profile, + bowtie2out = __metaphlan3_output_bowtie2out, + sams = __metaphlan3_output_sams + params: + exec_command = __metaphlan3_exec_command, + modules = __metaphlan3_modules, + input_type = __metaphlan3_input_type, + options = __metaphlan3_options + threads: + __metaphlan3_threads + run: + command = [] + if params.modules: + command.append("module load {params.modules}") + command.append("{params.exec_command} --nproc {threads} --input_type {params.input_type} -s {output.sams} --bowtie2out {output.bowtie2out} {params.options} {input} {output.profile}") + shell(" && ".join(command)) diff --git a/tools/metaphlan3/metaphlan/single/config_example.yaml b/tools/metaphlan3/metaphlan/single/config_example.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6a5c5db66d91bb9db4244f98041cbb9a0dbd4e54 --- /dev/null +++ b/tools/metaphlan3/metaphlan/single/config_example.yaml @@ -0,0 +1,7 @@ +input_dir: data + +metaphlan3: + threads: 1 + input_type: fastq + options: "--bowtie2db /pasteur/projets/policy01/Atm/DBs/metaphlan/metaphlan3bowtie2db/" + exec_command: metaphlan diff --git a/tools/strainphlan/sample2markers/README.md b/tools/strainphlan/sample2markers/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8ef1f3bc248135cc747226d5935e2cbd48388886 --- /dev/null +++ b/tools/strainphlan/sample2markers/README.md @@ -0,0 +1,26 @@ +# sample2markers.py for strainphlan + +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. + +### Help section + +``` +usage: sample2markers.py [-h] [-i INPUT [INPUT ...]] [--sorted] + [-f INPUT_FORMAT] [-o OUTPUT_DIR] + [-b BREADTH_THRESHOLD] [-n NPROCS] + +optional arguments: + -h, --help show this help message and exit + -i INPUT [INPUT ...], --input INPUT [INPUT ...] + The input samples as SAM or BAM files + --sorted Whether the BAM input files are sorted. Default false + -f INPUT_FORMAT, --input_format INPUT_FORMAT + The input samples format {bam, sam, bz2}. Default bz2 + -o OUTPUT_DIR, --output_dir OUTPUT_DIR + The output directory + -b BREADTH_THRESHOLD, --breadth_threshold BREADTH_THRESHOLD + The breadth of coverage threshold for the consensus + markers. Default 80 (%) + -n NPROCS, --nprocs NPROCS + The number of threads to execute the script +``` diff --git a/tools/strainphlan/sample2markers/Snakefile b/tools/strainphlan/sample2markers/Snakefile new file mode 100644 index 0000000000000000000000000000000000000000..a577299e5c97449bcb683cac9ccd4a8f31f8fc31 --- /dev/null +++ b/tools/strainphlan/sample2markers/Snakefile @@ -0,0 +1,24 @@ +__sample2markers_exec_command = config.get('sample2markers', {}).get('exec_command', 'sample2markers.py') +__sample2markers_modules = config.get('sample2markers', {}).get('modules') +__sample2markers_options = config.get('sample2markers', {}).get('options', "") +__sample2markers_threads = config.get('sample2markers', {}).get('threads', 1) + + +rule sample2markers: + input: + __sample2markers_input + output: + __sample2markers_output + params: + exec_command = __sample2markers_exec_command, + modules = __sample2markers_modules, + output_dir = __sample2markers_output_dir, + options = __sample2markers_options + threads: + __sample2markers_threads + run: + command = [] + if params.modules: + command.append("module load {params.modules}") + command.append("{params.exec_command} -n {threads} {params.options} -i {input} -o {params.output_dir}") + shell(" && ".join(command)) diff --git a/tools/strainphlan/sample2markers/config.yaml b/tools/strainphlan/sample2markers/config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a4f25247f95f9bc37ff7125655c95ee3897935e5 --- /dev/null +++ b/tools/strainphlan/sample2markers/config.yaml @@ -0,0 +1,5 @@ +input_dir: data + +sample2markers: + threads: 1 + exec_command: sample2markers.py