-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnextflow.config
219 lines (186 loc) · 5.48 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
manifest {
author = 'David Chisanga, Gabriel Keeble-Gagnere, Kerrie L Forrest, Josquin F Tibbits'
name = 'shortbread2'
description = 'shortbread2 - Scaling SNP calling capabilities with Nextflow'
version = '1.0.0'
nextflowVersion = '>= 20.07.0'
mainScript = 'main.nf'
homePage = 'https://github.com/plantinformatics/shortbread2'
}
//Check version of Java and if conda is installed
def requiredJavaVersion = 11
// Get the Java version as a String (e.g., "17.0.2")
def javaVersionString = System.getProperty("java.version")
// Extract the major version number
def javaVersion = javaVersionString.tokenize('_')[0].tokenize('.')[0] as int
if (javaVersion < requiredJavaVersion) {
throw new RuntimeException("Java version $requiredJavaVersion or higher is required. Current version: $javaVersionString")
} else {
System.out.println("Java version check passed. Using Java $javaVersionString")
}
def isCondaInstalled() {
try {
def process = "conda --version".execute()
process.waitFor()
System.out.println(process.text.trim())
return process.exitValue() == 0
} catch (IOException e) {
return false
}
}
if (isCondaInstalled()) {
System.out.println("Conda is installed.")
} else {
System.err.println("Conda is not installed! Shortbread2 uses conda as a package manager\nMake sure that you have conda installed")
System.exit(1)
}
includeConfig "${projectDir}/configs/initialiseconda.config"
import java.lang.System
//Set environment variables to be used by Nextflow
env {
_JAVA_OPTIONS="-Xmx200g -XX:+UnlockExperimentalVMOptions" //environment variables to be used by Java to allocate heap memory
//PATH="$PATH:\$PATH"
}
//Check if parameters have been passed
if (params.isEmpty()) {
System.out.println("Warning: No parameter file Specified!")
params.help=true
}
else
{
params.help=false
}
//Include help file to check if parameters have been passed
includeConfig "${projectDir}/configs/help.config"
if(params.containsKey('paramfile') && new File(params.paramfile).exists())
{
includeConfig "${params.paramfile}"
}
else
{
//System.out.println("Running shortbread using default parameter file: '${projectDir}/params.config'")
includeConfig "${projectDir}/params.config"
}
def command = ["sh","-c","echo sleeping for 5 second; sleep 5s"]
def sleeprocess = command.execute()
sleeprocess.waitFor()
//Define parameter for processes to use scratch space
process {
cache = 'lenient'
withLabel: 'usescratch'{
scratch = true
}
cleanup = true
}
//Define profiles to use
profiles {
//Runs on the local host
standard {
executor {
name='local'
}
process {
cpus = 5
queueSize=5
}
}
slurm {
executor {
name='slurm'
queueSize =1000
jobName={"sb2-$task.process($task.tag)"}
}
process{
errorStrategy = { task.exitStatus in 137..149 ? 'retry' : 'terminate' }
maxRetries = 3
//default resources allocated to individual processes
queue = { task.index%2==0 || task.attempt>1 ? 'batch':'shortrun' }
cpus = 2
time = { 6.h * task.attempt }
withLabel: 'verysmall' {
cpus = 15
memory = { 200.GB * task.attempt }
time = { 24.h * task.attempt }
queue = 'batch'
}
//Passed to the alignment step
withLabel: 'small'
{
cpus = 20
time = { 24.h * task.attempt }
memory = { 200.GB * task.attempt }
queue = 'batch'
}
withLabel: 'medium' {
cpus = 25
memory = { 200.GB * task.attempt }
time = { 24.h * task.attempt }
queue = 'batch'
}
withLabel:'GATK'
{
container='broadinstitute/gatk:4.6.0.0'
}
//resources requested for large runs
withLabel: 'large' {
cpus = 20
memory = { 100.GB * task.attempt }
time = { 48.h * task.attempt }
queue = 'batch'
}
//resources requested for very large runs
withLabel: 'verylarge' {
cpus = 20
memory = { 200.GB * task.attempt }
time = { 5.d * task.attempt }
queue = 'batch'
}
withLabel: 'GATKsmall' {
time = { 1.d * task.attempt }
queue = 'batch'
memory = { 200.GB * task.attempt }
}
withLabel: 'GATKmedium' {
time = { 36.h * task.attempt }
queue = 'batch'
memory = { 200.GB * task.attempt }
}
withLabel: 'GATKlarge' {
time = { 48.h * task.attempt }
queue = 'batch'
memory = { 300.GB * task.attempt }
}
withLabel: 'GATKverylarge' {
time = { 3.d * task.attempt }
queue = 'batch'
memory = { 400.GB * task.attempt }
}
withLabel: 'haplotyping' {
memory = { 100.GB * task.attempt }
}
withLabel: 'qualitycontrol' {
memory = { 400.GB * task.attempt }
}
clusterOptions = "--account ${params.clusteraccount} --export=ALL"
}
}
}
//Enable conda environments
conda {
conda="${projectDir}/conda_environment.yml"
enabled=true
cacheDir=System.getProperty("user.home")+"/.conda/envs/"
createTimeout='90 min'
}
process.conda="${projectDir}/conda_environment.yml"
//Do not edit
includeConfig "${projectDir}/configs/modules.config"
includeConfig "${projectDir}/configs/startup.config"
if (params.mode=='test')
{
System.out.println("Running shortbread in test mode")
}
else
{
System.out.println("Running shortbread in production mode")
}