mapping.smk 1.29 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
rule bwa_mem:
    input:
        reads = get_map_reads_input,
        idx = rules.bwa_index.output
    output:
        temp("results/mapped/{sample}-{unit}.bam")
    log:
        "logs/bwa/bwa_mem/{sample}-{unit}.log"
    params:
        index= lambda w, input: os.path.splitext(input.idx[0])[0],
        extra= get_read_group,
        sort="samtools",
        sort_order="coordinate",
14
    threads: 6
15
    wrapper:
Antonie Vietor's avatar
Antonie Vietor committed
16
        "0.64.0/bio/bwa/mem"
17
18
19
20
21
22
23
24
25
26
27
28

rule merge_bams:
    input:
        lambda w: expand("results/mapped/{sample}-{unit}.bam",
            sample = w.sample,
            unit = units.loc[units['sample'] == w.sample].unit.to_list()
        )
    output:
        temp("results/merged/{sample}.bam")
    log:
        "logs/picard/mergebamfiles/{sample}.log"
    params:
Antonie Vietor's avatar
Antonie Vietor committed
29
        "VALIDATION_STRINGENCY=LENIENT SORT_ORDER=coordinate"
30
    wrapper:
Antonie Vietor's avatar
Antonie Vietor committed
31
        "0.64.0/bio/picard/mergesamfiles"
32
33
34
35
36

rule mark_merged_duplicates:
    input:
        "results/merged/{sample}.bam"
    output:
Antonie Vietor's avatar
Antonie Vietor committed
37
38
        bam=temp("results/picard_dedup/{sample}.bam"),
        metrics="results/picard_dedup/{sample}.metrics.txt"
39
    log:
Antonie Vietor's avatar
Antonie Vietor committed
40
        "logs/picard/picard_dedup/{sample}.log"
41
    threads: 2
42
43
44
    params:
        "REMOVE_DUPLICATES=false ASSUME_SORTED=true VALIDATION_STRINGENCY=LENIENT"
    wrapper:
Antonie Vietor's avatar
Antonie Vietor committed
45
        "0.64.0/bio/picard/markduplicates"