-
Notifications
You must be signed in to change notification settings - Fork 0
/
nextflow.config
243 lines (224 loc) · 7.84 KB
/
nextflow.config
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
// settings to run diamond/blast
manifest {
name = 'blast-nf'
author = 'Ido Bar'
description = 'Homology search using BLAST or Diamond'
mainScript = 'blast-nf.nf'
nextflowVersion = '>=21.04.1'
version = '0.4.0'
}
env {
BLASTDB = "/scratch/project/adna/tools/ncbi_db"
}
params {
tracedir = "pipeline_info"
outDir = "${manifest.name}-results"
query = ""
db = "${env.BLASTDB}/nt"
taxDbDir = ""
taxListFile = "$projectDir/assets/NO_FILE"
out = ""
// taxDbDir = "${env.BLASTDB}"
// chunkSize = "250.KB"
chunkSize = "500"
outfmtString = "6 std"
// evalue = "1e-10"
// targetSeqs = 50
app = 'blastn'
blastOpts = '-evalue 1e-10 -max_target_seqs 20'
dmndOpts = '-e 1e-10 -k 20'
}
profiles {
singularity {
singularity.enabled = true
singularity.autoMounts = true
// singularity.runOptions = "-B ${db_dir}"
}
apptainer {
apptainer {
enabled = true
autoMounts = true
// runOptions = "-B ${db_dir}"
}
}
conda {
// process.conda = 'blast diamond'
conda.enabled = true
conda.useMamba = true
}
blastn_tax {
params {
db = "${env.BLASTDB}/nt"
outfmtString = "6 std stitle staxids sscinames scomnames sskingdoms"
app = 'blastn'
}
}
diamond_tax {
params {
db = "${env.BLASTDB}/nr"
app = "diamond blastp"
outfmtString = "6 qseqid sseqid pident length mismatch gapopen qstart qend sstart send evalue bitscore stitle staxids sscinames skingdoms sphylums"
}
}
test {
params {
query = "${projectDir}/test/test.fa"
db = "${projectDir}/test/test_nt"
out = "test.blastn.nt.outfmt6"
outDir = "blastn-test"
chunkSize = "10"
outfmtString = "6 std"
app = 'blastn'
}
}
test_tax {
params {
query = "${projectDir}/test/test.fa"
db = "${projectDir}/test/test_nt"
out = "test.blastn.nt.tax.outfmt6"
outDir = "blastn-tax-test"
chunkSize = "10"
outfmtString = "6 std stitle staxids sscinames scomnames sskingdoms"
app = 'blastn'
}
}
test_p {
params {
query = "${projectDir}/test/test.pep.faa"
db = "${projectDir}/test/test_nr"
out = "test.blastp.nr.outfmt6"
outDir = "blastp-test"
chunkSize = "10"
app = 'blastp'
}
}
test_p_tax {
params {
query = "${projectDir}/test/test.pep.faa"
db = "${projectDir}/test/test_nr"
out = "test.blastp.nr.tax.outfmt6"
outDir = "blastp-tax-test"
outfmtString = "6 std stitle staxids sscinames scomnames sskingdoms"
chunkSize = "10"
app = 'blastp'
}
}
test_d {
params {
query = "${projectDir}/test/test.pep.faa"
db = "${projectDir}/test/test_nr.dmnd"
outfmtString = "6 qseqid sseqid pident length mismatch gapopen qstart qend sstart send evalue bitscore"
out = "test.diamond_blastp.nr.outfmt6"
outDir = "diamond-blastp-est"
chunkSize = "10"
app = 'diamond blastp'
diamondOpts = '--fast -e 1e-10 -k 10'
}
}
test_d_tax {
params {
query = "${projectDir}/test/test.pep.faa"
db = "${projectDir}/test/test_nr.dmnd"
outfmtString = "6 qseqid sseqid pident length mismatch gapopen qstart qend sstart send evalue bitscore stitle staxids sscinames skingdoms sphylums"
out = "test.diamond_blastp.nr.tax.outfmt6"
outDir = "diamond-blastp-tax-test"
chunkSize = "10"
app = 'diamond blastp'
diamondOpts = '--fast -e 1e-10 -k 10'
}
}
}
process {
errorStrategy = { task.exitStatus in [143,140,137,104,134,139,271] ? 'retry' : 'finish' }
maxRetries = 4
withLabel: 'diamond' {
cpus = { check_max( 10 + (2* task.attempt), 'cpus' ) }
memory = { check_max( 24.GB + (8.GB * task.attempt), 'memory' ) }
time = { check_max( 4.h + (2.h* task.attempt), 'time' ) }
container = 'buchfink/diamond'
conda = 'bioconda::diamond'
}
withLabel: 'blast' {
cpus = { check_max( 6 + (2 * task.attempt), 'cpus' ) }
memory = { check_max( 24.GB + (8.GB * task.attempt), 'memory' ) }
time = { check_max( 15.h + (5.h * task.attempt), 'time' ) }
container = 'ncbi/blast:latest'
conda = 'bioconda::blast'
}
withLabel:'sc_medium' {
cpus = { check_max( 1, 'cpus' ) }
memory = { check_max( 8.GB + (4.GB * task.attempt), 'memory' ) }
time = { check_max( 6.h + (2.h * task.attempt), 'time' ) }
}
withName: 'blast' {
cpus = { check_max( 8 + (2 * task.attempt), 'cpus' ) }
memory = { check_max( 32.GB + (16.GB * task.attempt), 'memory' ) }
time = { check_max( 45.h + (15.h * task.attempt), 'time' ) }
}
withName: 'diamond_prep_tax_db' {
time = { check_max( 7.h + (3.h * task.attempt), 'time' ) }
}
withName: 'download_tax_db' {
cpus = { check_max( 4 + (2 * task.attempt), 'cpus' ) }
memory = { check_max( 12.GB + (4.GB * task.attempt), 'memory' ) }
time = { check_max( 4.h + (2.h * task.attempt), 'time' ) }
container = 'andrey01/aria2c:latest'
conda = 'conda-forge::aria2'
}
}
// Capture exit codes from upstream processes when piping
process.shell = ['/bin/bash', '-euo', 'pipefail']
//
executor {
queueSize = 50
submitRateLimit = '10 sec'
}
timeline {
enabled = false
file = "${params.outDir}/${params.tracedir}/${manifest.name}_${params.app}_timeline.html"
}
report {
enabled = false
file = "${params.outDir}/${params.tracedir}/${manifest.name}_${params.app}_report.html"
}
trace {
enabled = false
file = "${params.outDir}/${params.tracedir}/${manifest.name}_${params.app}_trace.txt"
}
dag {
enabled = false
file = ( {nextflow.version.matches('22.04+')} ) ? "${params.outDir}/${params.tracedir}/${manifest.name}_${params.app}_dag.mmd" : "${params.outDir}/${params.tracedir}/${manifest.name}_${params.app}_dag.html"
//file = "${params.outDir}/${params.tracedir}/${workflow.manifest.name}_${params.app}_dag.html"
}
// Function to ensure that resource requirements don't go beyond
// a maximum limit
def check_max(obj, type) {
if (type == 'memory') {
try {
if (obj.compareTo(params.max_memory as nextflow.util.MemoryUnit) == 1)
return params.max_memory as nextflow.util.MemoryUnit
else
return obj
} catch (all) {
println " ### ERROR ### Max memory '${params.max_memory}' is not valid! Using default value: $obj"
return obj
}
} else if (type == 'time') {
try {
if (obj.compareTo(params.max_time as nextflow.util.Duration) == 1)
return params.max_time as nextflow.util.Duration
else
return obj
} catch (all) {
println " ### ERROR ### Max time '${params.max_time}' is not valid! Using default value: $obj"
return obj
}
} else if (type == 'cpus') {
try {
return Math.min( obj, params.max_cpus as int )
} catch (all) {
println " ### ERROR ### Max cpus '${params.max_cpus}' is not valid! Using default value: $obj"
return obj
}
}
}