-
Notifications
You must be signed in to change notification settings - Fork 1
/
Snakefile
185 lines (141 loc) · 5.46 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#Snakefile to launch Tassel 5 GBS pipeline v2.5.18
#Loading configuration from YAML file format
configfile: "config.yaml"
ruleorder:
GBSSeqToTagDB > TagExportToFastq > bowtie2 > SAMToGBSdb > DiscoverySNPCaller > SNPQualityProfiler > ProductionSNPCaller > targets
rule targets:
input:
"01_TagDataBase/" + config['db_name'],
"02_TagFastq/tagsForAlign.fa.gz",
"03_SamFile/tagsForAlignFullvs.sam",
"04_snpStatistics/snp_stats.txt",
"05_snpCalling/" + config['vcf']
rule GBSSeqToTagDB:
input:
fastq_dir = config['fastq_dir'],
keyfile = config['keyfile']
output:
database = "01_TagDataBase/" + config['db_name']
params:
java_memory = config['java_memory'][1],
enzyme = config['enzyme'] ,
kmer_length = config['GBSSeqToTagDBPlugin']['kmerLength'],
minimum_kmer_length = config['GBSSeqToTagDBPlugin']['minKmerL'],
batch_size = config['GBSSeqToTagDBPlugin']['batchSize'],
minimum_quality_score = config['GBSSeqToTagDBPlugin']['mnQS'],
maximum_number_of_kmer = config['GBSSeqToTagDBPlugin']['mxKmerNum'],
min_kmer_count = config['GBSSeqToTagDBPlugin']['c'],
shell:
"run_pipeline.pl -Xmx{params.java_memory} -fork1 -GBSSeqToTagDBPlugin "
"-i {input.fastq_dir} "
"-k {input.keyfile} "
"-db {output.database} "
"-e {params.enzyme} "
"-c {params.min_kmer_count} "
"-mnQS {params.minimum_quality_score} "
"-kmerLength {params.kmer_length} "
"-minKmerL {params.minimum_kmer_length} "
"-mxKmerNum {params.maximum_number_of_kmer} "
"-batchSize {params.batch_size} "
"-endPlugin -runfork1"
rule TagExportToFastq:
input:
database = rules.GBSSeqToTagDB.output
output:
fastq = "02_TagFastq/tagsForAlign.fa.gz"
params:
java_memory = config['java_memory'][0],
min_count = config['TagExportToFastqPlugin']['c']
shell:
"run_pipeline.pl -Xmx{params.java_memory} -fork1 -TagExportToFastqPlugin "
"-db {input.database} "
"-o {output.fastq} "
"-c {params.min_count} "
"-endPlugin -runfork1"
rule bowtie2:
input:
fastq = rules.TagExportToFastq.output,
genome = config['genome']
output:
sam = "03_SamFile/tagsForAlignFullvs.sam"
shell:
"bowtie2 -p 15 --very-sensitive -x {input.genome} -U {input.fastq} -S {output.sam}"
rule SAMToGBSdb :
input:
sam = rules.bowtie2.output,
database = rules.GBSSeqToTagDB.output
output:
"03_SamFile/sam_to_gbs.out"
params:
java_memory = config['java_memory'][0],
aLen = config['SAMToGBSdbPlugin']['aLen'],
aProp = config['SAMToGBSdbPlugin']['aProp']
shell:
"run_pipeline.pl -Xmx{params.java_memory} -fork1 -SAMToGBSdbPlugin "
"-i {input.sam} "
"-db {input.database} "
"-aLen {params.aLen} "
"-aProp {params.aProp} "
"-endPlugin -runfork1;"
"echo 'SAMToGBSdb done!' > {output};"
"touch 02_TagFastq/*"
rule DiscoverySNPCaller:
input:
database = rules.GBSSeqToTagDB.output,
temp_file = rules.SAMToGBSdb.output
output:
"03_SamFile/snp_caller.out"
params:
java_memory = config['java_memory'][0],
start_chromosome = config['DiscoverySNPCallerPluginV2']['sC'],
stop_chromosome = config['DiscoverySNPCallerPluginV2']['eC'],
min_minor_allel_freq = config['DiscoverySNPCallerPluginV2']['mnMAF'],
min_locus_coverage = config['DiscoverySNPCallerPluginV2']['mnLCov'],
max_tags_cut_site = config['DiscoverySNPCallerPluginV2']['maxTagsCutSite']
shell:
"run_pipeline.pl -Xmx{params.java_memory} -fork1 -DiscoverySNPCallerPluginV2 "
"-db {input.database} "
"-sC {params.start_chromosome} "
"-eC {params.stop_chromosome} "
"-mnLCov {params.min_locus_coverage} "
"-mnMAF {params.min_minor_allel_freq} "
"-maxTagsCutSite {params.max_tags_cut_site} "
"-endPlugin -runfork1;"
"echo 'DiscoverySNPCaller done!' > {output};"
"touch 02_TagFastq/*; touch 03_SamFile/*"
rule SNPQualityProfiler:
input:
database = rules.GBSSeqToTagDB.output,
temp_file = rules.DiscoverySNPCaller.output
output:
stat_file = "04_snpStatistics/snp_stats.txt"
params:
java_memory = config['java_memory'][0],
tname = config['SNPQualityProfilerPlugin']['tname']
shell:
"run_pipeline.pl -debug -Xmx{params.java_memory} -fork1 -SNPQualityProfilerPlugin "
"-db {input.database} "
"-tname {params.tname} "
"-statFile {output.stat_file} "
"-endPlugin -runfork1"
rule ProductionSNPCaller:
input:
keyfile = config['keyfile'],
fastq_dir = config['fastq_dir'],
stat_file = "04_snpStatistics/snp_stats.txt"
output:
vcf = "05_snpCalling/" + config['vcf']
params:
database = rules.GBSSeqToTagDB.output,
java_memory = config['java_memory'][1],
enzyme = config['enzyme'],
kmer_length = config['ProductionSNPCallerPluginV2']['kmerLength']
shell:
"run_pipeline.pl -Xmx{params.java_memory} -fork1 -ProductionSNPCallerPluginV2 "
"-db {params.database} "
"-i {input.fastq_dir} "
"-k {input.keyfile} "
"-e {params.enzyme} "
"-o {output.vcf} "
"-kmerLength {params.kmer_length} "
"-endPlugin -runfork1"