From f4ad2d07e234fa028ef35744ed988f3c44cc5f87 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 19 Sep 2023 13:37:03 -0400 Subject: [PATCH] refactor: always call fromPath with checkIfExists: true --- main.nf | 16 +++++++++------- subworkflows/local/peaks.nf | 6 ++---- subworkflows/local/qc.nf | 7 ++++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/main.nf b/main.nf index f43c524e..b46f4024 100644 --- a/main.nf +++ b/main.nf @@ -37,17 +37,19 @@ workflow { INPUT_CHECK.out.reads.set { raw_fastqs } raw_fastqs | TRIM_SE TRIM_SE.out.set{ trimmed_fastqs } - blacklist_files = Channel - .fromPath(params.genomes[ params.genome ].blacklist_files) - .collect() + + Channel.fromPath(params.genomes[ params.genome ].blacklist_files, checkIfExists: true) + .collect() + .set{ blacklist_files } ALIGN_BLACKLIST(trimmed_fastqs, blacklist_files) - reference_files = Channel - .fromPath(params.genomes[ params.genome ].reference_files) - .collect() + Channel.fromPath(params.genomes[ params.genome ].reference_files, checkIfExists: true) + .collect() + .set{ reference_files } ALIGN_GENOME(ALIGN_BLACKLIST.out.reads, reference_files) ALIGN_GENOME.out.bam.set{ aligned_bam } - chrom_sizes = Channel.fromPath(params.genomes[ params.genome ].chrom_sizes) + Channel.fromPath(params.genomes[ params.genome ].chrom_sizes, checkIfExists: true) + .set{ chrom_sizes } aligned_bam.combine(chrom_sizes) | DEDUPLICATE DEDUPLICATE.out.bam.set{ deduped_bam } DEDUPLICATE.out.tag_align.set{ deduped_tagalign } diff --git a/subworkflows/local/peaks.nf b/subworkflows/local/peaks.nf index e3ef4fa3..04759788 100644 --- a/subworkflows/local/peaks.nf +++ b/subworkflows/local/peaks.nf @@ -32,13 +32,11 @@ workflow CALL_PEAKS { meta1, tag1, meta2, tag2 -> meta1.control == meta2.id ? [ meta1, tag1, tag2 ]: null } - .combine(Channel.fromPath(params.gem_read_dists)) + .combine(Channel.fromPath(params.gem_read_dists, checkIfExists: true)) .combine(chrom_sizes) .set { ch_gem } - println "chr dir ${params.genomes[ params.genome ].chromosomes_dir}" - Channel.fromPath("${params.genomes[ params.genome ].chromosomes_dir}", type: 'dir') + Channel.fromPath("${params.genomes[ params.genome ].chromosomes_dir}", type: 'dir', checkIfExists: true) .set{ chrom_files } - chrom_files.view() ch_tagalign | MACS_BROAD ch_tagalign | MACS_NARROW diff --git a/subworkflows/local/qc.nf b/subworkflows/local/qc.nf index 4a79fd46..946a8aea 100644 --- a/subworkflows/local/qc.nf +++ b/subworkflows/local/qc.nf @@ -80,8 +80,9 @@ workflow QC { meta1.control == meta2.id ? [ meta1, [ bam1, bam2 ], [ bai1, bai2 ] ] : null } .set { ch_ip_ctrl_bam_bai } - PLOT_FINGERPRINT(ch_ip_ctrl_bam_bai) - BED_PROTEIN_CODING(Channel.fromPath(params.genomes[ params.genome ].gene_info)) + ch_ip_ctrl_bam_bai | PLOT_FINGERPRINT + Channel.fromPath(params.genomes[ params.genome ].gene_info, + checkIfExists: true) | BED_PROTEIN_CODING COMPUTE_MATRIX(bigwig_list, BED_PROTEIN_CODING.out.bed.combine(Channel.from('metagene','TSS')) ) @@ -101,7 +102,7 @@ workflow QC { .set { ch_ip_ctrl_bigwig } MULTIQC( - Channel.fromPath(params.multiqc_config), + Channel.fromPath(params.multiqc_config, checkIfExists: true), FASTQC_RAW.out.zip.collect(), FASTQC_TRIMMED.out.zip.collect(), FASTQ_SCREEN.out.screen.collect(),