Skip to content

Commit c833999

Browse files
committed
Use mapad module instead of subwf fastq_align_mapad
1 parent 1019885 commit c833999

14 files changed

Lines changed: 32 additions & 560 deletions

File tree

‎conf/modules.config‎

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -490,39 +490,23 @@ process {
490490
}
491491

492492
withName: MAPAD_MAP {
493-
tag = { "${meta.id_index}|${meta.sample_id}_${meta.library_id}_L${meta.lane}" }
493+
tag = { "${meta.reference}|${meta.sample_id}_${meta.library_id}_L${meta.lane}" }
494494
ext.args = { "-x ${params.mapping_mapad_x}" }
495-
ext.prefix = { "${meta.sample_id}_${meta.library_id}_L${meta.lane}_${meta.reference}" }
496-
publishDir = [
497-
enabled: false
498-
]
499-
}
500-
501-
withName: ".*FASTQ_ALIGN_MAPAD:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_SORT" {
502-
tag = { "${meta.reference}|${meta.sample_id}_${meta.library_id}" }
503-
ext.prefix = { "${meta.sample_id}_${meta.library_id}_L${meta.lane}_${meta.reference}_mapad_sorted" }
495+
ext.prefix = { "${meta.sample_id}_${meta.library_id}_L${meta.lane}_${meta.reference}_unsorted" }
504496
publishDir = [
505497
enabled: false
506498
]
507499
}
508500

