add fasta index

This commit is contained in:
Matthias De Smet 2022-04-28 13:52:03 +02:00
parent 55dfe1d8ab
commit 8ad861a645
3 changed files with 19 additions and 15 deletions

View file

@ -10,14 +10,17 @@ workflow BAM_QC_PICARD {
take: take:
ch_bam // channel: [ val(meta), [ bam ]] ch_bam // channel: [ val(meta), [ bam ]]
ch_fasta // channel: [ fasta ] ch_fasta // channel: [ fasta ]
ch_fasta_faix // channel: [ fasta_fai ]
ch_bait_interval // channel: [ bait_interval ] ch_bait_interval // channel: [ bait_interval ]
ch_target_interval // channel: [ target_interval ] ch_target_interval // channel: [ target_interval ]
main: main:
ch_versions = Channel.empty() ch_versions = Channel.empty()
ch_coverage_metrics = Channel.empty()
PICARD_COLLECTMULTIPLEMETRICS( ch_bam, ch_fasta ) PICARD_COLLECTMULTIPLEMETRICS( ch_bam, ch_fasta )
ch_versions = ch_versions.mix(PICARD_COLLECTMULTIPLEMETRICS.out.versions.first()) ch_versions = ch_versions.mix(PICARD_COLLECTMULTIPLEMETRICS.out.versions.first())
if (ch_bait_interval || ch_target_interval) { if (ch_bait_interval || ch_target_interval) {
if (ch_bait_interval.isEmpty()) { if (ch_bait_interval.isEmpty()) {
log.error("Bait interval channel is empty") log.error("Bait interval channel is empty")
@ -26,17 +29,16 @@ workflow BAM_QC_PICARD {
log.error("Target interval channel is empty") log.error("Target interval channel is empty")
} }
PICARD_COLLECTHSMETRICS( ch_bam, ch_fasta, [], ch_bait_interval, ch_target_interval ) 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()) ch_versions = ch_versions.mix(PICARD_COLLECTHSMETRICS.out.versions.first())
} else { } else {
PICARD_COLLECTWGSMETRICS( ch_bam, ch_fasta ) PICARD_COLLECTWGSMETRICS( ch_bam, ch_fasta )
ch_versions = ch_versions.mix(PICARD_COLLECTWGSMETRICS.out.versions.first()) 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: 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 ] ] multiple_metrics = PICARD_COLLECTMULTIPLEMETRICS.out.metrics // channel: [ val(meta), [ multiple_metrics ] ]
versions = ch_versions // channel: [ versions.yml ] versions = ch_versions // channel: [ versions.yml ]

View file

@ -22,14 +22,14 @@ input:
type: file type: file
description: BAM/CRAM/SAM file description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}" pattern: "*.{bam,cram,sam}"
- bai:
type: file
description: Index for BAM/CRAM/SAM file
pattern: "*.{bai,crai,sai}"
- fasta: - fasta:
type: optional file type: optional file
description: Reference file the CRAM was created with description: Reference fasta file
pattern: "*.{fasta,fa}" pattern: "*.{fasta,fa}"
- fasta_fai:
type: optional file
description: Reference fasta file index
pattern: "*.{fasta,fa}.fai"
- bait_intervals: - bait_intervals:
type: optional file type: optional file
description: An interval list file that contains the locations of the baits used. description: An interval list file that contains the locations of the baits used.

View file

@ -9,8 +9,9 @@ workflow test_bam_qc_picard_wgs {
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) 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 = 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 { workflow test_bam_qc_picard_targetted {
@ -18,8 +19,9 @@ workflow test_bam_qc_picard_targetted {
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) 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 = 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) bait = file(params.test_data['sarscov2']['genome']['baits_interval_list'], checkIfExists: true)
target = file(params.test_data['sarscov2']['genome']['targets_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 )
} }