Snakefile 1.16 KB
Newer Older
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
1
2
3
4
5
6
7
8
9
__bedtools_bamtofastq_pairs_bedtools_exec_command = config.get(
    'bedtools_bamtofastq_pairs', {}
).get('bedtools_exec_command', 'bedtools')
__bedtools_bamtofastq_pairs_modules = config.get('bedtools_bamtofastq_pairs', {}).get('modules')

rule bedtools_bamtofastq_pairs:
    input:
        __bedtools_bamtofastq_pairs_input
    output:
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
10
11
        forward = f"{__bedtools_bamtofastq_pairs_output_forward_name}.fq.gz",
        reverse = f"{__bedtools_bamtofastq_pairs_output_reverse_name}.fq.gz"
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
12
    params:
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
13
14
        forward_name = __bedtools_bamtofastq_pairs_output_forward_name,
        reverse_name = __bedtools_bamtofastq_pairs_output_reverse_name,
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
15
16
17
18
19
20
21
        exec_command = __bedtools_bamtofastq_pairs_bedtools_exec_command,
        modules = __bedtools_bamtofastq_pairs_modules
    run:
        command = []
        if params.modules:
        	command.append("module load {params.modules}")
        command.append(
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
22
            "{params.exec_command} bamtofastq -i {input} -fq {params.forward_name}.fq -fq2 {params.reverse_name}.fq"
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
23
        )
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
24
25
        command.append("gzip {params.forward_name}.fq")
        command.append("gzip {params.reverse_name}.fq")
Kenzo-Hugo Hillion's avatar
Kenzo-Hugo Hillion committed
26
        shell(" && ".join(command))