diff --git a/conf/modules.config b/conf/modules.config index e9ece254..b925e466 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -110,7 +110,6 @@ process { } withName: BOWTIE_BUILD { - ext.when = { !params.bowtie && params.tools.split(',').contains('mapsplice') } publishDir = [ path: { "${params.outdir}/1_references/index" }, mode: params.publish_dir_mode, @@ -119,7 +118,6 @@ process { } withName: BOWTIE2_BUILD { - ext.when = { !params.bowtie2 && params.tools.split(',').contains('find_circ') } publishDir = [ path: { "${params.outdir}/1_references/index" }, mode: params.publish_dir_mode, @@ -128,7 +126,6 @@ process { } withName: BWA_INDEX { - ext.when = { !params.bwa && params.tools.split(',').contains('ciriquant') } publishDir = [ path: { "${params.outdir}/1_references/index" }, mode: params.publish_dir_mode, @@ -137,7 +134,6 @@ process { } withName: HISAT2_EXTRACTSPLICESITES { - ext.when = { params.tools.split(',').contains('ciriquant') } publishDir = [ path: { "${params.outdir}/1_references/index/hisat2" }, mode: params.publish_dir_mode, @@ -146,7 +142,6 @@ process { } withName: HISAT2_BUILD { - ext.when = { params.tools.split(',').contains('ciriquant') } publishDir = [ path: { "${params.outdir}/1_references/index" }, mode: params.publish_dir_mode, @@ -155,7 +150,6 @@ process { } withName: STAR_GENOMEGENERATE { - ext.when = { !params.star && (params.tools.split(',').contains('circexplorer2') || params.tools.split(',').contains('dcc') || params.tools.split(',').contains('circrna_finder')) } ext.args = [ "", params.sjdboverhang ? "--sjdbOverhang ${params.sjdboverhang}" : '', @@ -243,7 +237,6 @@ process { } withName: '.*STAR2PASS:PASS_1' { - ext.when = { params.tools.split(',').contains('circexplorer2') || params.tools.split(',').contains('circrna_finder') } ext.args = [ "", "--chimOutType Junctions WithinBAM", @@ -579,14 +572,14 @@ process { publishDir = [ path: { "${params.outdir}/3_bsj_detection/samples/${meta.id}" }, mode: params.publish_dir_mode, - saveAs: { filename -> (filename.equals('versions.yml') || filename.endsWith('_mqc.json')) ? null : filename }, + saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('_mqc.json') ? null : filename }, ] } withName: COMBINEBEDS_READS { ext.consider_strand = params.consider_strand - ext.prefix = { "${meta.id}_reads" } - publishDir = [ + ext.prefix = { "${meta.id}_reads" } + publishDir = [ path: { "${params.outdir}/3_bsj_detection/samples/${meta.id}/reads" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, @@ -606,7 +599,7 @@ process { publishDir = [ path: { "${params.outdir}/3_bsj_detection/combined" }, mode: params.publish_dir_mode, - saveAs: { filename -> (filename.equals('versions.yml') || filename.endsWith('_mqc.json')) ? null : filename }, + saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('_mqc.json') ? null : filename }, ] } @@ -1071,7 +1064,7 @@ process { } withName: MULTIQC { - ext.args = { params.multiqc_title ? "--title \"${params.multiqc_title}\"" : '' } + ext.args = { params.multiqc_title ? "--title \"${params.multiqc_title}\"" : '' } publishDir = [ path: { "${params.outdir}/7_multiqc" }, mode: params.publish_dir_mode, diff --git a/subworkflows/local/bsj_detection.nf b/subworkflows/local/bsj_detection.nf index 41d054c0..388ca825 100644 --- a/subworkflows/local/bsj_detection.nf +++ b/subworkflows/local/bsj_detection.nf @@ -47,17 +47,21 @@ workflow BSJ_DETECTION { fasta = ch_fasta.map{_meta, fasta -> fasta} gtf = ch_gtf.map{_meta, gtf -> gtf} + tools_selected = params.tools.split(',').collect{it.trim().toLowerCase()} + // STAR 2-PASS-MODE star_ignore_sjdbgtf = true seq_center = params.seq_center ?: '' seq_platform = '' - STAR2PASS( reads, star_index, ch_gtf, bsj_reads, star_ignore_sjdbgtf, seq_center, seq_platform ) - ch_versions = ch_versions.mix(STAR2PASS.out.versions) + + if (tools_selected.intersect(['circexplorer2', 'circrna_finder', 'dcc', 'mapsplice']).size() > 0) { + STAR2PASS( reads, star_index, ch_gtf, bsj_reads, star_ignore_sjdbgtf, seq_center, seq_platform ) + ch_versions = ch_versions.mix(STAR2PASS.out.versions) + } // // DISCOVERY TOOLS: // - tools_selected = params.tools.split(',').collect{it.trim().toLowerCase()} if (tools_selected.size() == 0) { error 'No tools selected for circRNA discovery.' diff --git a/subworkflows/local/prepare_genome.nf b/subworkflows/local/prepare_genome.nf index a24693e8..cecda8fc 100644 --- a/subworkflows/local/prepare_genome.nf +++ b/subworkflows/local/prepare_genome.nf @@ -12,7 +12,6 @@ include { UCSC_GTFTOGENEPRED } from '../../modules/nf-core/ucsc/gtf include { GAWK as CIRCEXPLORER2_REFERENCE } from '../../modules/nf-core/gawk' workflow PREPARE_GENOME { - take: ch_fasta ch_gtf @@ -20,11 +19,11 @@ workflow PREPARE_GENOME { main: ch_versions = Channel.empty() - detection_tools = params.tools.split(',').collect{it.trim().toLowerCase()} + detection_tools = params.tools.split(',').collect { it.trim().toLowerCase() } // MapSplice cannot deal with extra field in the fasta headers // this removes all additional fields in the headers of the input fasta file - if( detection_tools.contains('mapsplice') ) { + if (detection_tools.contains('mapsplice')) { CLEAN_FASTA(ch_fasta, [], false) ch_fasta = CLEAN_FASTA.out.output @@ -41,23 +40,33 @@ workflow PREPARE_GENOME { SEQKIT_SPLIT(ch_fasta) ch_versions = ch_versions.mix(SEQKIT_SPLIT.out.versions) - BOWTIE_BUILD(ch_fasta) - ch_versions = ch_versions.mix(BOWTIE_BUILD.out.versions) + if (!params.bowtie && detection_tools.contains('mapsplice')) { + BOWTIE_BUILD(ch_fasta) + ch_versions = ch_versions.mix(BOWTIE_BUILD.out.versions) + } - BOWTIE2_BUILD(ch_fasta) - ch_versions = ch_versions.mix(BOWTIE2_BUILD.out.versions) + if (!params.bowtie2 && detection_tools.contains('find_circ')) { + BOWTIE2_BUILD(ch_fasta) + ch_versions = ch_versions.mix(BOWTIE2_BUILD.out.versions) + } - BWA_INDEX (ch_fasta) - ch_versions = ch_versions.mix(BWA_INDEX.out.versions) + if (!params.bwa && detection_tools.contains('ciriquant')) { + BWA_INDEX(ch_fasta) + ch_versions = ch_versions.mix(BWA_INDEX.out.versions) + } - HISAT2_EXTRACTSPLICESITES(ch_gtf) - ch_versions = ch_versions.mix(HISAT2_EXTRACTSPLICESITES.out.versions) + if (!params.hisat2 && detection_tools.contains('ciriquant')) { + HISAT2_EXTRACTSPLICESITES(ch_gtf) + ch_versions = ch_versions.mix(HISAT2_EXTRACTSPLICESITES.out.versions) - HISAT2_BUILD(ch_fasta, ch_gtf, HISAT2_EXTRACTSPLICESITES.out.txt) - ch_versions = ch_versions.mix(HISAT2_BUILD.out.versions) + HISAT2_BUILD(ch_fasta, ch_gtf, HISAT2_EXTRACTSPLICESITES.out.txt) + ch_versions = ch_versions.mix(HISAT2_BUILD.out.versions) + } - STAR_GENOMEGENERATE(ch_fasta, ch_gtf) - ch_versions = ch_versions.mix(STAR_GENOMEGENERATE.out.versions) + if (!params.star && detection_tools.intersect(['circexplorer2', 'circrna_finder', 'dcc', 'mapsplice']).size() > 0) { + STAR_GENOMEGENERATE(ch_fasta, ch_gtf) + ch_versions = ch_versions.mix(STAR_GENOMEGENERATE.out.versions) + } SAMTOOLS_FAIDX(ch_fasta, [[], []]) ch_versions = ch_versions.mix(SAMTOOLS_FAIDX.out.versions) @@ -65,21 +74,20 @@ workflow PREPARE_GENOME { ch_circexplorer2_reference = Channel.empty() if (detection_tools.intersect(['circexplorer2', 'mapsplice']).size() > 0) { CIRCEXPLORER2_REFERENCE(UCSC_GTFTOGENEPRED.out.genepred, [], false) - ch_circexplorer2_reference = CIRCEXPLORER2_REFERENCE.out.output.map{ _meta, file -> file }.collect() + ch_circexplorer2_reference = CIRCEXPLORER2_REFERENCE.out.output.map { _meta, file -> file }.collect() ch_versions = ch_versions.mix(CIRCEXPLORER2_REFERENCE.out.versions) } emit: gtf = ch_gtf faidx = SAMTOOLS_FAIDX.out.fai - bowtie = params.bowtie ?: BOWTIE_BUILD.out.index - bowtie2 = params.bowtie2 ? Channel.value([[id: "bowtie2"], file(params.bowtie2, checkIfExists: true)]) : BOWTIE2_BUILD.out.index.collect() - bwa = params.bwa ? Channel.value([[id: "bwa"], file(params.bwa, checkIfExists: true)]) : BWA_INDEX.out.index.collect() - hisat2 = params.hisat2 ? Channel.value([[id: "hisat2"], file(params.hisat2, checkIfExists: true)]) : HISAT2_BUILD.out.index.collect() - star = params.star ? Channel.value([[id: "star"], file(params.star, checkIfExists: true)]) : STAR_GENOMEGENERATE.out.index.collect() + bowtie = params.bowtie ?: BOWTIE_BUILD.out.index + bowtie2 = params.bowtie2 ? Channel.value([[id: "bowtie2"], file(params.bowtie2, checkIfExists: true)]) : BOWTIE2_BUILD.out.index.collect() + bwa = params.bwa ? Channel.value([[id: "bwa"], file(params.bwa, checkIfExists: true)]) : BWA_INDEX.out.index.collect() + hisat2 = params.hisat2 ? Channel.value([[id: "hisat2"], file(params.hisat2, checkIfExists: true)]) : HISAT2_BUILD.out.index.collect() + star = params.star ? Channel.value([[id: "star"], file(params.star, checkIfExists: true)]) : STAR_GENOMEGENERATE.out.index.collect() circexplorer2 = ch_circexplorer2_reference chromosomes = SEQKIT_SPLIT.out.split splice_sites = HISAT2_EXTRACTSPLICESITES.out.txt.collect() - versions = ch_versions }