From 8ad861a645e86c411b47472616a924063afba106 Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Thu, 28 Apr 2022 13:52:03 +0200 Subject: [PATCH] add fasta index --- subworkflows/nf-core/bam_qc_picard/main.nf | 12 +++++++----- subworkflows/nf-core/bam_qc_picard/meta.yml | 10 +++++----- tests/subworkflows/nf-core/bam_qc_picard/main.nf | 12 +++++++----- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/subworkflows/nf-core/bam_qc_picard/main.nf b/subworkflows/nf-core/bam_qc_picard/main.nf index 9e429448..e6f82feb 100644 --- a/subworkflows/nf-core/bam_qc_picard/main.nf +++ b/subworkflows/nf-core/bam_qc_picard/main.nf @@ -10,14 +10,17 @@ workflow BAM_QC_PICARD { take: ch_bam // channel: [ val(meta), [ bam ]] ch_fasta // channel: [ fasta ] + ch_fasta_faix // channel: [ fasta_fai ] ch_bait_interval // channel: [ bait_interval ] ch_target_interval // channel: [ target_interval ] main: ch_versions = Channel.empty() + ch_coverage_metrics = Channel.empty() PICARD_COLLECTMULTIPLEMETRICS( ch_bam, ch_fasta ) ch_versions = ch_versions.mix(PICARD_COLLECTMULTIPLEMETRICS.out.versions.first()) + if (ch_bait_interval || ch_target_interval) { if (ch_bait_interval.isEmpty()) { log.error("Bait interval channel is empty") @@ -26,18 +29,17 @@ workflow BAM_QC_PICARD { log.error("Target interval channel is empty") } PICARD_COLLECTHSMETRICS( ch_bam, ch_fasta, [], ch_bait_interval, ch_target_interval ) + ch_coverage_metrics.mix(PICARD_COLLECTHSMETRICS.out.coverage_metrics.first()) ch_versions = ch_versions.mix(PICARD_COLLECTHSMETRICS.out.versions.first()) } else { PICARD_COLLECTWGSMETRICS( ch_bam, ch_fasta ) ch_versions = ch_versions.mix(PICARD_COLLECTWGSMETRICS.out.versions.first()) + ch_coverage_metrics.mix(PICARD_COLLECTWGSMETRICS.out.coverage_metrics.first()) } - ch_coverage_metrics = Channel.empty() - ch_coverage_metrics.mix(PICARD_COLLECTHSMETRICS.out.coverage_metrics.first(), PICARD_COLLECTWGSMETRICS.out.coverage_metrics.first()) - emit: - coverage_metrics = PICARD_COLLECTWGSMETRICS.out.metrics // channel: [ val(meta), [ coverage_metrics ] ] + coverage_metrics = ch_coverage_metrics // channel: [ val(meta), [ coverage_metrics ] ] multiple_metrics = PICARD_COLLECTMULTIPLEMETRICS.out.metrics // channel: [ val(meta), [ multiple_metrics ] ] - versions = ch_versions // channel: [ versions.yml ] + versions = ch_versions // channel: [ versions.yml ] } diff --git a/subworkflows/nf-core/bam_qc_picard/meta.yml b/subworkflows/nf-core/bam_qc_picard/meta.yml index 67d3496e..c45215d1 100644 --- a/subworkflows/nf-core/bam_qc_picard/meta.yml +++ b/subworkflows/nf-core/bam_qc_picard/meta.yml @@ -22,14 +22,14 @@ input: type: file description: BAM/CRAM/SAM file pattern: "*.{bam,cram,sam}" - - bai: - type: file - description: Index for BAM/CRAM/SAM file - pattern: "*.{bai,crai,sai}" - fasta: type: optional file - description: Reference file the CRAM was created with + description: Reference fasta file pattern: "*.{fasta,fa}" + - fasta_fai: + type: optional file + description: Reference fasta file index + pattern: "*.{fasta,fa}.fai" - bait_intervals: type: optional file description: An interval list file that contains the locations of the baits used. diff --git a/tests/subworkflows/nf-core/bam_qc_picard/main.nf b/tests/subworkflows/nf-core/bam_qc_picard/main.nf index 03696b44..a3e2ed62 100644 --- a/tests/subworkflows/nf-core/bam_qc_picard/main.nf +++ b/tests/subworkflows/nf-core/bam_qc_picard/main.nf @@ -9,17 +9,19 @@ workflow test_bam_qc_picard_wgs { file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ] fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + fasta_fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) - BAM_QC_PICARD ( input, fasta, [], [] ) + BAM_QC_PICARD ( input, fasta, fasta_fai, [], [] ) } workflow test_bam_qc_picard_targetted { input = [ [ id:'test', single_end:false ], // meta map file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ] - fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - bait = file(params.test_data['sarscov2']['genome']['baits_interval_list'], checkIfExists: true) - target = file(params.test_data['sarscov2']['genome']['targets_interval_list'], checkIfExists: true) + fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + fasta_fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) + bait = file(params.test_data['sarscov2']['genome']['baits_interval_list'], checkIfExists: true) + target = file(params.test_data['sarscov2']['genome']['targets_interval_list'], checkIfExists: true) - BAM_QC_PICARD ( input, fasta, bait, target ) + BAM_QC_PICARD ( input, fasta, fasta_fai, bait, target ) }