Commit 18caac99 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

Merge branch '21-metaphlan3' into 'master'

metaphlan3 and strainphlan

Closes #21

See merge request !5
parents 8932d738 b265ed7f
__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))
input_dir: data
metaphlan3:
threads: 1
input_type: fastq
options: ""
pair_suffix: ""
exec_command: metaphlan
__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))
input_dir: data
metaphlan3:
threads: 1
input_type: fastq
options: "--bowtie2db /pasteur/projets/policy01/Atm/DBs/metaphlan/metaphlan3bowtie2db/"
exec_command: metaphlan
# 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
```
__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))
input_dir: data
sample2markers:
threads: 1
exec_command: sample2markers.py
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment