You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config.md
+47-31Lines changed: 47 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,37 +22,65 @@ You can use the `-C <config-file>` option to use a single configuration file and
22
22
23
23
## Syntax
24
24
25
-
A Nextflow configuration file is a simple text file containing a set of properties defined using the syntax:
25
+
The Nextflow configuration syntax is based on the Nextflow script syntax. It is designed for setting configuration options in a declarative manner while also allowing for dynamic expressions where appropriate.
26
+
27
+
A Nextflow config file may consist of any number of *assignments*, *blocks*, and *includes*. Config files may also contain comments in the same manner as scripts.
28
+
29
+
See {ref}`syntax-page` for more information about the Nextflow script syntax.
30
+
31
+
### Assignments
32
+
33
+
A config assignment consists of a config option and an expression separated by an equals sign:
26
34
27
35
```groovy
28
-
name = value
36
+
workDir = 'work'
37
+
docker.enabled = true
38
+
process.maxErrors = 10
29
39
```
30
40
31
-
Please note, string values need to be wrapped in quotation characters while numbers and boolean values (`true`, `false`) do not. Also note that values are typed. This means that, for example, `1` is different from `'1'` — the former is interpreted as the number one, while the latter is interpreted as a string value.
41
+
A config option consists of an *option name* prefixed by any number of *scopes* separated by dots. Config scopes are used to group related config options. See {ref}`config-options` for the full set of config options.
42
+
43
+
The expression is typically a literal value such as a number, boolean, or string. However, any expression can be used:
Configuration properties can be used as variables in the configuration file by using the usual `$propertyName` or `${expression}` syntax.
49
+
### Blocks
36
50
37
-
For example:
51
+
A config scope can also be specified as a block, which may contain multiple configuration options. For example:
38
52
39
53
```groovy
40
-
propertyOne = 'world'
41
-
anotherProp = "Hello $propertyOne"
42
-
customPath = "$PATH:/my/app/folder"
54
+
// dot syntax
55
+
docker.enabled = true
56
+
docker.runOptions = '-u $(id -u):$(id -g)'
57
+
58
+
// block syntax
59
+
docker {
60
+
enabled = true
61
+
runOptions = '-u $(id -u):$(id -g)'
62
+
}
43
63
```
44
64
45
-
Please note, the usual rules for {ref}`string-interpolation` are applied, thus a string containing a variable reference must be wrapped in double-quote chars instead of single-quote chars.
65
+
As a result, deeply nested config options can be assigned in various ways. For example, the following three assignments are equivalent:
46
66
47
-
The same mechanism allows you to access environment variables defined in the hosting system. Any variable name not defined in the Nextflow configuration file(s) is interpreted to be a reference to an environment variable with that name. So, in the above example, the property `customPath` is defined as the current system `PATH` to which the string `/my/app/folder` is appended.
67
+
```groovy
68
+
executor.retry.maxAttempt = 5
48
69
49
-
### Comments
70
+
executor {
71
+
retry.maxAttempt = 5
72
+
}
50
73
51
-
Configuration files use the same conventions for comments used by the Groovy or Java programming languages. Thus, use `//` to comment a single line, or `/*` .. `*/` to comment a block on multiple lines.
74
+
executor {
75
+
retry {
76
+
maxAttempt = 5
77
+
}
78
+
}
79
+
```
52
80
53
81
### Includes
54
82
55
-
A configuration file can include one or more configuration files using the keyword `includeConfig`. For example:
83
+
A configuration file can include any number of other configuration files using the `includeConfig` keyword:
56
84
57
85
```groovy
58
86
process.executor = 'sge'
@@ -62,7 +90,11 @@ process.memory = '10G'
62
90
includeConfig 'path/foo.config'
63
91
```
64
92
65
-
When a relative path is used, it is resolved against the actual location of the including file.
93
+
Relative paths are resolved against the location of the including file.
94
+
95
+
:::{note}
96
+
Config includes can also be specified within config blocks. However, config files should only be included at the top level or in a [profile](#config-profiles) so that the included config file is valid on its own and in the context in which it is included.
97
+
:::
66
98
67
99
## Constants
68
100
@@ -79,22 +111,6 @@ The following constants are globally available in a Nextflow configuration file:
79
111
`projectDir`
80
112
: The directory where the main script is located.
81
113
82
-
## Config scopes
83
-
84
-
Configuration settings can be organized in different scopes by dot prefixing the property names with a scope identifier, or grouping the properties in the same scope using the curly brackets notation. For example:
85
-
86
-
```groovy
87
-
alpha.x = 1
88
-
alpha.y = 'string value..'
89
-
90
-
beta {
91
-
p = 2
92
-
q = 'another string ..'
93
-
}
94
-
```
95
-
96
-
See {ref}`config-options` for the full list of config settings.
Copy file name to clipboardExpand all lines: docs/developer/plugins.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@ This page describes how to create, test, and publish third-party plugins.
7
7
8
8
The best way to get started with your own plugin is to refer to the [nf-hello](https://github.com/nextflow-io/nf-hello) repository. This repository provides a minimal plugin implementation with several examples of different extension points and instructions for building, testing, and publishing.
9
9
10
+
Plugins can be written in Java or Groovy.
11
+
10
12
The minimal dependencies are as follows:
11
13
12
14
```groovy
@@ -151,7 +153,7 @@ Refer to the source code of Nextflow's built-in executors to see how to implemen
151
153
:::{versionadded} 22.09.0-edge
152
154
:::
153
155
154
-
Plugins can define custom Groovy functions, which can then be included into Nextflow pipelines.
156
+
Plugins can define custom functions, which can then be included in Nextflow pipelines.
155
157
156
158
To implement a custom function, create a class in your plugin that extends the `PluginExtensionPoint` class, and implement your function with the `Function` annotation:
Copy file name to clipboardExpand all lines: docs/dsl1.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ In DSL1, the entire Nextflow pipeline must be defined in a single file (e.g. `ma
88
88
DSL2 introduces the concept of "module scripts" (or "modules" for short), which are Nextflow scripts that can be "included" by other scripts. While modules are not essential to migrating to DSL2, nor are they mandatory in DSL2 by any means, modules can help you organize a large pipeline into multiple smaller files, and take advantage of modules created by others. Check out the {ref}`module-page` to get started.
89
89
90
90
:::{note}
91
-
With DSL2, the Groovy shell used by Nextflow also imposes a 64KB size limit on pipeline scripts, so if your DSL1 script is very large, you may need to split your script into modules anyway to avoid this limit.
91
+
DSL2 scripts cannot exceed 64 KB in size. Large DSL1 scriptsmay need to be split into modules to avoid this limit.
Copy file name to clipboardExpand all lines: docs/module.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,15 +2,15 @@
2
2
3
3
# Modules
4
4
5
-
In Nextflow, a **module**is a script that may contain functions, processes, and workflows (collectively referred to as *components*). A module can be included in other modules or pipeline scripts and even shared across workflows.
5
+
Nextflow scripts can include **definitions**(workflows, processes, and functions) from other scripts. When a script is included in this way, it is referred to as a **module**. Modules can be included by other modules or pipeline scripts and can even be shared across workflows.
6
6
7
7
:::{note}
8
8
Modules were introduced in DSL2. If you are still using DSL1, see the {ref}`dsl1-page` page to learn how to migrate your Nextflow pipelines to DSL2.
9
9
:::
10
10
11
11
## Module inclusion
12
12
13
-
A component defined in a module script can be imported into another Nextflow script using the `include` keyword.
13
+
You can include any definition from a module into a Nextflow script using the `include` keyword.
14
14
15
15
For example:
16
16
@@ -23,7 +23,7 @@ workflow {
23
23
}
24
24
```
25
25
26
-
The above snippet imports a process named `foo`, defined in the module script, into the main execution context. This way, `foo` can be invoked in the `workflow` scope.
26
+
The above snippet imports a process named `foo`, defined in the module, into the main execution context. This way, `foo` can be invoked in the `workflow` scope.
27
27
28
28
Nextflow implicitly looks for the script file `./some/module.nf`, resolving the path against the *including* script location.
29
29
@@ -57,7 +57,7 @@ Module directories allow the use of module scoped binaries scripts. See [Module
57
57
58
58
## Multiple inclusions
59
59
60
-
A Nextflow script can include any number of modules, and an `include` statement can import any number of components from a module. Multiple components can be included from the same module by using the syntax shown below:
60
+
A Nextflow script can include any number of modules, and an `include` statement can import any number of definitions from a module. Multiple definitions can be included from the same module by using the syntax shown below:
61
61
62
62
```groovy
63
63
include { foo; bar } from './some/module'
@@ -73,7 +73,7 @@ workflow {
73
73
74
74
## Module aliases
75
75
76
-
When including a module component, it's possible to specify an *alias* with the `as` keyword. Aliasing allows you to avoid module name clashes, by assigning them different names in the including context. For example:
76
+
When including definition from a module, it's possible to specify an *alias* with the `as` keyword. Aliasing allows you to avoid module name clashes, by assigning them different names in the including context. For example:
77
77
78
78
```groovy
79
79
include { foo } from './some/module'
@@ -85,7 +85,7 @@ workflow {
85
85
}
86
86
```
87
87
88
-
You can even include the same component multiple times under different names:
88
+
You can also include the same definition multiple times under different names:
89
89
90
90
```groovy
91
91
include { foo; foo as bar } from './some/module'
@@ -96,13 +96,15 @@ workflow {
96
96
}
97
97
```
98
98
99
+
(module-params)=
100
+
99
101
## Module parameters
100
102
101
103
:::{deprecated} 24.07.0-edge
102
-
As a best practice, parameters should be used in the entry workflow and passed to functions / processes / workflows as explicit inputs.
104
+
As a best practice, parameters should be used in the entry workflow and passed to workflows, processes, and functions as explicit inputs.
103
105
:::
104
106
105
-
A module script can define parameters using the same syntax as a Nextflow workflow script:
107
+
A module can define parameters using the same syntax as a Nextflow workflow script:
106
108
107
109
```groovy
108
110
params.foo = 'Hello'
@@ -182,9 +184,9 @@ Ciao world!
182
184
183
185
## Module templates
184
186
185
-
The module script can be defined in an external {ref}`template <process-template>`file. The template file can be placed in the `templates` directory where the module script is located.
187
+
Process script {ref}`templates <process-template>`can be included alongside a module in the `templates` directory.
186
188
187
-
For example, suppose we have a project L with a module script that defines two processes, P1 and P2, both of which use templates. The template files can be made available in the local `templates` directory:
189
+
For example, suppose we have a project L with a module that defines two processes, P1 and P2, both of which use templates. The template files can be made available in the local `templates` directory:
188
190
189
191
```
190
192
Project L
@@ -208,15 +210,15 @@ Pipeline B
208
210
└── main.nf
209
211
```
210
212
211
-
With the possibility to keep the template files inside the project L, A and B can use the modules defined in L without any changes. A future project C would do the same, just cloning L (if not available on the system) and including its module script.
213
+
With the possibility to keep the template files inside the project L, A and B can use the modules defined in L without any changes. A future project C would do the same, just cloning L (if not available on the system) and including its module.
212
214
213
215
Beside promoting the sharing of modules across pipelines, there are several advantages to keeping the module template under the script path:
214
216
215
-
1.module components are *self-contained*,
216
-
2.module components can be tested independently from the pipeline(s) that import them,
217
-
3.it is possible to create libraries of module components.
217
+
1.Modules are self-contained
218
+
2.Modules can be tested independently from the pipeline(s) that import them
219
+
3.Modules can be made into libraries
218
220
219
-
Ultimately, having multiple template locations allows a more structured organization within the same project. If a project has several module components, and all of them use templates, the project could group module scripts and their templates as needed. For example:
221
+
Having multiple template locations enables a structured project organization. If a project has several modules, and they all use templates, the project could group module scripts and their templates as needed. For example:
Copy file name to clipboardExpand all lines: docs/overview.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,11 +95,9 @@ Read the {ref}`executor-page` to learn more about the Nextflow executors.
95
95
96
96
## Scripting language
97
97
98
-
Nextflow is designed to have a minimal learning curve, without having to pick up a new programming language. In most cases, users can utilise their current skills to develop Nextflow workflows. However, it also provides a powerful scripting DSL.
98
+
Nextflow is a workflow language based on [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) and [Groovy](https://groovy-lang.org/). It is designed to simplify writing scalable and reproducible pipelines. In most cases, users can leverage their existing programming skills to develop Nextflow pipelines without the steep learning curve that usually comes with a new programming language.
99
99
100
-
Nextflow scripting is an extension of the [Groovy programming language](<http://en.wikipedia.org/wiki/Groovy_(programming_language)>), which in turn is a super-set of the Java programming language. Groovy can be considered as Python for Java in that it simplifies the writing of code and is more approachable.
101
-
102
-
Read the {ref}`script-page` section to learn about the Nextflow scripting language.
100
+
See {ref}`script-page` for more information about the Nextflow scripting language.
0 commit comments