-
Notifications
You must be signed in to change notification settings - Fork 0
/
snakefile
84 lines (57 loc) · 1.93 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
75
76
77
78
79
80
81
82
83
84
from os import path
from snakemake.utils import validate
from snakemake.utils import min_version
min_version("7.18")
# ----------------------------------------------------------------
configfile: "config.yml"
validate(config, schema="schema/config_schema.yaml")
workdir: path.join(config["workdir"], config["pipeline"])
WORKDIR = path.join(config["workdir"], config["pipeline"])
SNAKEDIR = path.dirname(workflow.snakefile)
sample = config["sample_name"]
target_list = [
"results/" + sample + ".bam",
"results/" + sample + ".vcf"
]
rule all:
input:
target_list
# ----------------------------------------------------------------
rule mapping:
input:
fa = config["CCS_fasta"],
genome = config["genome"]
output:
sam = "results/" + sample + "_minimap.sam"
params:
mm_opts = config["minimap_opts"]
log: "logs/" + sample + "_minimap.log"
threads: config["threads"]
shell: """
minimap2 --eqx -a {params.mm_opts} --secondary=no -t {threads} {input.genome} {input.fa} -o {output.sam} 2> {log}
"""
# ----------------------------------------------------------------
rule sam_to_bam:
input:
sam = "results/" + sample + "_minimap.sam"
output:
bam = "results/" + sample + ".bam"
log: "logs/" + sample + "_samtools.log"
threads: config["threads"]
shell: """
samtools sort -O BAM -o {output.bam} -@ {threads} {input.sam};
samtools index {output.bam}
"""
# ----------------------------------------------------------------
rule sniffles:
input:
bam = "results/" + sample + ".bam"
output:
vcf = "results/" + sample + ".vcf"
params:
sn_opts = config["sniffles_opts"]
log: "logs/" + sample + "_sniffles.log"
threads: config["threads"]
shell: """
sniffles -i {input.bam} -v {output.vcf} {params.sn_opts} --threads {threads} 2> {log}
"""