Skip to content

Commit 8d4c903

Browse files
committed
fix channels' meta for preprocessing
1 parent b717523 commit 8d4c903

File tree

10 files changed

+25
-28
lines changed

10 files changed

+25
-28
lines changed

subworkflows/local/bam_applybqsr/main.nf

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ workflow BAM_APPLYBQSR {
2424
.map{ meta, cram, crai, recal, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, recal, intervals ] }
2525

2626
// RUN APPLYBQSR
27-
GATK4_APPLYBQSR(cram_intervals, fasta, fasta_fai, dict.map{ meta, it -> [ it ] })
27+
GATK4_APPLYBQSR(cram_intervals, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] }, dict.map{ meta, it -> [ it ] })
2828

2929
// Gather the recalibrated cram files
3030
cram_to_merge = GATK4_APPLYBQSR.out.cram.map{ meta, cram -> [ groupKey(meta, meta.num_intervals), cram ] }.groupTuple()
3131

3232
// Merge and index the recalibrated cram files
33-
CRAM_MERGE_INDEX_SAMTOOLS(cram_to_merge, fasta, fasta_fai)
33+
CRAM_MERGE_INDEX_SAMTOOLS(cram_to_merge, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] })
3434

3535
cram_recal = CRAM_MERGE_INDEX_SAMTOOLS.out.cram_crai
3636
// Remove no longer necessary field: num_intervals

subworkflows/local/bam_applybqsr_spark/main.nf

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ workflow BAM_APPLYBQSR_SPARK {
2424
.map{ meta, cram, crai, recal, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, recal, intervals ] }
2525

2626
// RUN APPLYBQSR SPARK
27-
GATK4SPARK_APPLYBQSR(cram_intervals, fasta, fasta_fai, dict.map{ meta, it -> [ it ] })
27+
GATK4SPARK_APPLYBQSR(cram_intervals, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] }, dict.map{ meta, it -> [ it ] })
2828

2929
// Gather the recalibrated cram files
3030
cram_to_merge = GATK4SPARK_APPLYBQSR.out.cram.map{ meta, cram -> [ groupKey(meta, meta.num_intervals), cram ] }.groupTuple()
3131

3232
// Merge and index the recalibrated cram files
33-
CRAM_MERGE_INDEX_SAMTOOLS(cram_to_merge, fasta, fasta_fai)
33+
CRAM_MERGE_INDEX_SAMTOOLS(cram_to_merge, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] })
3434

3535
cram_recal = CRAM_MERGE_INDEX_SAMTOOLS.out.cram_crai
3636
// Remove no longer necessary field: num_intervals

subworkflows/local/bam_baserecalibrator/main.nf

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ workflow BAM_BASERECALIBRATOR {
2626
.map{ meta, cram, crai, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, intervals ] }
2727

2828
// RUN BASERECALIBRATOR
29-
GATK4_BASERECALIBRATOR(cram_intervals, fasta, fasta_fai, dict.map{ meta, it -> [ it ] }, known_sites, known_sites_tbi)
29+
GATK4_BASERECALIBRATOR(cram_intervals, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] }, dict.map{ meta, it -> [ it ] }, known_sites, known_sites_tbi)
3030

