Replace with more complicated script from nextflow documentation

This commit is contained in:
2026-05-24 21:42:26 +02:00
parent 6361238ad5
commit b931440b95

59
main.nf
View File

@@ -1,18 +1,57 @@
nextflow.enable.dsl = 2
process hello {
container 'ubuntu:22.04'
// Default parameter input
params.str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
output:
path 'hello.txt'
// split process
process split {
publishDir "results/lower"
script:
"""
echo "Hello, from kubernetes" > hello.txt
hostname >> hello.txt
"""
input:
val x
output:
path 'chunk_*'
script:
"""
printf '${x}' | split -b 6 - chunk_
"""
}
// convert_to_upper process
process convert_to_upper {
tag "$y"
input:
path y
output:
path 'upper_*'
script:
"""
cat $y | tr '[a-z]' '[A-Z]' > upper_${y}
"""
}
// Workflow block
workflow {
hello()
main:
ch_str = channel.of(params.str) // Create a channel using parameter input
ch_chunks = split(ch_str) // Split string into chunks and create a named channel
ch_upper = convert_to_upper(ch_chunks.flatten()) // Convert lowercase letters to uppercase letters
publish:
lower = ch_chunks.flatten()
upper = ch_upper
}
output {
lower {
path 'lower'
}
upper {
path 'upper'
}
}