|
1 | 1 | includeConfig "../modules/bwamem_align.config" |
2 | 2 | includeConfig "../modules/picard_addorreplacereadgroups.config" |
3 | 3 | 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 | +} |
0 commit comments