509-
withName: ".*FASTQ_ALIGN_MAPAD:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_INDEX" {
510-
tag = { "${meta.reference}|${meta.sample_id}_${meta.library_id}" }
511-
ext.prefix = { "${meta.sample_id}_${meta.library_id}_L${meta.lane}_${meta.reference}_mapad_idx" }
512-
publishDir = [
513-
enabled: false
514-
]
515-
}
516-
517-
withName: ".*FASTQ_ALIGN_MAPAD:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_STATS" {
518-
tag = { "${meta.reference}|${meta.sample_id}_${meta.library_id}" }
519-
ext.prefix = { "${meta.sample_id}_${meta.library_id}_L${meta.lane}_${meta.reference}_mapad_stats" }
501+
withName: "SAMTOOLS_SORT_MAPAD" {
502+
tag = { "${meta.reference}|${meta.sample_id}_${meta.library_id}_L${meta.lane}" }
503+
ext.prefix = { "${meta.sample_id}_${meta.library_id}_L${meta.lane}_${meta.reference}" }
520504
publishDir = [
521505
enabled: false
522506
]
523507
}
524508

525-
withName: 'SAMTOOLS_INDEX_MEM|SAMTOOLS_INDEX_BT2' {
509+
withName: 'SAMTOOLS_INDEX_MEM|SAMTOOLS_INDEX_BT2|SAMTOOLS_INDEX_MAPAD' {
526510
tag = { "${meta.reference}|${meta.sample_id}_${meta.library_id}_L${meta.lane}" }
527511
ext.args = { params.fasta_largeref ? "-c" : "" }
528512
ext.prefix = { "${meta.sample_id}_${meta.library_id}_L${meta.lane}_${meta.reference}" }

‎modules.json‎

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
"mapad/map": {
169169
"branch": "master",
170170
"git_sha": "1eddaed79279c37b0eb34953b4098c258b033f96",
171-
"installed_by": ["fastq_align_mapad", "modules"]
171+
"installed_by": ["modules"]
172172
},
173173
"mapdamage2": {
174174
"branch": "master",
@@ -243,17 +243,17 @@
243243
"samtools/flagstat": {
244244
"branch": "master",
245245
"git_sha": "8d8f0ae52d6c9342bd41c33dda0b74b07e32153d",
246-
"installed_by": ["bam_stats_samtools"]
246+
"installed_by": ["modules"]
247247
},
248248
"samtools/idxstats": {
249249
"branch": "master",
250250
"git_sha": "8d8f0ae52d6c9342bd41c33dda0b74b07e32153d",
251-
"installed_by": ["bam_stats_samtools", "modules"]
251+
"installed_by": ["modules"]
252252
},
253253
"samtools/index": {
254254
"branch": "master",
255255
"git_sha": "8d8f0ae52d6c9342bd41c33dda0b74b07e32153d",
256-
"installed_by": ["bam_sort_stats_samtools", "bam_split_by_region", "fastq_align_bwaaln"]
256+
"installed_by": ["bam_split_by_region", "fastq_align_bwaaln"]
257257
},
258258
"samtools/merge": {
259259
"branch": "master",
@@ -268,12 +268,7 @@
268268
"samtools/sort": {
269269
"branch": "master",
270270
"git_sha": "8d8f0ae52d6c9342bd41c33dda0b74b07e32153d",
271-
"installed_by": ["bam_sort_stats_samtools", "modules"]
272-
},
273-
"samtools/stats": {
274-
"branch": "master",
275-
"git_sha": "f4596fe0bdc096cf53ec4497e83defdb3a94ff62",
276-
"installed_by": ["bam_stats_samtools"]
271+
"installed_by": ["modules"]
277272
},
278273
"samtools/view": {
279274
"branch": "master",
@@ -304,31 +299,16 @@
304299
"git_sha": "cfd937a668919d948f6fcbf4218e79de50c2f36f",
305300
"installed_by": ["subworkflows"]
306301
},
307-
"bam_sort_stats_samtools": {
308-
"branch": "master",
309-
"git_sha": "f4596fe0bdc096cf53ec4497e83defdb3a94ff62",
310-
"installed_by": ["fastq_align_mapad"]
311-
},
312302
"bam_split_by_region": {
313303
"branch": "master",
314304
"git_sha": "cfd937a668919d948f6fcbf4218e79de50c2f36f",
315305
"installed_by": ["subworkflows"]
316306
},
317-
"bam_stats_samtools": {
318-
"branch": "master",
319-
"git_sha": "f4596fe0bdc096cf53ec4497e83defdb3a94ff62",
320-
"installed_by": ["bam_sort_stats_samtools"]
321-
},
322307
"fastq_align_bwaaln": {
323308
"branch": "master",
324309
"git_sha": "cfd937a668919d948f6fcbf4218e79de50c2f36f",
325310
"installed_by": ["subworkflows"]
326311
},
327-
"fastq_align_mapad": {
328-
"branch": "master",
329-
"git_sha": "1eddaed79279c37b0eb34953b4098c258b033f96",
330-
"installed_by": ["subworkflows"]
331-
},
332312
"utils_nextflow_pipeline": {
333313
"branch": "master",
334314
"git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa",

‎modules/nf-core/samtools/stats/environment.yml‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎modules/nf-core/samtools/stats/main.nf‎

Lines changed: 0 additions & 49 deletions
This file was deleted.

‎modules/nf-core/samtools/stats/meta.yml‎

Lines changed: 0 additions & 63 deletions
This file was deleted.

‎subworkflows/local/map.nf‎

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44

55
include { SEQKIT_SPLIT2 } from '../../modules/nf-core/seqkit/split2/main'
66
include { FASTQ_ALIGN_BWAALN } from '../../subworkflows/nf-core/fastq_align_bwaaln/main'
7-
include { FASTQ_ALIGN_MAPAD } from '../../subworkflows/nf-core/fastq_align_mapad/main'
7+
include { MAPAD_MAP } from '../../modules/nf-core/mapad/map/main'
88
include { BWA_MEM } from '../../modules/nf-core/bwa/mem/main'
99
include { BOWTIE2_ALIGN } from '../../modules/nf-core/bowtie2/align/main'
1010
include { SAMTOOLS_MERGE as SAMTOOLS_MERGE_LANES } from '../../modules/nf-core/samtools/merge/main'
1111
include { SAMTOOLS_SORT as SAMTOOLS_SORT_MERGED_LANES } from '../../modules/nf-core/samtools/sort/main'
12+
include { SAMTOOLS_SORT as SAMTOOLS_SORT_MAPAD } from '../../modules/nf-core/samtools/sort/main'
1213
include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_MEM } from '../../modules/nf-core/samtools/index/main'
1314
include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_BT2 } from '../../modules/nf-core/samtools/index/main'
15+
include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_MAPAD } from '../../modules/nf-core/samtools/index/main'
1416
include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_MERGED_LANES } from '../../modules/nf-core/samtools/index/main'
1517
include { SAMTOOLS_FLAGSTAT as SAMTOOLS_FLAGSTAT_MAPPED } from '../../modules/nf-core/samtools/flagstat/main'
1618

1719
workflow MAP {
1820
take:
1921
reads // [ [meta], [read1, reads2] ] or [ [meta], [read1] ]
20-
index // [ [meta], [ index ], [ fasta ] ]
22+
index // [ [meta], [ index ] ]
2123

2224
main:
2325
ch_versions = Channel.empty()
@@ -41,7 +43,7 @@ workflow MAP {
4143
.groupTuple()
4244

4345
ch_input_for_mapping = sharded_reads
44-
.combine(index.map{ meta, index, fasta -> [ meta, index ] })
46+
.combine(index)
4547
.multiMap {
4648
meta, reads, meta2, index ->
4749
new_meta = meta.clone()
@@ -52,7 +54,7 @@ workflow MAP {
5254

5355
} else {
5456
ch_input_for_mapping = reads
55-
.combine(index.map{ meta, index, fasta -> [ meta, index ] })
57+
.combine(index)
5658
.multiMap {
5759
meta, reads, meta2, index ->
5860
new_meta = meta.clone()
@@ -63,7 +65,7 @@ workflow MAP {
6365
}
6466

6567
if ( params.mapping_tool == 'bwaaln' ) {
66-
ch_index_for_mapping = index.map{ meta, index, fasta -> [ meta, index ] }
68+
ch_index_for_mapping = index
6769
ch_reads_for_mapping = reads
6870

6971
FASTQ_ALIGN_BWAALN ( ch_reads_for_mapping, ch_index_for_mapping )
@@ -80,7 +82,7 @@ workflow MAP {
8082

8183
} else if ( params.mapping_tool == 'bwamem' ) {
8284
ch_input_for_mapping = reads
83-
.combine( index.map{ meta, index, fasta -> [ meta, index ] } )
85+
.combine( index )
8486
.multiMap {
8587
meta, reads, meta2, index ->
8688
new_meta = meta + [ reference: meta2.id ]
@@ -98,7 +100,7 @@ workflow MAP {
98100

99101
} else if ( params.mapping_tool == 'bowtie2' ) {
100102
ch_input_for_mapping = reads
101-
.combine( index.map{ meta, index, fasta -> [ meta, index ] } )
103+
.combine( index )
102104
.multiMap {
103105
meta, reads, meta2, index ->
104106
new_meta = meta + [ reference: meta2.id ]
@@ -118,18 +120,16 @@ workflow MAP {
118120
ch_input_for_mapping = reads
119121
.combine( index )
120122
.multiMap {
121-
meta, reads, meta2, index, fasta ->
123+
meta, reads, meta2, index ->
122124
new_meta = meta + [ reference: meta2.id ]
123125
reads: [ new_meta, reads ]
124126
index: [ meta2, index ]
125-
fasta: [ meta2, fasta ]
126127
strandedness: meta.strandedness=="double"
127128
}
128129

129-
FASTQ_ALIGN_MAPAD (
130+
MAPAD_MAP (
130131
ch_input_for_mapping.reads,
131132
ch_input_for_mapping.index,
132-
ch_input_for_mapping.fasta,
133133
params.mapping_mapad_p,
134134
ch_input_for_mapping.strandedness,
135135
params.mapping_mapad_f,
@@ -138,16 +138,15 @@ workflow MAP {
138138
params.mapping_mapad_s,
139139
params.mapping_mapad_i
140140
)
141-
ch_versions = ch_versions.mix ( FASTQ_ALIGN_MAPAD.out.versions.first() )
142-
ch_mapped_lane_bam = FASTQ_ALIGN_MAPAD.out.bam
143-
.map{
144-
// create meta consistent with rest of workflow
145-
meta, bam ->
146-
new_meta = meta + [ reference: meta.id_index ]
147-
[ new_meta, bam ]
148-
}
141+
ch_versions = ch_versions.mix ( MAPAD_MAP.out.versions.first() )
142+
143+
SAMTOOLS_SORT_MAPAD ( MAPAD_MAP.out.bam )
144+
ch_mapped_lane_bam = SAMTOOLS_SORT_MAPAD.out.bam
145+
ch_versions = ch_versions.mix( SAMTOOLS_SORT_MAPAD.out.versions.first() )
149146

150-
ch_mapped_lane_bai = params.fasta_largeref ? FASTQ_ALIGN_MAPAD.out.csi : FASTQ_ALIGN_MAPAD.out.bai
147+
SAMTOOLS_INDEX_MAPAD ( ch_mapped_lane_bam )
148+
ch_versions = ch_versions.mix( SAMTOOLS_INDEX_MAPAD.out.versions.first() )
149+
ch_mapped_lane_bai = params.fasta_largeref ? SAMTOOLS_INDEX_MAPAD.out.csi : SAMTOOLS_INDEX_MAPAD.out.bai
151150
}
152151

153152
// Only run merge lanes if we have more than one BAM to merge!

‎subworkflows/local/reference_indexing_multi.nf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
include { GUNZIP as GUNZIP_FASTA } from '../../modules/nf-core/gunzip/main'
66
include { BWA_INDEX } from '../../modules/nf-core/bwa/index/main'
77
include { BOWTIE2_BUILD } from '../../modules/nf-core/bowtie2/build/main'
8+
include { MAPAD_INDEX } from '../../modules/nf-core/mapad/index/main'
89
include { SAMTOOLS_FAIDX } from '../../modules/nf-core/samtools/faidx/main'
910
include { PICARD_CREATESEQUENCEDICTIONARY } from '../../modules/nf-core/picard/createsequencedictionary/main'
10-
include { MAPAD_INDEX } from '../../modules/nf-core/mapad/index/main'
1111
// TODO missing: circulargeneraotr?
1212

1313
workflow REFERENCE_INDEXING_MULTI {

0 commit comments

Comments
 (0)