diff --git a/subworkflows/local/umi_dedup.nf b/subworkflows/local/umi_dedup.nf index 12033274..8712f526 100644 --- a/subworkflows/local/umi_dedup.nf +++ b/subworkflows/local/umi_dedup.nf @@ -1,10 +1,10 @@ -// +// // Deduplicate the UMI reads by mapping them to the complete genome. // include { INDEX_GENOME } from '../../modules/local/bowtie_genome' include { BOWTIE_MAP_SEQ as UMI_MAP_GENOME } from '../../modules/local/bowtie_map_mirna' -include { BAM_SORT_SAMTOOLS } from '../../subworkflows/nf-core/bam_sort_samtools' +include { BAM_SORT_STATS_SAMTOOLS } from '../../subworkflows/nf-core/bam_sort_stats_samtools' include { UMITOOLS_DEDUP } from '../../modules/nf-core/modules/umitools/dedup/main' include { SAMTOOLS_BAM2FQ } from '../../modules/nf-core/modules/samtools/bam2fq/main' include { CAT_CAT } from '../../modules/nf-core/modules/cat/cat/main' @@ -31,7 +31,7 @@ workflow DEDUPLICATE_UMIS { } if (bt_index){ - + UMI_MAP_GENOME ( reads, bt_index.collect() ) ch_versions = ch_versions.mix(UMI_MAP_GENOME.out.versions) @@ -54,7 +54,7 @@ workflow DEDUPLICATE_UMIS { .join(UMI_MAP_GENOME.out.unmapped) .map { meta, file1, file2 -> [meta, [file1, file2]]} .set { ch_cat } - + CAT_CAT ( ch_cat ) ch_dedup_reads = CAT_CAT.out.file_out } diff --git a/subworkflows/nf-core/fastqc_umitools_trimgalore.nf b/subworkflows/nf-core/fastqc_umitools_trimgalore.nf deleted file mode 100644 index ca158e7a..00000000 --- a/subworkflows/nf-core/fastqc_umitools_trimgalore.nf +++ /dev/null @@ -1,78 +0,0 @@ -// -// Read QC, UMI extraction and trimming -// - -nextflow.enable.dsl=2 - -include { FASTQC } from '../../modules/nf-core/modules/fastqc/main' -include { UMITOOLS_EXTRACT } from '../../modules/nf-core/modules/umitools/extract/main' -include { TRIMGALORE } from '../../modules/nf-core/modules/trimgalore/main' - -workflow FASTQC_UMITOOLS_TRIMGALORE { - take: - reads // channel: [ val(meta), [ reads ] ] - skip_fastqc // boolean: true/false - with_umi // boolean: true/false - skip_trimming // boolean: true/false - umi_discard_read // integer: 0, 1 or 2 - - main: - - ch_versions = Channel.empty() - fastqc_html = Channel.empty() - fastqc_zip = Channel.empty() - if (!skip_fastqc) { - FASTQC ( reads ).html.set { fastqc_html } - fastqc_zip = FASTQC.out.zip - ch_versions = ch_versions.mix(FASTQC.out.versions.first()) - } - - umi_reads = reads - umi_log = Channel.empty() - if (with_umi) { - UMITOOLS_EXTRACT ( reads ).reads.set { umi_reads } - umi_log = UMITOOLS_EXTRACT.out.log - ch_versions = ch_versions.mix(UMITOOLS_EXTRACT.out.versions.first()) - - // Discard R1 / R2 if required - if (umi_discard_read in [1,2]) { - UMITOOLS_EXTRACT - .out - .reads - .map { meta, reads -> - if (!meta.single_end) { - meta['single_end'] = true - reads = reads[umi_discard_read % 2] - } - return [ meta, reads ] - } - .set { umi_reads } - } - } - - trim_reads = umi_reads - trim_html = Channel.empty() - trim_zip = Channel.empty() - trim_log = Channel.empty() - if (!skip_trimming) { - TRIMGALORE ( umi_reads ).reads.set { trim_reads } - trim_html = TRIMGALORE.out.html - trim_zip = TRIMGALORE.out.zip - trim_log = TRIMGALORE.out.log - ch_versions = ch_versions.mix(TRIMGALORE.out.versions.first()) - } - - emit: - reads = trim_reads // channel: [ val(meta), [ reads ] ] - - fastqc_html // channel: [ val(meta), [ html ] ] - fastqc_zip // channel: [ val(meta), [ zip ] ] - - umi_log // channel: [ val(meta), [ log ] ] - - trim_html // channel: [ val(meta), [ html ] ] - trim_zip // channel: [ val(meta), [ zip ] ] - trim_log // channel: [ val(meta), [ txt ] ] - - versions = ch_versions.ifEmpty(null) // channel: [ versions.yml ] -} \ No newline at end of file diff --git a/workflows/smrnaseq.nf b/workflows/smrnaseq.nf index 55f7614b..04529c63 100644 --- a/workflows/smrnaseq.nf +++ b/workflows/smrnaseq.nf @@ -64,14 +64,14 @@ if (!params.mirgenedb) { if (params.mirgenedb_gff) { mirna_gtf = file(params.mirgenedb_gff, checkIfExists: true) } else { exit 1, "MirGeneDB gff file not found: ${params.mirgenedb_gff}"} } -include { INPUT_CHECK } from '../subworkflows/local/input_check' -include { FASTQC_UMITOOLS_FASTP } from '../subworkflows/nf-core/fastqc_umitools_trimgalore' -include { DEDUPLICATE_UMIS } from '../subworkflows/local/umi_dedup' -include { CONTAMINANT_FILTER } from '../subworkflows/local/contaminant_filter' -include { MIRNA_QUANT } from '../subworkflows/local/mirna_quant' -include { GENOME_QUANT } from '../subworkflows/local/genome_quant' -include { MIRTRACE } from '../subworkflows/local/mirtrace' -include { MIRDEEP2 } from '../subworkflows/local/mirdeep2' +include { INPUT_CHECK } from '../subworkflows/local/input_check' +include { FASTQ_FASTQC_UMITOOLS_FASTP } from '../subworkflows/nf-core/fastq_fastqc_umitools_fastp' +include { DEDUPLICATE_UMIS } from '../subworkflows/local/umi_dedup' +include { CONTAMINANT_FILTER } from '../subworkflows/local/contaminant_filter' +include { MIRNA_QUANT } from '../subworkflows/local/mirna_quant' +include { GENOME_QUANT } from '../subworkflows/local/genome_quant' +include { MIRTRACE } from '../subworkflows/local/mirtrace' +include { MIRDEEP2 } from '../subworkflows/local/mirdeep2' /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -132,22 +132,19 @@ workflow SMRNASEQ { ch_versions = ch_versions.mix(CAT_FASTQ.out.versions.first().ifEmpty(null)) // - // SUBWORKFLOW: Read QC and trim adapters + // SUBWORKFLOW: Read QC, extract UMI and trim adapters & dedup UMIs if necessary / desired by the user // - // - // SUBWORKFLOW: Read QC, extract UMI and trim adapters - // - FASTQC_UMITOOLS_FASTP ( + FASTQ_FASTQC_UMITOOLS_FASTP ( ch_cat_fastq, params.skip_fastqc || params.skip_qc, params.with_umi, params.skip_trimming, params.umi_discard_read ) - ch_versions = ch_versions.mix(FASTQC_UMITOOLS_FASTP.out.versions) + ch_versions = ch_versions.mix(FASTQ_FASTQC_UMITOOLS_FASTP.out.versions) - reads_for_mirna = FASTQC_UMITOOLS_FASTP.out.reads + reads_for_mirna = FASTQ_FASTQC_UMITOOLS_FASTP.out.reads // // SUBWORKFLOW: Deduplicate UMIs by mapping them to the genome @@ -156,8 +153,8 @@ workflow SMRNASEQ { if (fasta){ fasta_ch = file(fasta) DEDUPLICATE_UMIS ( - fasta_ch, - bt_index, + fasta_ch, + bt_index, FASTQC_UMITOOLS_FASTP.out.reads ) reads_for_mirna = DEDUPLICATE_UMIS.out.reads @@ -165,18 +162,11 @@ workflow SMRNASEQ { } } - FASTQC_UMITOOLS_FASTP ( - ch_cat_fastq, - ch_fastp_adapters, - false, - false - ) - ch_versions = ch_versions.mix(FASTQC_FASTP.out.versions) // // SUBWORKFLOW: mirtrace QC // - FASTQC_FASTP.out.adapterseq + FASTQ_FASTQC_UMITOOLS_FASTP.out.adapterseq .join( FASTQC_FASTP.out.reads ) .map { meta, adapterseq, reads -> [adapterseq, meta.id, reads] } .groupTuple()