-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathmain.nf
More file actions
46 lines (37 loc) · 1.41 KB
/
main.nf
File metadata and controls
46 lines (37 loc) · 1.41 KB
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
process CUSTOM_MODIFY_MODEL_CONFIG {
tag "${meta.id} - #trial ${n_trials}"
label 'process_low'
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ubuntu:22.04' :
'nf-core/ubuntu:22.04' }"
input:
tuple val(meta), path(config)
val(n_trials)
output:
tuple val(meta_updated), path("${prefix}.yaml"), emit: config
path "versions.yml" , emit: versions
script:
prefix = task.ext.prefix ?: "${config.baseName}-trials_updated"
meta_updated = meta + ["n_trials": "${n_trials}"]
"""
# substitte the line containing n_trials in the config file with n_trials: \${n_trials}
if [ "${n_trials}" = "[]" ]; then
cp "${config}" "${prefix}.yaml"
else
awk -v n_trials="${n_trials}" '/n_trials: [0-9]+/ {gsub(/n_trials: [0-9]+/, "n_trials: " n_trials)}1' "${config}" > "${prefix}.yaml"
fi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bash: \$(echo \$(bash --version | grep -Eo 'version [[:alnum:].]+' | sed 's/version //'))
END_VERSIONS
"""
stub:
prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.yaml
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bash: \$(echo \$(bash --version | grep -Eo 'version [[:alnum:].]+' | sed 's/version //'))
END_VERSIONS
"""
}