From 38e4e31e47729a61c12aeedfae5b32187c0cd679 Mon Sep 17 00:00:00 2001 From: brovolia Date: Wed, 26 Aug 2026 15:40:18 +0200 Subject: [PATCH 1/2] using quoting for file names if possible --- modules/nf-core/gsea/gsea/main.nf | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/modules/nf-core/gsea/gsea/main.nf b/modules/nf-core/gsea/gsea/main.nf index 846ded4f44ba..b992ad287936 100644 --- a/modules/nf-core/gsea/gsea/main.nf +++ b/modules/nf-core/gsea/gsea/main.nf @@ -45,26 +45,41 @@ process GSEA_GSEA { def prefix = task.ext.prefix ?: "${meta.id}" def rpt_label = prefix.replaceAll('\\.$', '') // Remove any trailing dots from prefix when passed as report label, so GSEA doesn't produce double-dotted top-level outputs def chip_command = chip ? "-chip $chip -collapse true" : '' + // gsea-cli only accepts a single gene set collection per run: if given more + // than one -gmx file it builds an internal "analysis name" from rpt_label + // plus the list of collection names (Java List.toString(), e.g. "[a, b]") + // and validates *that* for spaces before it will even start, so it always + // crashes with "Analysis name cannot contain spaces". Callers must invoke + // this process once per gene set file rather than passing a list here. + def gmx = gene_sets instanceof List ? gene_sets[0] : gene_sets """ # Run GSEA gsea-cli GSEA \\ - -res $gct \\ - -cls ${cls}#${target}_versus_${reference} \\ - -gmx $gene_sets \\ + -res "$gct" \\ + -cls "${cls}#${target}_versus_${reference}" \\ + -gmx "$gmx" \\ $chip_command \\ -out . \\ - --rpt_label $rpt_label \\ + --rpt_label "$rpt_label" \\ $args # Un-timestamp the outputs for path consistency - mv ${rpt_label}.Gsea.*/* . + # We always give gsea-cli a single -gmx file now, so its output directory is + # just ".Gsea." -- but match on "*.Gsea.*" rather than + # anchoring on the literal rpt_label anyway, in case that ever changes. Only + # rmdir entries that are actual directories: the .rpt report file's own name + # also matches "*.Gsea.*", and rmdir on a file fails with "Not a directory". + mv *.Gsea.*/* . + for gsea_dir in *.Gsea.*/; do + [ -d "\$gsea_dir" ] && rmdir "\$gsea_dir" + done timestamp=\$(cat *.rpt | grep producer_timestamp | awk '{print \$2}') for pattern in _\${timestamp} .\${timestamp}; do find . -name "*\${pattern}*" | sed "s|^\\./||" | while read -r f; do - mv \$f \${f//\$pattern/} + mv "\$f" "\${f//\$pattern/}" done done sed -i.bak "s/[_\\.]\$timestamp//g" *.rpt *.html && rm *.bak From 8c1d7697601171e2db947e2b04b19e94e1a191c2 Mon Sep 17 00:00:00 2001 From: brovolia Date: Wed, 26 Aug 2026 15:52:59 +0200 Subject: [PATCH 2/2] dropping comments --- modules/nf-core/gsea/gsea/main.nf | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/modules/nf-core/gsea/gsea/main.nf b/modules/nf-core/gsea/gsea/main.nf index b992ad287936..b7655954522d 100644 --- a/modules/nf-core/gsea/gsea/main.nf +++ b/modules/nf-core/gsea/gsea/main.nf @@ -45,12 +45,7 @@ process GSEA_GSEA { def prefix = task.ext.prefix ?: "${meta.id}" def rpt_label = prefix.replaceAll('\\.$', '') // Remove any trailing dots from prefix when passed as report label, so GSEA doesn't produce double-dotted top-level outputs def chip_command = chip ? "-chip $chip -collapse true" : '' - // gsea-cli only accepts a single gene set collection per run: if given more - // than one -gmx file it builds an internal "analysis name" from rpt_label - // plus the list of collection names (Java List.toString(), e.g. "[a, b]") - // and validates *that* for spaces before it will even start, so it always - // crashes with "Analysis name cannot contain spaces". Callers must invoke - // this process once per gene set file rather than passing a list here. + // gsea-cli crashes if given more than one -gmx file; callers must invoke this process once per gene set file. def gmx = gene_sets instanceof List ? gene_sets[0] : gene_sets """ @@ -66,11 +61,7 @@ process GSEA_GSEA { $args # Un-timestamp the outputs for path consistency - # We always give gsea-cli a single -gmx file now, so its output directory is - # just ".Gsea." -- but match on "*.Gsea.*" rather than - # anchoring on the literal rpt_label anyway, in case that ever changes. Only - # rmdir entries that are actual directories: the .rpt report file's own name - # also matches "*.Gsea.*", and rmdir on a file fails with "Not a directory". + # Only rmdir actual directories: the .rpt file's name also matches "*.Gsea.*". mv *.Gsea.*/* . for gsea_dir in *.Gsea.*/; do [ -d "\$gsea_dir" ] && rmdir "\$gsea_dir"