Snakefile 1.11 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
__extract_unmapped_pairs_samtools_exec_command = config.get(
    'extract_unmapped_pairs', {}
).get('samtools_exec_command', 'samtools')
__extract_unmapped_pairs_modules = config.get('extract_unmapped_pairs', {}).get('modules')

rule extract_unmapped_pairs:
    input:
        __extract_unmapped_pairs_input
    output:
        __extract_unmapped_pairs_output
    params:
        exec_command = __extract_unmapped_pairs_samtools_exec_command,
13
        modules = __extract_unmapped_pairs_modules
14
15
16
17
18
19
20
21
22
23
    run:
        command = []
        if params.modules:
        	command.append("module load {params.modules}")
        command.append("{params.exec_command} view -u -f 4 -F 264 {input}  > {output}.tmps1.bam")
        command.append("{params.exec_command} view -u -f 8 -F 260 {input}  > {output}.tmps2.bam")
        command.append("{params.exec_command} view -u -f 12 -F 256 {input}  > {output}.tmps3.bam")
        command.append(
            "{params.exec_command} merge -u - {output}.tmps[123].bam | {params.exec_command} sort -n > {output}"
        )
24
        command.append("rm {output}.tmps[123].bam")
25
        shell(" && ".join(command))