From 0528894df06014c6471e278fdd313197ae0aa042 Mon Sep 17 00:00:00 2001 From: Lucio Di Filippo Date: Tue, 12 Sep 2023 09:04:50 +0200 Subject: [PATCH] add stopAt parameter --- nextflow.config | 2 ++ nextflow_schema.json | 5 +++++ workflows/sammyseq.nf | 51 ++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/nextflow.config b/nextflow.config index 1fbf588..cb04645 100644 --- a/nextflow.config +++ b/nextflow.config @@ -9,6 +9,8 @@ // Global default params, used in configs params { + stopAt = '' + // TODO nf-core: Specify your pipeline's command line flags // Input options input = null diff --git a/nextflow_schema.json b/nextflow_schema.json index b5c8a9d..9352576 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -12,6 +12,11 @@ "description": "Define where the pipeline should find input data and save output data.", "required": ["input", "outdir"], "properties": { + "stopAt": { + "type": "string", + "description": "Specify after which step the pipeline should stop.", + "fa_icon": "fas fa-stop-circle" + }, "input": { "type": "string", "format": "file-path", diff --git a/workflows/sammyseq.nf b/workflows/sammyseq.nf index 85d643d..1ed3eec 100644 --- a/workflows/sammyseq.nf +++ b/workflows/sammyseq.nf @@ -67,8 +67,8 @@ include { MULTIQC } from '../modules/nf-core/multiqc/main' include { CUSTOM_DUMPSOFTWAREVERSIONS } from '../modules/nf-core/custom/dumpsoftwareversions/main' include { TRIMMOMATIC } from '../modules/nf-core/trimmomatic' include { SAMTOOLS_FAIDX } from '../modules/nf-core/samtools/faidx' -// include { } - +include { DEEPTOOLS_BAMCOVERAGE } from '../modules/nf-core/deeptools/bamcoverage' + // include { SAMTOOLS_VIEW as SAMTOOLS_VIEW_FILTER } from '../modules/nf-core/samtools/view/main' // include { SAMTOOLS_SORT as SAMTOOLS_SORT_FILTERED } from '../modules/nf-core/samtools/sort/main' // include { SAMTOOLS_INDEX as SAMTOOLS_INDEX_FILTERED } from '../modules/nf-core/samtools/index/main' @@ -132,6 +132,11 @@ workflow SAMMYSEQ { merged_reads ) + if (params.stopAt == 'TRIMMOMATIC') { + return + } + + //BWA_ALN ( // TRIMMOMATIC.out.trimmed_reads, // PREPARE_GENOME.out.bwa_index @@ -142,6 +147,11 @@ workflow SAMMYSEQ { PREPARE_GENOME.out.bwa_index ) + if (params.stopAt == 'FASTQ_ALIGN_BWAALN') { + return + } + + // PICARD MARK_DUPLICATES // Index Fasta File for Markduplicates SAMTOOLS_FAIDX ( @@ -149,6 +159,8 @@ workflow SAMMYSEQ { [[], []] ) + + // MARK DUPLICATES IN BAM FILE BAM_MARKDUPLICATES_PICARD ( FASTQ_ALIGN_BWAALN.out.bam, @@ -156,6 +168,9 @@ workflow SAMMYSEQ { SAMTOOLS_FAIDX.out.fai.collect() ) + if (params.stopAt == 'BAM_MARKDUPLICATES_PICARD') { + return + } // SAMTOOLS_VIEW_FILTER ( // ch_bam_sorted.join(ch_bam_sorted_bai), // ch_fasta_meta, @@ -163,8 +178,38 @@ workflow SAMMYSEQ { // ) // ch_versions = ch_versions.mix(SAMTOOLS_VIEW_FILTER.out.versions) - ch_bam_from_markduplicates = BAM_MARKDUPLICATES_PICARD.bam + //ch_bam_from_markduplicates = BAM_MARKDUPLICATES_PICARD.bam + //BAM_MARKDUPLICATES_PICARD.out.bam.view() + //BAM_MARKDUPLICATES_PICARD.out.bai.view() + + //ch_bam_bai_combined = BAM_MARKDUPLICATES_PICARD.out.bam.join(BAM_MARKDUPLICATES_PICARD.out.bai, by: [0]) + + ch_bam_bai_combined = BAM_MARKDUPLICATES_PICARD.out.bam + .join(BAM_MARKDUPLICATES_PICARD.out.bai, by: [0], remainder: true) + .map { + meta, bam, bai -> + [ meta, bam, bai ] + + } + + //ch_bam_bai_combined.view() + + //ch_for_bamcoverage = ch_bam_bai_combined.map { meta1, bam, meta2, bai -> + // tuple(meta1, bam, bai) + //} + + //ch_for_bamcoverage.view() + + DEEPTOOLS_BAMCOVERAGE ( + ch_bam_bai_combined, + ch_fasta_meta.map { it[2] }, + SAMTOOLS_FAIDX.out.fai.collect() + ) + + if (params.stopAt == 'DEEPTOOLS_BAMCOVERAGE') { + return + } CUSTOM_DUMPSOFTWAREVERSIONS (