3131
// Figuring out if there is one or more table(s) from the same sample
3232
table_to_merge = GATK4_BASERECALIBRATOR.out.table.map{ meta, table -> [ groupKey(meta, meta.num_intervals), table ] }.groupTuple().branch{

subworkflows/local/bam_baserecalibrator_spark/main.nf

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ workflow BAM_BASERECALIBRATOR_SPARK {
2626
.map{ meta, cram, crai, intervals, num_intervals -> [ meta + [ num_intervals:num_intervals ], cram, crai, intervals ] }
2727

2828
// RUN BASERECALIBRATOR SPARK
29-
GATK4SPARK_BASERECALIBRATOR(cram_intervals, fasta, fasta_fai, dict.map{ meta, it -> [ it ] }, known_sites, known_sites_tbi)
29+
GATK4SPARK_BASERECALIBRATOR(cram_intervals, fasta.map{ meta, it -> [ it ] }, fasta_fai.map{ meta, it -> [ it ] }, dict.map{ meta, it -> [ it ] }, known_sites, known_sites_tbi)
3030

3131
// Figuring out if there is one or more table(s) from the same sample
3232
table_to_merge = GATK4SPARK_BASERECALIBRATOR.out.table.map{ meta, table -> [ groupKey(meta, meta.num_intervals), table ] }.groupTuple().branch{

subworkflows/local/bam_markduplicates/main.nf

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ workflow BAM_MARKDUPLICATES {
1919
reports = Channel.empty()
2020

2121
// RUN MARKUPDUPLICATES
22-
GATK4_MARKDUPLICATES(bam, fasta, fasta_fai)
22+
GATK4_MARKDUPLICATES(bam, fasta.map{ meta, fasta -> [ fasta ] }, fasta_fai.map{ meta, fasta_fai -> [ fasta_fai ] })
2323

2424
// Join with the crai file
2525
cram = GATK4_MARKDUPLICATES.out.cram.join(GATK4_MARKDUPLICATES.out.crai, failOnDuplicate: true, failOnMismatch: true)

subworkflows/local/bam_markduplicates_spark/main.nf

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ workflow BAM_MARKDUPLICATES_SPARK {
2222
reports = Channel.empty()
2323

2424
// RUN MARKUPDUPLICATES SPARK
25-
GATK4SPARK_MARKDUPLICATES(bam, fasta, fasta_fai, dict)
25+
GATK4SPARK_MARKDUPLICATES(bam, fasta.map{ meta, fasta -> [ fasta ] }, fasta_fai.map{ meta, fasta_fai -> [ fasta_fai ] }, dict.map{ meta, dict -> [ dict ] })
2626

2727
// Index cram
2828
INDEX_MARKDUPLICATES(GATK4SPARK_MARKDUPLICATES.out.output)

subworkflows/local/cram_qc_mosdepth_samtools/main.nf

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ workflow CRAM_QC_MOSDEPTH_SAMTOOLS {
1818
reports = Channel.empty()
1919

2020
// Reports run on cram
21-
SAMTOOLS_STATS(cram, fasta.map{ it -> [ [ id:'fasta' ], it ] })
21+
SAMTOOLS_STATS(cram, fasta)
2222

23-
MOSDEPTH(cram.combine(intervals.map{ meta, bed -> [ bed?:[] ] }), fasta.map{ it -> [ [ id:'fasta' ], it ] })
23+
MOSDEPTH(cram.combine(intervals.map{ meta, bed -> [ bed?:[] ] }), fasta)
2424

2525
// Gather all reports generated
2626
reports = reports.mix(SAMTOOLS_STATS.out.stats)
+10-13
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
11
include { BAM_NGSCHECKMATE } from '../../../subworkflows/nf-core/bam_ngscheckmate/main'
22
include { CRAM_QC_MOSDEPTH_SAMTOOLS as CRAM_QC_RECAL } from '../../../subworkflows/local/cram_qc_mosdepth_samtools/main'
3+
34
workflow CRAM_SAMPLEQC {
45

56
take:
6-
ch_cram // channel: [ val(meta), cram, crai ]
7+
cram // channel: [ val(meta), cram, crai ]
78
ngscheckmate_bed // channel: [ ngscheckmate_bed ]
89
fasta // channel: [ fasta ]
910
skip_baserecalibration // boolean:
1011
intervals_for_preprocessing // channel:
1112

1213
main:
1314

14-
ch_versions = Channel.empty()
15-
reports = Channel.empty()
15+
versions = Channel.empty()
16+
reports = Channel.empty()
1617

17-
if(!skip_baserecalibration){
18+
if (!skip_baserecalibration) {
1819

1920
CRAM_QC_RECAL(
20-
ch_cram,
21+
cram,
2122
fasta,
2223
intervals_for_preprocessing)
2324

2425
// Gather QC reports
2526
reports = CRAM_QC_RECAL.out.reports.collect{ meta, report -> report }
2627

2728
// Gather used softwares versions
28-
ch_versions = ch_versions.mix(CRAM_QC_RECAL.out.versions)
29+
versions = versions.mix(CRAM_QC_RECAL.out.versions)
2930
}
3031

31-
ch_ngscheckmate_bed = ngscheckmate_bed.map{bed -> [[id: "ngscheckmate"], bed]}
32-
33-
ch_fasta = fasta.map{fasta -> [[id: "genome"], fasta]}
34-
35-
BAM_NGSCHECKMATE ( ch_cram.map{meta, cram, crai -> [meta, cram]}, ch_ngscheckmate_bed, ch_fasta)
36-
ch_versions = ch_versions.mix(BAM_NGSCHECKMATE.out.versions.first())
32+
BAM_NGSCHECKMATE(cram.map{meta, cram, crai -> [meta, cram]}, ngscheckmate_bed.map{bed -> [[id: "ngscheckmate"], bed]}, fasta)
33+
versions = versions.mix(BAM_NGSCHECKMATE.out.versions.first())
3734

3835
emit:
3936
corr_matrix = BAM_NGSCHECKMATE.out.corr_matrix // channel: [ meta, corr_matrix ]
@@ -43,6 +40,6 @@ workflow CRAM_SAMPLEQC {
4340
pdf = BAM_NGSCHECKMATE.out.pdf // channel: [ meta, pdf ]
4441
reports
4542

46-
versions = ch_versions // channel: [ versions.yml ]
43+
versions // channel: [ versions.yml ]
4744
}
4845

subworkflows/local/fastq_align_bwamem_mem2_dragmap_sentieon/main.nf

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ workflow FASTQ_ALIGN_BWAMEM_MEM2_DRAGMAP_SENTIEON {
2323
reports = Channel.empty()
2424

2525
// Only one of the following should be run
26-
BWAMEM1_MEM(reads, index.map{ it -> [ [ id:'index' ], it ] }, [[id:'no_fasta'], []], sort) // If aligner is bwa-mem
27-
BWAMEM2_MEM(reads, index.map{ it -> [ [ id:'index' ], it ] }, [[id:'no_fasta'], []], sort) // If aligner is bwa-mem2
28-
DRAGMAP_ALIGN(reads, index.map{ it -> [ [ id:'index' ], it ] }, [[id:'no_fasta'], []], sort) // If aligner is dragmap
26+
BWAMEM1_MEM(reads, index, [[id:'no_fasta'], []], sort) // If aligner is bwa-mem
27+
BWAMEM2_MEM(reads, index, [[id:'no_fasta'], []], sort) // If aligner is bwa-mem2
28+
DRAGMAP_ALIGN(reads, index, [[id:'no_fasta'], []], sort) // If aligner is dragmap
2929
// The sentieon-bwamem-module does sorting as part of the conversion from sam to bam.
30-
SENTIEON_BWAMEM(reads, index.map{ it -> [ [ id:'index' ], it ] }, fasta.map{fa -> [[:], fa]}, fasta_fai.map{fai -> [[:], fai]}) // If aligner is sentieon-bwamem
30+
SENTIEON_BWAMEM(reads, index, fasta, fasta_fai) // If aligner is sentieon-bwamem
3131

3232
// Get the bam files from the aligner
3333
// Only one aligner is run

workflows/sarek/main.nf

+1-1
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ workflow SAREK {
637637
// RUN CRAM QC on the recalibrated CRAM files or when starting from step variant calling. NGSCheckmate should be run also on non-recalibrated CRAM files
638638
CRAM_SAMPLEQC(cram_variant_calling,
639639
ngscheckmate_bed,
640-
fasta.map{ meta, fasta -> [ fasta ] },
640+
fasta,
641641
params.skip_tools && params.skip_tools.split(',').contains('baserecalibrator'),
642642
intervals_for_preprocessing)
643643

0 commit comments

Comments
 (0)