diff --git a/sub_workflows/BASECALLING.nf b/sub_workflows/BASECALLING.nf index cc07e68e13e26a8707b67716a609de5bda7c7c41..1e0a62fb33dd1c0474f5d3c909eeabc1e86790c5 100755 --- a/sub_workflows/BASECALLING.nf +++ b/sub_workflows/BASECALLING.nf @@ -2,42 +2,42 @@ include { FAST5_to_POD5 ; BASECALL_CPU ; BASECALL_CPU_DEMUX ; BASECALL_GPU ; BAS workflow BASECALLING { take: - pod5_path - fast5_path - speed - modifications - config - trim - quality_score - trim_barcode - devices - ref + pod5_path + fast5_path + speed + modifications + config + trim + quality_score + trim_barcode + devices + ref + main: - - FAST5_to_POD5(fast5_path) - pod5_path = FAST5_to_POD5.out.mix(pod5_path) - if (params.basecall_compute?.equalsIgnoreCase("cpu")) { - if (params.basecall_demux == true) { - BASECALL_CPU_DEMUX(pod5_path, speed, modifications, config, trim, quality_score, trim_barcode, devices, ref) - bams = BASECALL_CPU_DEMUX.out.bam.toSortedList { a, b -> a[0] <=> b[0] }.flatten().buffer(size: 2) - txts = BASECALL_CPU_DEMUX.out.txt.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten() - } - else { - BASECALL_CPU(pod5_path, speed, modifications, config, trim, quality_score, devices, ref) - bams = BASECALL_CPU.out.bam.toSortedList { a, b -> a[0] <=> b[0] }.flatten().buffer(size: 2) - txts = BASECALL_CPU.out.txt.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten() - } - } - else if (params.basecall_compute?.equalsIgnoreCase("gpu")) { - if (params.basecall_demux == true) { - BASECALL_GPU_DEMUX(pod5_path, speed, modifications, config, trim, quality_score, trim_barcode, devices, ref) - bams = BASECALL_GPU_DEMUX.out.bam.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten() - txts = BASECALL_GPU_DEMUX.out.txt.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten() + FAST5_to_POD5(fast5_path) + pod5_path = FAST5_to_POD5.out.mix(pod5_path) + if (params.basecall_compute?.equalsIgnoreCase("cpu")) { + if (params.basecall_demux == true) { + BASECALL_CPU_DEMUX(pod5_path, speed, modifications, config, trim, quality_score, trim_barcode, devices, ref) + bams = BASECALL_CPU_DEMUX.out.bam.toSortedList { a, b -> a[0] <=> b[0] }.flatten().buffer(size: 2) + txts = BASECALL_CPU_DEMUX.out.txt.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten() + } + else { + BASECALL_CPU(pod5_path, speed, modifications, config, trim, quality_score, devices, ref) + bams = BASECALL_CPU.out.bam.toSortedList { a, b -> a[0] <=> b[0] }.flatten().buffer(size: 2) + txts = BASECALL_CPU.out.txt.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten() + } } - else { - BASECALL_GPU(pod5_path, speed, modifications, config, trim, quality_score, devices, ref) - bams = BASECALL_GPU.out.bam.toSortedList { a, b -> a[0] <=> b[0] }.flatten().buffer(size: 2) - txts = BASECALL_GPU.out.txt.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten() + else if (params.basecall_compute?.equalsIgnoreCase("gpu")) { + if (params.basecall_demux == true) { + BASECALL_GPU_DEMUX(pod5_path, speed, modifications, config, trim, quality_score, trim_barcode, devices, ref) + bams = BASECALL_GPU_DEMUX.out.bam.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten() + txts = BASECALL_GPU_DEMUX.out.txt.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten() + } + else { + BASECALL_GPU(pod5_path, speed, modifications, config, trim, quality_score, devices, ref) + bams = BASECALL_GPU.out.bam.toSortedList { a, b -> a[0] <=> b[0] }.flatten().buffer(size: 2) + txts = BASECALL_GPU.out.txt.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten() + } } - } } diff --git a/sub_workflows/FILTERING_AND_QC_FROM_MINKNOW.nf b/sub_workflows/FILTERING_AND_QC_FROM_MINKNOW.nf index 2a007cc8f20cc69823153ffd84761e4e08f12f8e..90dc60c6d9260db7d5b5d7666177d211a0067493 100755 --- a/sub_workflows/FILTERING_AND_QC_FROM_MINKNOW.nf +++ b/sub_workflows/FILTERING_AND_QC_FROM_MINKNOW.nf @@ -6,51 +6,51 @@ include { CONVERT_INPUT_FROM_MINKNOW_BARCODED ; CONVERT_INPUT_FROM_MINKNOW_NOT_B workflow FILTERING_AND_QC_FROM_MINKNOW { take: - input - mapq - quality_score + input + mapq + quality_score + main: - if (params.is_barcoded == true) { - CONVERT_INPUT_FROM_MINKNOW_BARCODED(input) - converted_input = CONVERT_INPUT_FROM_MINKNOW_BARCODED.out - } - else if (params.is_barcoded == false) { - CONVERT_INPUT_FROM_MINKNOW_NOT_BARCODED(input) - converted_input = CONVERT_INPUT_FROM_MINKNOW_NOT_BARCODED.out - } - FILTER_BAM( - converted_input.bam.flatten().map { file -> tuple(file.baseName, file) }.toSortedList { a, b -> a[0] <=> b[0] }.flatten().buffer(size: 2), - converted_input.txt.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten(), - mapq, - ) - PYCOQC_NO_FILTER( - FILTER_BAM.out.id, - FILTER_BAM.out.total_bam, - FILTER_BAM.out.total_bai, - FILTER_BAM.out.filtered_bam, - FILTER_BAM.out.filtered_bai, - FILTER_BAM.out.unfiltered_flagstat, - FILTER_BAM.out.filtered_flagstat, - FILTER_BAM.out.txt, - quality_score, - ) - PYCOQC_FILTER( - PYCOQC_NO_FILTER.out.id, - PYCOQC_NO_FILTER.out.filtered_bam, - PYCOQC_NO_FILTER.out.filtered_bai, - PYCOQC_NO_FILTER.out.unfiltered_flagstat, - PYCOQC_NO_FILTER.out.filtered_flagstat, - PYCOQC_NO_FILTER.out.txt, - quality_score, - PYCOQC_NO_FILTER.out.unfiltered_pyco_json, - ) - MAKE_QC_REPORT( - PYCOQC_FILTER.out.id, - PYCOQC_FILTER.out.unfiltered_flagstat, - PYCOQC_FILTER.out.filtered_flagstat, - PYCOQC_FILTER.out.unfiltered_pyco_json, - PYCOQC_FILTER.out.filtered_pyco_json, - mapq, - quality_score, - ) + if (params.is_barcoded == true) { + CONVERT_INPUT_FROM_MINKNOW_BARCODED(input) + converted_input = CONVERT_INPUT_FROM_MINKNOW_BARCODED.out + } else if (params.is_barcoded == false) { + CONVERT_INPUT_FROM_MINKNOW_NOT_BARCODED(input) + converted_input = CONVERT_INPUT_FROM_MINKNOW_NOT_BARCODED.out + } + FILTER_BAM( + converted_input.bam.flatten().map { file -> tuple(file.baseName, file) }.toSortedList { a, b -> a[0] <=> b[0] }.flatten().buffer(size: 2), + converted_input.txt.toSortedList { a, b -> a.baseName <=> b.baseName }.flatten(), + mapq, + ) + PYCOQC_NO_FILTER( + FILTER_BAM.out.id, + FILTER_BAM.out.total_bam, + FILTER_BAM.out.total_bai, + FILTER_BAM.out.filtered_bam, + FILTER_BAM.out.filtered_bai, + FILTER_BAM.out.unfiltered_flagstat, + FILTER_BAM.out.filtered_flagstat, + FILTER_BAM.out.txt, + quality_score, + ) + PYCOQC_FILTER( + PYCOQC_NO_FILTER.out.id, + PYCOQC_NO_FILTER.out.filtered_bam, + PYCOQC_NO_FILTER.out.filtered_bai, + PYCOQC_NO_FILTER.out.unfiltered_flagstat, + PYCOQC_NO_FILTER.out.filtered_flagstat, + PYCOQC_NO_FILTER.out.txt, + quality_score, + PYCOQC_NO_FILTER.out.unfiltered_pyco_json, + ) + MAKE_QC_REPORT( + PYCOQC_FILTER.out.id, + PYCOQC_FILTER.out.unfiltered_flagstat, + PYCOQC_FILTER.out.filtered_flagstat, + PYCOQC_FILTER.out.unfiltered_pyco_json, + PYCOQC_FILTER.out.filtered_pyco_json, + mapq, + quality_score, + ) } diff --git a/sub_workflows/FILTERING_AND_QC_FROM_STEP_1.nf b/sub_workflows/FILTERING_AND_QC_FROM_STEP_1.nf index bf14a514113cce3d74cbcf2585a42b7dda397e4f..6f3a7113be41b75386ae141a2aab654777e74532 100755 --- a/sub_workflows/FILTERING_AND_QC_FROM_STEP_1.nf +++ b/sub_workflows/FILTERING_AND_QC_FROM_STEP_1.nf @@ -3,43 +3,44 @@ include { PYCOQC_NO_FILTER ; PYCOQC_FILTER } from '../modules/pycoqc.nf' include { FILTER_BAM } from '../modules/filter_bam.nf' include { MAKE_QC_REPORT } from '../modules/num_reads_report.nf' + workflow FILTERING_AND_QC_FROM_STEP_1 { take: - bams - txts - mapq - quality_score + bams + txts + mapq + quality_score main: - FILTER_BAM(bams, txts, mapq) - PYCOQC_NO_FILTER( - FILTER_BAM.out.id, - FILTER_BAM.out.total_bam, - FILTER_BAM.out.total_bai, - FILTER_BAM.out.filtered_bam, - FILTER_BAM.out.filtered_bai, - FILTER_BAM.out.unfiltered_flagstat, - FILTER_BAM.out.filtered_flagstat, - FILTER_BAM.out.txt, - quality_score, - ) - PYCOQC_FILTER( - PYCOQC_NO_FILTER.out.id, - PYCOQC_NO_FILTER.out.filtered_bam, - PYCOQC_NO_FILTER.out.filtered_bai, - PYCOQC_NO_FILTER.out.unfiltered_flagstat, - PYCOQC_NO_FILTER.out.filtered_flagstat, - PYCOQC_NO_FILTER.out.txt, - quality_score, - PYCOQC_NO_FILTER.out.unfiltered_pyco_json, - ) - MAKE_QC_REPORT( - PYCOQC_FILTER.out.id, - PYCOQC_FILTER.out.unfiltered_flagstat, - PYCOQC_FILTER.out.filtered_flagstat, - PYCOQC_FILTER.out.unfiltered_pyco_json, - PYCOQC_FILTER.out.filtered_pyco_json, - mapq, - quality_score, - ) + FILTER_BAM(bams, txts, mapq) + PYCOQC_NO_FILTER( + FILTER_BAM.out.id, + FILTER_BAM.out.total_bam, + FILTER_BAM.out.total_bai, + FILTER_BAM.out.filtered_bam, + FILTER_BAM.out.filtered_bai, + FILTER_BAM.out.unfiltered_flagstat, + FILTER_BAM.out.filtered_flagstat, + FILTER_BAM.out.txt, + quality_score, + ) + PYCOQC_FILTER( + PYCOQC_NO_FILTER.out.id, + PYCOQC_NO_FILTER.out.filtered_bam, + PYCOQC_NO_FILTER.out.filtered_bai, + PYCOQC_NO_FILTER.out.unfiltered_flagstat, + PYCOQC_NO_FILTER.out.filtered_flagstat, + PYCOQC_NO_FILTER.out.txt, + quality_score, + PYCOQC_NO_FILTER.out.unfiltered_pyco_json, + ) + MAKE_QC_REPORT( + PYCOQC_FILTER.out.id, + PYCOQC_FILTER.out.unfiltered_flagstat, + PYCOQC_FILTER.out.filtered_flagstat, + PYCOQC_FILTER.out.unfiltered_pyco_json, + PYCOQC_FILTER.out.filtered_pyco_json, + mapq, + quality_score, + ) } diff --git a/sub_workflows/MODKIT_AND_MULTIQC.nf b/sub_workflows/MODKIT_AND_MULTIQC.nf index 346e2dd008915efc23652e84603e291e1f25de07..35294c78f20ee2aef614636017fef98b5f09af10 100755 --- a/sub_workflows/MODKIT_AND_MULTIQC.nf +++ b/sub_workflows/MODKIT_AND_MULTIQC.nf @@ -1,5 +1,4 @@ // Import Modules - include { MULTIQC } from '../modules/multiqc.nf' include { MODKIT } from '../modules/modkit.nf' include { MERGE_QC_REPORT } from '../modules//num_reads_report.nf'