可以使用 Nextflow 的命令行界面通过在参数名称前加上双破折号来覆盖管道参数。例如,将以下内容放入名为“test.nf”的文件中:
#!/usr/bin/env nextflow
params.greeting = 'Hello'
names = Channel.of( "foo", "bar", "baz" )
process greet {
input:
val name from names
output:
stdout result
"""
echo "${params.greeting} ${name}"
"""
}
result.view { it.trim() }
并使用以下命令运行它:
nextflow run -ansi-log false test.nf --greeting 'Bonjour'
结果:
N E X T F L O W ~ version 20.10.0
Launching `test.nf` [backstabbing_cajal] - revision: 431ef92cef
[46/22b4f0] Submitted process > greet (1)
[ca/32992c] Submitted process > greet (3)
[6e/5880b0] Submitted process > greet (2)
Bonjour bar
Bonjour foo
Bonjour baz
这适用于管道参数,但 AFAIK 无法像您在命令行中描述的那样直接覆盖执行器配置。但是,您可以只参数化这些值并在命令行上设置它们,如上所述。例如,在您的 nextflow.config 中:
params {
gc_region = false
gc_preemptible = true
...
}
profiles {
'test' {
includeConfig 'conf/test.config'
}
'google' {
includeConfig 'conf/google.config'
}
...
}
在一个名为“conf/google.config”的文件中:
google {
project = "cool-project"
region = params.gc_region
lifeSciences {
bootDiskSize = "200 GB"
debug = true
preemptible = params.gc_preemptible
}
}
然后你应该能够以通常的方式覆盖这些:
nextflow run main.nf -profile google --gc_region "europe-west4" --gc_preemptible false
请注意,您还可以通过用逗号分隔配置文件名称来指定多个配置文件:
nextflow run main.nf -profile google,test ...