Replace with more complicated script from nextflow documentation
This commit is contained in:
59
main.nf
59
main.nf
@@ -1,18 +1,57 @@
|
|||||||
nextflow.enable.dsl = 2
|
nextflow.enable.dsl = 2
|
||||||
|
|
||||||
process hello {
|
// Default parameter input
|
||||||
container 'ubuntu:22.04'
|
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:
|
// split process
|
||||||
path 'hello.txt'
|
process split {
|
||||||
|
publishDir "results/lower"
|
||||||
|
|
||||||
script:
|
input:
|
||||||
"""
|
val x
|
||||||
echo "Hello, from kubernetes" > hello.txt
|
|
||||||
hostname >> hello.txt
|
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 {
|
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'
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user