Skip to content

Commit 04f4e35

Browse files
authored
Merge pull request #583 from nf-core/fix-publishing
Fix rrbs and skip_dedup publishing
2 parents 7f30dbf + e56eb61 commit 04f4e35

18 files changed

+586
-240
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
- 🐛 Fix error in `picard_bedtointervallist.config` [#566](https://github.com/nf-core/methylseq/pull/566)
1111
- 🐛 Fix error when using --aligner bwameth with samtools sort, the output bams will be labeled with prefix "${meta.id}.deduplicated.sorted" and published in the deduplication folder [#580](https://github.com/nf-core/methylseq/pull/581)
12+
- 🐛 Fix publishing of bam files in the alignments folder when using --skip_deduplication or --rrbs [#579](https://github.com/nf-core/methylseq/pull/583)
1213
- 🔧 Update Bismark to v0.25.1 [#569](https://github.com/nf-core/methylseq/pull/569)
1314
- 🔧 Update MultiQC module
1415

conf/modules/bwa_index.config

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
process {
2+
withName: BWA_INDEX {
3+
publishDir = [
4+
[
5+
path: { "${params.outdir}/${params.aligner}/reference_genome" },
6+
mode: params.publish_dir_mode,
7+
pattern: "*",
8+
enabled: params.save_reference
9+
]
10+
]
11+
}
12+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
process {
22
withName: PICARD_ADDORREPLACEREADGROUPS {
33
ext.args = "--RGID 1 --RGLB lib1 --RGPL illumina --RGPU unit1 --RGSM sample1"
4+
// Don't publish intermediate BAMs - these are only used as input to PICARD_MARKDUPLICATES
5+
publishDir = [
6+
enabled: false
7+
]
48
}
59
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
process {
2+
withName: SAMTOOLS_IDXSTATS {
3+
publishDir = [
4+
[
5+
path: { "${params.outdir}/${params.aligner}/alignments/samtools_stats/" },
6+
mode: params.publish_dir_mode,
7+
pattern: "*.idxstats"
8+
]
9+
]
10+
}
11+
}

conf/modules/samtools_index.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ process {
66
path: { "${params.outdir}/${params.aligner}/deduplicated/" },
77
mode: params.publish_dir_mode,
88
pattern: "*.bai",
9-
enabled: !params.skip_deduplication
9+
enabled: !(params.skip_deduplication || params.rrbs)
1010
],
1111
[
1212
path: { "${params.outdir}/${params.aligner}/alignments/" },
1313
mode: params.publish_dir_mode,
1414
pattern: "*.bai",
15-
enabled: params.skip_deduplication
15+
enabled: params.skip_deduplication || params.rrbs
1616
]
1717
]
1818
}

conf/modules/samtools_sort.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ process {
66
path: { "${params.outdir}/${params.aligner}/alignments/" },
77
mode: params.publish_dir_mode,
88
pattern: "*.sorted.bam",
9-
enabled: params.skip_deduplication || params.save_align_intermeds
9+
enabled: params.skip_deduplication || params.rrbs || params.save_align_intermeds
1010
]
1111
]
1212
}

conf/subworkflows/fasta_index_methylseq.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ includeConfig "../modules/gunzip.config"
22
includeConfig "../modules/bismark_genomepreparation.config"
33
includeConfig "../modules/samtools_faidx.config"
44
includeConfig "../modules/bwameth_index.config"
5+
includeConfig "../modules/bwa_index.config"

conf/subworkflows/fastq_align_dedup_bismark.config

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,22 @@ includeConfig "../modules/bismark_summary.config"
1010
// Override SAMTOOLS_SORT for bismark workflow
1111
// In bismark, deduplication (BISMARK_DEDUPLICATE) happens BEFORE sorting,
1212
// so the BAM input to SAMTOOLS_SORT is already deduplicated when skip_deduplication is false
13+
// Note: RRBS also skips deduplication, so we check for both params.skip_deduplication and params.rrbs
1314
process {
14-
withName: SAMTOOLS_SORT {
15-
ext.prefix = params.skip_deduplication ? { "${meta.id}.sorted" } : { "${meta.id}.deduplicated.sorted" }
15+
withName: 'NFCORE_METHYLSEQ:METHYLSEQ:FASTQ_ALIGN_DEDUP_BISMARK:SAMTOOLS_SORT' {
16+
ext.prefix = { (params.skip_deduplication || params.rrbs) ? "${meta.id}.sorted" : "${meta.id}.deduplicated.sorted" }
1617
publishDir = [
1718
[
1819
path: { "${params.outdir}/${params.aligner}/deduplicated/" },
1920
mode: params.publish_dir_mode,
20-
pattern: "*.deduplicated.sorted.bam"
21+
pattern: "*.deduplicated.sorted.bam",
22+
enabled: !(params.skip_deduplication || params.rrbs)
2123
],
2224
[
2325
path: { "${params.outdir}/${params.aligner}/alignments/" },
2426
mode: params.publish_dir_mode,
2527
pattern: "*.sorted.bam",
26-
enabled: params.skip_deduplication
28+
enabled: params.skip_deduplication || params.rrbs
2729
]
2830
]
2931
}
Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,50 @@
11
includeConfig "../modules/bwamem_align.config"
22
includeConfig "../modules/picard_addorreplacereadgroups.config"
33
includeConfig "../modules/picard_markduplicates.config"
4-
includeConfig "../modules/samtools_index.config"
4+
includeConfig "../modules/samtools_stats.config"
5+
includeConfig "../modules/samtools_flagstat.config"
6+
includeConfig "../modules/samtools_idxstats.config"
7+
8+
// Note: SAMTOOLS_INDEX is called twice in this workflow with different requirements:
9+
// 1. BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_INDEX - indexes alignment BAMs (before dedup)
10+
// 2. FASTQ_ALIGN_DEDUP_BWAMEM:SAMTOOLS_INDEX - indexes deduplicated BAMs (after markdup)
11+
// We need full process paths to distinguish them.
12+
13+
process {
14+
// SAMTOOLS_SORT in BAM_SORT_STATS_SAMTOOLS - publish to alignments when skip_deduplication
15+
withName: 'NFCORE_METHYLSEQ:METHYLSEQ:FASTQ_ALIGN_DEDUP_BWAMEM:FASTQ_ALIGN_BWA:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_SORT' {
16+
ext.prefix = { "${meta.id}.sorted" }
17+
publishDir = [
18+
[
19+
path: { "${params.outdir}/${params.aligner}/alignments/" },
20+
mode: params.publish_dir_mode,
21+
pattern: "*.sorted.bam",
22+
enabled: params.skip_deduplication
23+
]
24+
]
25+
}
26+
27+
// SAMTOOLS_INDEX in BAM_SORT_STATS_SAMTOOLS - only publish when skip_deduplication
28+
withName: 'NFCORE_METHYLSEQ:METHYLSEQ:FASTQ_ALIGN_DEDUP_BWAMEM:FASTQ_ALIGN_BWA:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_INDEX' {
29+
publishDir = [
30+
[
31+
path: { "${params.outdir}/${params.aligner}/alignments/" },
32+
mode: params.publish_dir_mode,
33+
pattern: "*.bai",
34+
enabled: params.skip_deduplication
35+
]
36+
]
37+
}
38+
39+
// SAMTOOLS_INDEX after PICARD_MARKDUPLICATES - publish to deduplicated when deduplication runs
40+
withName: 'NFCORE_METHYLSEQ:METHYLSEQ:FASTQ_ALIGN_DEDUP_BWAMEM:SAMTOOLS_INDEX' {
41+
publishDir = [
42+
[
43+
path: { "${params.outdir}/${params.aligner}/deduplicated/" },
44+
mode: params.publish_dir_mode,
45+
pattern: "*.bai",
46+
enabled: !params.skip_deduplication
47+
]
48+
]
49+
}
50+
}

conf/subworkflows/fastq_align_dedup_bwameth.config

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ process {
1515
path: { "${params.outdir}/${params.aligner}/alignments/" },
1616
mode: params.publish_dir_mode,
1717
pattern: "*.bam.bai",
18-
enabled: params.save_align_intermeds
18+
enabled: params.save_align_intermeds || params.skip_deduplication || params.rrbs
1919
]
2020
]
2121
}
@@ -26,7 +26,8 @@ process {
2626
[
2727
path: { "${params.outdir}/${params.aligner}/deduplicated/" },
2828
mode: params.publish_dir_mode,
29-
pattern: "*.bam.bai"
29+
pattern: "*.bam.bai",
30+
enabled: !(params.skip_deduplication || params.rrbs)
3031
]
3132
]
3233
}

0 commit comments

Comments
 (0)