-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsk_align
48 lines (40 loc) · 1.24 KB
/
sk_align
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
BASE_DIR = "/tempwork173/qiyoyou/"
WDIR = BASE_DIR + "Liu_WES_201903/"
INDEX = BASE_DIR + "db/grch38_bwa/"
workdir: WDIR
SAMPLES,*_ = glob_wildcards("RawData/{smp}.R1.clean.fastq.gz")
rule all:
input:
I1 = expand(WDIR + 'align/{smp}.sam', smp = SAMPLES),
I2 = expand(WDIR + 'align/{smp}.bam', smp = SAMPLES),
I3 = expand(WDIR + 'align/{smp}.bam.bai', smp = SAMPLES),
I4 = expand(WDIR + 'align/{smp}.txt', smp = SAMPLES)
rule mapping:
input:
fwd = WDIR + "RawData/{smp}.R1.clean.fastq.gz",
rev = WDIR + "RawData/{smp}.R2.clean.fastq.gz"
output: WDIR + "align/{smp}.sam"
params: index = INDEX+"genome"
threads: 8
shell:"""
bwa mem -t {threads} {params.index} {input.fwd} {input.rev} > {output}
"""
rule samtobam:
input: WDIR + "align/{smp}.sam"
output: WDIR + "align/{smp}.bam"
threads: 8
shell:"""
samtools sort -@ {threads} -o {output} {input}
"""
rule bamindex:
input: WDIR + "align/{smp}.bam"
output: WDIR + "align/{smp}.bam.bai"
shell:"""
samtools index {input}
"""
rule stats:
input: WDIR + "align/{smp}.bam"
output: WDIR + "align/{smp}.txt"
shell:"""
samtools flagstat {input} > {output}
"""