-
Notifications
You must be signed in to change notification settings - Fork 764
Document formal script syntax #5336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
9d6c826
189b560
24bb403
5c0ec1d
39ee1c9
00ba5d1
69772bf
24e65e0
e9faf58
23e05b7
1a173a0
74480fc
4aee05a
e073700
6a66f71
0d91594
3d29edb
71236c9
505c98e
0645746
9444ed1
110ede7
48ac8b5
30ea996
93154ee
04a311d
63633d1
17b7ab5
3f6f377
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,37 +22,63 @@ You can use the `-C <config-file>` option to use a single configuration file and | |
|
|
||
| ## Syntax | ||
|
|
||
| A Nextflow configuration file is a simple text file containing a set of properties defined using the syntax: | ||
| 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. Refer to {ref}`syntax-page`, particularly the sections on comments and expressions, for a full description of the available syntax. | ||
bentsherman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| A Nextflow config file consists of any number of *assignments*, *blocks*, and *includes*. Config files may also contain comments in the same manner as scripts. | ||
bentsherman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Assignments | ||
|
|
||
| A config assignment consists of a config option and an expression separated by an equals sign: | ||
|
|
||
| ```groovy | ||
| name = value | ||
| workDir = 'work' | ||
| docker.enabled = true | ||
| process.maxErrors = 10 | ||
| ``` | ||
|
|
||
| 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. | ||
| A config option consists of one or more names separated by dots. The names other than the last one are known as *config scopes*. See {ref}`config-options` for the full set of config options organized by scope. | ||
|
||
|
|
||
| ### Variables | ||
| The right-hand side is typically a literal value such as a number, boolean, or string, but can be any expression, such as a dynamic string: | ||
bentsherman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Configuration properties can be used as variables in the configuration file by using the usual `$propertyName` or `${expression}` syntax. | ||
| ```groovy | ||
| params.helper_file = "${projectDir}/assets/helper.txt" | ||
| ``` | ||
|
|
||
| For example: | ||
| ### Blocks | ||
|
|
||
| A config scope can also be specified as a block, in which case any number of config options within that scope can be assigned: | ||
bentsherman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```groovy | ||
| propertyOne = 'world' | ||
| anotherProp = "Hello $propertyOne" | ||
| customPath = "$PATH:/my/app/folder" | ||
| // dot syntax | ||
| docker.enabled = true | ||
| docker.runOptions = '-u $(id -u):$(id -g)' | ||
|
|
||
| // block syntax | ||
| docker { | ||
| enabled = true | ||
| runOptions = '-u $(id -u):$(id -g)' | ||
| } | ||
| ``` | ||
|
|
||
| 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. | ||
| As a result, deeply nested config options can be assigned in a variety of ways. For example, the following three assignments are equivalent: | ||
bentsherman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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. | ||
| ```groovy | ||
| executor.retry.maxAttempt = 5 | ||
|
|
||
| ### Comments | ||
| executor { | ||
| retry.maxAttempt = 5 | ||
| } | ||
|
|
||
| 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. | ||
| executor { | ||
| retry { | ||
| maxAttempt = 5 | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Includes | ||
|
|
||
| A configuration file can include one or more configuration files using the keyword `includeConfig`. For example: | ||
| A config file can include any number of other config files using the `includeConfig` keyword: | ||
bentsherman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```groovy | ||
| process.executor = 'sge' | ||
|
|
@@ -62,7 +88,11 @@ process.memory = '10G' | |
| includeConfig 'path/foo.config' | ||
| ``` | ||
|
|
||
| When a relative path is used, it is resolved against the actual location of the including file. | ||
| When a relative path is used, it is resolved against the location of the including file. | ||
bentsherman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| :::{note} | ||
| Config includes can also be specified within config blocks. However, config files should only be included either at the top-level or in a [profile](#config-profiles), so that the included config file is valid both on its own and in the context in which it is included. | ||
bentsherman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ::: | ||
|
|
||
| ## Constants | ||
|
|
||
|
|
@@ -79,22 +109,6 @@ The following constants are globally available in a Nextflow configuration file: | |
| `projectDir` | ||
| : The directory where the main script is located. | ||
|
|
||
| ## Config scopes | ||
|
|
||
| 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: | ||
|
|
||
| ```groovy | ||
| alpha.x = 1 | ||
| alpha.y = 'string value..' | ||
|
|
||
| beta { | ||
| p = 2 | ||
| q = 'another string ..' | ||
| } | ||
| ``` | ||
|
|
||
| See {ref}`config-options` for the full list of config settings. | ||
|
|
||
| (config-params)= | ||
|
|
||
| ## Parameters | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.