Skip to content

Commit

Permalink
Merge pull request #1248 from MatthiasZepper/ExtraArgsConsolidation
Browse files Browse the repository at this point in the history
Improved ext.args consolidation for STAR and TRIMGALORE
  • Loading branch information
MatthiasZepper authored Apr 18, 2024
2 parents d129b5a + 6ab2e44 commit dcd5659
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 31 additions & 14 deletions subworkflows/local/align_star/nextflow.config
Original file line number Diff line number Diff line change
@@ -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" },
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dcd5659

Please sign in to comment.