Skip to content

Commit 0cf46ec

Browse files
pinin4fjordsclaude
andcommitted
fix: Centralise STAR args config and add parabricks prokaryotic support
- Consolidate 3 separate ext.args blocks in align_star/nextflow.config into a single block using task.process conditionals - Add PARABRICKS_STARGENOMEGENERATE to prepare_genome config for --sjdbGTFfeatureExon CDS (prokaryotic) and publishDir - Route test-specific pbrun flags through extra_star_align_args param instead of overriding ext.args in test configs - Update align_star parabricks snapshot for topic-based versions (null) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 62e84d3 commit 0cf46ec

6 files changed

Lines changed: 58 additions & 114 deletions

File tree

subworkflows/local/align_star/nextflow.config

Lines changed: 44 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -3,101 +3,56 @@ process {
33
// STAR alignment configuration
44
// Conditionals for when these processes run are handled in the workflow
55

6-
withName: '.*:ALIGN_STAR:STAR_ALIGN' {
6+
withName: '.*:ALIGN_STAR:STAR_ALIGN|.*:ALIGN_STAR:STAR_ALIGN_IGENOMES|.*:ALIGN_STAR:SENTIEON_STAR_ALIGN|.*:ALIGN_STAR:PARABRICKS_RNA_FQ2BAM' {
77
ext.args = {
8-
def quantifier = params.aligner == 'star_rsem' ? 'rsem' : 'salmon'
8+
def isPbrun = task.process.contains('PARABRICKS')
9+
def isBaseStarAlign = task.process.endsWith(':STAR_ALIGN')
10+
def args = []
911

10-
// Common args
11-
def args = [
12-
'--quantMode TranscriptomeSAM',
13-
'--outSAMtype BAM Unsorted',
14-
'--outSAMattributes NH HI AS NM MD',
15-
'--readFilesCommand zcat'
16-
]
17-
18-
// Add quantifier-specific args
19-
if (quantifier == 'rsem') {
20-
args += [
21-
'--outSAMunmapped Within',
22-
'--outFilterType BySJout',
23-
'--outFilterMultimapNmax 20',
24-
'--outFilterMismatchNmax 999',
25-
'--outFilterMismatchNoverLmax 0.04',
26-
'--alignIntronMin 20',
27-
'--alignIntronMax 1000000',
28-
'--alignMatesGapMax 1000000',
29-
'--alignSJoverhangMin 8',
30-
'--alignSJDBoverhangMin 1',
31-
'--sjdbScore 1'
32-
]
33-
} else {
34-
args += [
35-
'--twopassMode Basic',
36-
'--runRNGseed 0',
37-
'--outFilterMultimapNmax 20',
38-
'--alignSJDBoverhangMin 1',
39-
'--outSAMstrandField intronMotif',
40-
'--quantTranscriptomeSAMoutput BanSingleEnd'
41-
]
42-
}
43-
44-
if (params.save_unaligned || params.contaminant_screening) {
45-
args += ['--outReadsUnmapped Fastx']
46-
}
47-
48-
// For prokaryotic data, use CDS features and disable spliced alignment
49-
if (params.prokaryotic) {
50-
args += ['--sjdbGTFfeatureExon CDS', '--alignIntronMax 1']
51-
}
52-
53-
if (params.extra_star_align_args) {
54-
args += [params.extra_star_align_args]
55-
}
56-
57-
args.join(' ')
58-
}
59-
}
12+
// Native STAR processes need explicit STAR args; pbrun handles these internally
13+
if (!isPbrun) {
14+
def quantifier = params.aligner == 'star_rsem' ? 'rsem' : 'salmon'
6015

61-
withName: '.*:ALIGN_STAR:STAR_ALIGN_IGENOMES|.*:ALIGN_STAR:SENTIEON_STAR_ALIGN' {
62-
ext.args = {
63-
def quantifier = params.aligner == 'star_rsem' ? 'rsem' : 'salmon'
64-
65-
// Common args
66-
def args = [
67-
'--quantMode TranscriptomeSAM',
68-
'--outSAMtype BAM Unsorted',
69-
'--outSAMattributes NH HI AS NM MD',
70-
'--readFilesCommand zcat'
71-
]
72-
73-
// Add quantifier-specific args
74-
if (quantifier == 'rsem') {
16+
// Common args
7517
args += [
76-
'--outSAMunmapped Within',
77-
'--outFilterType BySJout',
78-
'--outFilterMultimapNmax 20',
79-
'--outFilterMismatchNmax 999',
80-
'--outFilterMismatchNoverLmax 0.04',
81-
'--alignIntronMin 20',
82-
'--alignIntronMax 1000000',
83-
'--alignMatesGapMax 1000000',
84-
'--alignSJoverhangMin 8',
85-
'--alignSJDBoverhangMin 1',
86-
'--sjdbScore 1'
18+
'--quantMode TranscriptomeSAM',
19+
'--outSAMtype BAM Unsorted',
20+
'--outSAMattributes NH HI AS NM MD',
21+
'--readFilesCommand zcat'
8722
]
88-
} else {
89-
args += [
90-
'--twopassMode Basic',
91-
'--runRNGseed 0',
92-
'--outFilterMultimapNmax 20',
93-
'--alignSJDBoverhangMin 1',
94-
'--outSAMstrandField intronMotif',
95-
'--quantTranscriptomeBan Singleend'
96-
]
97-
}
9823

99-
if (params.save_unaligned || params.contaminant_screening) {
100-
args += ['--outReadsUnmapped Fastx']
24+
// Add quantifier-specific args
25+
if (quantifier == 'rsem') {
26+
args += [
27+
'--outSAMunmapped Within',
28+
'--outFilterType BySJout',
29+
'--outFilterMultimapNmax 20',
30+
'--outFilterMismatchNmax 999',
31+
'--outFilterMismatchNoverLmax 0.04',
32+
'--alignIntronMin 20',
33+
'--alignIntronMax 1000000',
34+
'--alignMatesGapMax 1000000',
35+
'--alignSJoverhangMin 8',
36+
'--alignSJDBoverhangMin 1',
37+
'--sjdbScore 1'
38+
]
39+
} else {
40+
args += [
41+
'--twopassMode Basic',
42+
'--runRNGseed 0',
43+
'--outFilterMultimapNmax 20',
44+
'--alignSJDBoverhangMin 1',
45+
'--outSAMstrandField intronMotif'
46+
]
47+
// STAR_ALIGN uses newer flag name; IGENOMES/SENTIEON use older STAR version flag
48+
args += isBaseStarAlign
49+
? ['--quantTranscriptomeSAMoutput BanSingleEnd']
50+
: ['--quantTranscriptomeBan Singleend']
51+
}
52+
53+
if (params.save_unaligned || params.contaminant_screening) {
54+
args += ['--outReadsUnmapped Fastx']
55+
}
10156
}
10257

10358
// For prokaryotic data, use CDS features and disable spliced alignment
@@ -111,9 +66,7 @@ process {
11166

11267
args.join(' ')
11368
}
114-
}
11569

116-
withName: '.*:ALIGN_STAR:STAR_ALIGN|.*:ALIGN_STAR:STAR_ALIGN_IGENOMES|.*:ALIGN_STAR:SENTIEON_STAR_ALIGN' {
11770
publishDir = [
11871
[
11972
path: { "${params.outdir}/${params.aligner}/log" },

subworkflows/local/align_star/tests/main.parabricks.nf.test.snap

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@
5757
"SJ.out.tab:md5,844af19ab0fc8cd9a3f75228445aca0d"
5858
]
5959
],
60-
[
61-
"versions.yml:md5,9cd9b324968896fdc5b73426d7427930",
62-
"versions.yml:md5,a52502c04d4db8ae4a0882b9fbbe30e0",
63-
"versions.yml:md5,f21f8f18b50461bcd4b56352d9d35365"
64-
]
60+
null
6561
],
6662
"meta": {
6763
"nf-test": "0.9.3",
@@ -111,7 +107,7 @@
111107
]
112108
],
113109
[
114-
110+
115111
],
116112
[
117113
[
@@ -189,11 +185,7 @@
189185
]
190186
]
191187
],
192-
[
193-
"versions.yml:md5,9cd9b324968896fdc5b73426d7427930",
194-
"versions.yml:md5,a52502c04d4db8ae4a0882b9fbbe30e0",
195-
"versions.yml:md5,f21f8f18b50461bcd4b56352d9d35365"
196-
]
188+
null
197189
],
198190
"meta": {
199191
"nf-test": "0.9.3",
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
process {
2-
withName: '.*PARABRICKS_RNA_FQ2BAM.*' {
3-
ext.args = '--low-memory --read-files-command zcat --x3'
4-
}
1+
params {
2+
extra_star_align_args = '--low-memory --read-files-command zcat --x3'
3+
}
54

5+
process {
66
// Fix issue where input and output BAMs have the same name
77
withName: '.*SAMTOOLS_SORT.*' {
88
ext.prefix = 'sorted_'
99
}
10-
1110
}

subworkflows/local/prepare_genome/nextflow.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ process {
1111
ext.args2 = '--no-same-owner'
1212
}
1313

14-
withName: 'UNTAR_.*|STAR_GENOMEGENERATE|STAR_GENOMEGENERATE_IGENOMES|HISAT2_BUILD' {
14+
withName: 'UNTAR_.*|STAR_GENOMEGENERATE|STAR_GENOMEGENERATE_IGENOMES|PARABRICKS_STARGENOMEGENERATE|HISAT2_BUILD' {
1515
publishDir = [
1616
path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir },
1717
mode: params.publish_dir_mode,
1818
saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null }
1919
]
2020
}
2121

22-
withName: 'STAR_GENOMEGENERATE|STAR_GENOMEGENERATE_IGENOMES' {
22+
withName: 'STAR_GENOMEGENERATE|STAR_GENOMEGENERATE_IGENOMES|PARABRICKS_STARGENOMEGENERATE' {
2323
ext.args = {
2424
def args = []
2525
// For prokaryotic data, use CDS features instead of exons

tests/nextflow.config

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,10 @@ process {
3030
ext.args = null
3131
}
3232

33-
// Test flags:
34-
// --memory-limit to cap memory on small test runners
35-
// --read-files-command zcat allows for compressed input files
36-
// --x3 enables verbose output
33+
// Parabricks resource overrides for test runners
3734
withName: '.*:PARABRICKS_RNA_FQ2BAM' {
3835
cpus = 4
3936
memory = 15.GB
40-
ext.args = '--memory-limit 15 --read-files-command zcat --x3'
4137
}
4238

4339
}

tests/parabricks_default.nf.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ nextflow_pipeline {
2929
// Parabricks settings
3030
use_parabricks_star = true
3131
skip_markduplicates = true
32+
extra_star_align_args = '--memory-limit 15 --read-files-command zcat --x3'
3233

3334
// Skip eukaryote-specific QC tools
3435
skip_rseqc = true
@@ -89,6 +90,7 @@ nextflow_pipeline {
8990
// Parabricks settings
9091
use_parabricks_star = true
9192
skip_markduplicates = false
93+
extra_star_align_args = '--memory-limit 15 --read-files-command zcat --x3'
9294

9395
// Skip eukaryote-specific QC tools
9496
skip_rseqc = true
@@ -151,6 +153,7 @@ nextflow_pipeline {
151153
// Parabricks settings
152154
use_parabricks_star = true
153155
skip_markduplicates = true
156+
extra_star_align_args = '--memory-limit 15 --read-files-command zcat --x3'
154157

155158
// Skip eukaryote-specific QC tools
156159
skip_rseqc = true
@@ -213,6 +216,7 @@ nextflow_pipeline {
213216
// Parabricks settings
214217
use_parabricks_star = true
215218
skip_markduplicates = false
219+
extra_star_align_args = '--memory-limit 15 --read-files-command zcat --x3'
216220

217221
// Skip eukaryote-specific QC tools
218222
skip_rseqc = true

0 commit comments

Comments
 (0)