diff --git a/modules/local/preprocess_expdesign.nf b/modules/local/preprocess_expdesign.nf index 61638a9a..779fcf41 100644 --- a/modules/local/preprocess_expdesign.nf +++ b/modules/local/preprocess_expdesign.nf @@ -1,19 +1,28 @@ // Fixing file endings only necessary if the experimental design is user-specified +// TODO can we combine this with another step? Feels like a waste to spawn a worker for this. +// Maybe the renaming can be done in the rawfileconversion step? Or check if the OpenMS tools +// accept different file endings already? process PREPROCESS_EXPDESIGN { label 'process_very_low' label 'process_single_thread' + container "frolvlad/alpine-bash" + input: path design output: path "experimental_design.tsv", emit: ch_expdesign - path "process_experimental_design.tsv", emit: process_ch_expdesign + path "config.tsv", emit: ch_config script: """ + # since we know that we will need to convert from raw to mzML for all tools that need the design (i.e., OpenMS tools) + # we edit the design here and change the endings. sed 's/.raw\\t/.mzML\\t/I' $design > experimental_design.tsv - a=\$(grep -n '^\$' $design | head -n1| awk -F":" '{print \$1}'); sed -e ''"\${a}"',\$d' $design > process_experimental_design.tsv + + # here we extract the filenames and fake an empty config (since the config values will be deduced from the workflow params) + a=\$(grep -n '^\$' $design | head -n1| awk -F":" '{print \$1}'); sed -e ''"\${a}"',\$d' $design > config.tsv """ } diff --git a/subworkflows/local/create_input_channel.nf b/subworkflows/local/create_input_channel.nf index 256335b7..93109b8e 100644 --- a/subworkflows/local/create_input_channel.nf +++ b/subworkflows/local/create_input_channel.nf @@ -20,14 +20,14 @@ workflow CREATE_INPUT_CHANNEL { if (is_sdrf.toString().toLowerCase().contains("true")) { SDRFPARSING ( ch_sdrf_or_design ) ch_versions = ch_versions.mix(SDRFPARSING.out.version) - ch_in_design = SDRFPARSING.out.ch_sdrf_config_file + ch_config = SDRFPARSING.out.ch_sdrf_config_file ch_expdesign = SDRFPARSING.out.ch_expdesign } else { PREPROCESS_EXPDESIGN( ch_sdrf_or_design ) - ch_in_design = PREPROCESS_EXPDESIGN.out.process_ch_expdesign + ch_config = PREPROCESS_EXPDESIGN.out.ch_config - ch_expdesign = PREPROCESS_EXPDESIGN.out.ch_expdesign + ch_expdesign = PREPROCESS_EXPDESIGN.out.ch_expdesign } Set enzymes = [] @@ -38,7 +38,7 @@ workflow CREATE_INPUT_CHANNEL { wrapper.labelling_type = "" wrapper.acquisition_method = "" - ch_in_design.splitCsv(header: true, sep: '\t') + ch_config.splitCsv(header: true, sep: '\t') .map { create_meta_channel(it, is_sdrf, enzymes, files, wrapper) } .branch { ch_meta_config_dia: it[0].acquisition_method.contains("dia")