diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b04986a7..a3ae93973 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ Thank you to everyone else that has contributed by reporting bugs, enhancements - [PR #1245](https://github.com/nf-core/rnaseq/pull/1245) - nf test quantify rsem - [PR #1246](https://github.com/nf-core/rnaseq/pull/1246) - nf-test quantify pseudoalignment - [PR #1247](https://github.com/nf-core/rnaseq/pull/1247) - nf-test prepare_genome +- [PR #1248](https://github.com/nf-core/rnaseq/pull/1248) - Improved ext.args consolidation for STAR and TRIMGALORE extra_args parameters - [PR #1249](https://github.com/nf-core/rnaseq/pull/1249) - Include nf-tests for rsem_merge_counts module - [PR #1250](https://github.com/nf-core/rnaseq/pull/1250) - Remove all tags.yml files because the testing system has changed - [PR #1251](https://github.com/nf-core/rnaseq/pull/1251) - Replace deseq2qc paths diff --git a/subworkflows/local/align_star/nextflow.config b/subworkflows/local/align_star/nextflow.config index 68bfef562..119eb6e4a 100644 --- a/subworkflows/local/align_star/nextflow.config +++ b/subworkflows/local/align_star/nextflow.config @@ -1,20 +1,37 @@ if (!params.skip_alignment && params.aligner == 'star_salmon') { process { withName: '.*:ALIGN_STAR:STAR_ALIGN|.*:ALIGN_STAR:STAR_ALIGN_IGENOMES' { - ext.args = { [ - '--quantMode TranscriptomeSAM', - '--twopassMode Basic', - '--outSAMtype BAM Unsorted', - '--readFilesCommand zcat', - '--runRNGseed 0', - '--outFilterMultimapNmax 20', - '--alignSJDBoverhangMin 1', - '--outSAMattributes NH HI AS NM MD', - '--quantTranscriptomeBan Singleend', - '--outSAMstrandField intronMotif', - params.save_unaligned ? '--outReadsUnmapped Fastx' : '', - params.extra_star_align_args ? params.extra_star_align_args.split("\\s(?=--)") : '' - ].flatten().unique(false).join(' ').trim() } + ext.args = { + // Function to convert argument strings into a map + def argsToMap = { String args -> + args.split("\\s(?=--)").collectEntries { + def parts = it.trim().split(/\s+/, 2) + [(parts.first()): parts.last()] + } + } + + // Initialize the map with preconfigured values + def preset_args_map = argsToMap(""" + --quantMode TranscriptomeSAM + --twopassMode Basic + --outSAMtype BAM Unsorted + --readFilesCommand zcat + --runRNGseed 0 + --outFilterMultimapNmax 20 + --alignSJDBoverhangMin 1 + --outSAMattributes NH HI AS NM MD + --quantTranscriptomeBan Singleend + --outSAMstrandField intronMotif + ${params.save_unaligned ? '--outReadsUnmapped Fastx' : ''} + """.trim()) + + // Consolidate the extra arguments + def final_args_map = preset_args_map + (params.extra_star_align_args ? argsToMap(params.extra_star_align_args) : [:]) + + // Convert the map back to a list and then to a single string + final_args_map.collect { key, value -> "${key} ${value}" }.join(' ').trim() + } + publishDir = [ [ path: { "${params.outdir}/${params.aligner}/log" }, diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config b/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config index 7279111e5..6de6b513d 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config +++ b/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config @@ -13,10 +13,24 @@ if (!params.skip_trimming) { process { withName: '.*:FASTQ_FASTQC_UMITOOLS_TRIMGALORE:TRIMGALORE' { ext.args = { - [ - "--fastqc_args '-t ${task.cpus}'", - params.extra_trimgalore_args ? params.extra_trimgalore_args.split("\\s(?=--)") : '' - ].flatten().unique(false).join(' ').trim() + // Function to convert argument strings into a map + def argsToMap = { String args -> + args.split("\\s(?=--)").collectEntries { + def parts = it.trim().split(/\s+/, 2) + [(parts.first()): parts.last()] + } + } + + // Initialize the map with preconfigured values + def preset_args_map = argsToMap(""" + --fastqc_args '-t ${task.cpus}' + """.trim()) + + // Consolidate the extra arguments + def final_args_map = preset_args_map + (params.extra_trimgalore_args ? argsToMap(params.extra_trimgalore_args) : [:]) + + // Convert the map back to a list and then to a single string + final_args_map.collect { key, value -> "${key} ${value}" }.join(' ').trim() } publishDir = [ [