-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSnakefile
74 lines (59 loc) · 1.47 KB
/
Snakefile
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
configfile: "config.yaml"
from os.path import join as pjoin
REF = config["fa"]
BAM = config["bam"]
ODIR = config["out"]
THREADS = config["threads"]
SVDSS_BIN = config["bin"]
rule run:
input:
pjoin(ODIR, "calls.vcf"),
rule index:
input:
fa=REF,
output:
fmd=REF + ".fmd",
threads: 1
benchmark:
pjoin(ODIR, "benchmark", "pp-index.txt")
shell:
"""
{SVDSS_BIN} index --reference {input.fa} --index {output.fmd}
"""
rule smooth:
input:
fa=REF,
bam=BAM,
output:
bam=pjoin(ODIR, "smoothed.bam"),
params:
wd=pjoin(ODIR),
threads: THREADS
shell:
"""
{SVDSS_BIN} smooth --reference {input.fa} --bam {input.bam} --threads {threads} > {output.bam}
samtools index {output.bam}
"""
rule search:
input:
fmd=REF + ".fmd",
bam=pjoin(ODIR, "smoothed.bam"),
output:
sfs=pjoin(ODIR, "specifics.txt"),
threads: THREADS
shell:
"""
{SVDSS_BIN} search --index {input.fmd} --bam {input.bam} --threads {threads} > {output.sfs}
"""
rule call:
input:
fa=REF,
bam=pjoin(ODIR, "smoothed.bam"),
sfs=pjoin(ODIR, "specifics.txt"),
output:
vcf=pjoin(ODIR, "calls.vcf"),
threads: THREADS
shell:
"""
{SVDSS_BIN} call --reference {input.fa} --bam {input.bam} --sfs {input.sfs} --threads {threads} | bcftools sort > {output.vcf}
"""