diff --git a/conf/modules.config b/conf/modules.config index 01715bf1c7d45610e10a6436c9eded6b97330f3a..0b13690a235b85a2732700b2317f59c3af13f440 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -424,9 +424,5 @@ process { ext.args = { [ "-n" ].join('').trim() } - publishDir = [ - path: { "${params.outdir}/picard/bam" }, - mode: 'copy' - ] } } diff --git a/nextflow.config b/nextflow.config index f4f369bc08250880367476c6f09e4f6354a4f45d..6582b79628b595766fff6ace5a7048d75341bd2f 100644 --- a/nextflow.config +++ b/nextflow.config @@ -10,7 +10,7 @@ params { // Choice of the workflow ('hicpro' or 'hicstuff') - workflow = 'hicstuff' + workflow = 'hicpro' // Input options input = null diff --git a/subworkflows/local/filter_pcr_dup.nf b/subworkflows/local/filter_pcr_dup.nf index 3530d6fdbae5cd69fe8b1a23d4433bf076abe379..344c1c9c8f30f6da04591a395c94a4c01f43fae8 100644 --- a/subworkflows/local/filter_pcr_dup.nf +++ b/subworkflows/local/filter_pcr_dup.nf @@ -32,13 +32,19 @@ workflow FILTER_PCR_DUP { ) SAMTOOLS_SORT_N.out.bam.set{ ch_bam } - FILTER_PAIR( - ch_bam.combine(ch_bam) - .map { - meta1, bam1, meta2, bam2 -> - meta1.id == meta2.id && meta1.chunk == meta2.chunk && meta1.mates == "R1" && meta2.mates == "R2" ? [ meta1, bam1, meta2, bam2 ] : null + if (params.workflow == "hicstuff"){ + FILTER_PAIR( + ch_bam.combine(ch_bam) + .map { + meta1, bam1, meta2, bam2 -> + meta1.id == meta2.id && meta1.chunk == meta2.chunk && meta1.mates == "R1" && meta2.mates == "R2" ? [ meta1, bam1, meta2, bam2 ] : null }) FILTER_PAIR.out.bam.set{ new_ch_bam } + } + else{ + ch_bam.set{ new_ch_bam } + } + emit: bam = new_ch_bam diff --git a/subworkflows/local/hicpro.nf b/subworkflows/local/hicpro.nf index 17543d05c060c2924d2b65d20fad3e3b1f7f5568..6d2e07d7055e6fc6a105a4334a30791fcb5533ab 100644 --- a/subworkflows/local/hicpro.nf +++ b/subworkflows/local/hicpro.nf @@ -12,6 +12,7 @@ include { MERGE_STATS } from '../../modules/local/hicpro/merge_stats' include { HICPRO2PAIRS } from '../../modules/local/hicpro/hicpro2pairs' include { BUILD_CONTACT_MAPS } from '../../modules/local/hicpro/build_contact_maps' include { ICE_NORMALIZATION } from '../../modules/local/hicpro/run_ice' +include { FILTER_PCR_DUP } from './filter_pcr_dup' // Remove meta.chunks def removeChunks(row){ @@ -44,7 +45,22 @@ workflow HICPRO { ch_versions = ch_versions.mix(HICPRO_MAPPING.out.versions) HICPRO_MAPPING.out.bam.set{ ch_bam } - ch_bam.view() + + //*************************************** + // FILTER PCR DUPLICATES + + if (params.filter_pcr_picard && !params.keep_dups){ + error "Error: cannot filter PCR duplicates with both methods! If filter_pcr_picard is true, keep_dups should be true too" + } + else if (params.filter_pcr_picard){ + FILTER_PCR_DUP( + HICPRO_MAPPING.out.bam, + fasta, + index + ) + FILTER_PCR_DUP.out.bam + .set {ch_bam} + } //*************************************** // DIGESTION PROTOCOLS diff --git a/subworkflows/local/hicpro_mapping.nf b/subworkflows/local/hicpro_mapping.nf index 3e36cf0eb20e4879907ffccc586f4569b0679c99..61a95a85ace406b808bcc3c157504e026d96d92e 100644 --- a/subworkflows/local/hicpro_mapping.nf +++ b/subworkflows/local/hicpro_mapping.nf @@ -9,7 +9,6 @@ include { BOWTIE2_ALIGN as BOWTIE2_ALIGN_TRIMMED } from '../../modules/nf-core/b include { MERGE_BOWTIE2 } from '../../modules/local/hicpro/bowtie2_merge' include { COMBINE_MATES} from '../../modules/local/hicpro/combine_mates' include { MAPPING_STATS_DNASE } from '../../modules/local/hicpro/dnase_mapping_stats' -include { FILTER_PCR_DUP } from './filter_pcr_dup' // Paired-end to Single-end def pairToSingle(row, mates) { @@ -31,12 +30,12 @@ def singleToPair(row){ return [ meta, row[1] ] } -def singleToPairPCR(row){ +/* def singleToPairPCR(row){ def meta = row[0].clone() meta.remove('mates') meta.single_end = false return [ meta, [row[1], row[3]] ] -} +} */ workflow HICPRO_MAPPING { @@ -111,28 +110,7 @@ workflow HICPRO_MAPPING { .set {ch_bams} } - //*************************************** - // FILTER PCR DUPLICATES - - if (params.filter_pcr_picard && !params.keep_dups){ - error "Error: cannot filter PCR duplicates with both methods! If filter_pcr_picard is true, keep_dups should be true too" - } - else if (params.filter_pcr_picard){ - if (!params.dnase){ - MERGE_BOWTIE2.out.bam.set{ch_2filter} - } - else{ - BOWTIE2_ALIGN.out.bamx.set{ch_2filter} - } - FILTER_PCR_DUP( - ch_2filter, - fasta, - index - ) - FILTER_PCR_DUP.out.bam - .map { singleToPairPCR(it) } - .set {ch_bams} - } + COMBINE_MATES (