From b931440b9594c949646fddaf5ecbd6b30f7c289c Mon Sep 17 00:00:00 2001 From: Kevin Date: Sun, 24 May 2026 21:42:26 +0200 Subject: [PATCH] Replace with more complicated script from nextflow documentation --- main.nf | 59 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/main.nf b/main.nf index e88c16d..5118bef 100644 --- a/main.nf +++ b/main.nf @@ -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' + } +} \ No newline at end of file