From 9373a96c4f49c1f042d85096fc5b08ccfb0ea690 Mon Sep 17 00:00:00 2001 From: LilyAnderssonLee Date: Mon, 18 Mar 2024 10:53:56 +0100 Subject: [PATCH 1/6] update the nanopore and fasta input channel --- workflows/taxprofiler.nf | 70 +++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/workflows/taxprofiler.nf b/workflows/taxprofiler.nf index b13bd236..efc68e7c 100644 --- a/workflows/taxprofiler.nf +++ b/workflows/taxprofiler.nf @@ -113,65 +113,63 @@ workflow TAXPROFILER { // Validate input files and create separate channels for FASTQ, FASTA, and Nanopore data samplesheet .branch { meta, run_accession, instrument_platform, fastq_1, fastq_2, fasta -> - //println "Mapping: meta=$meta, run_accession=$run_accession, instrument_platform=$instrument_platform, fastq_1=$fastq_1, fastq_2=$fastq_2, fasta=$fasta" + meta.run_accession = run_accession + meta.instrument_platform = instrument_platform - meta.run_accession = run_accession - meta.instrument_platform = instrument_platform + // Define single_end based on the conditions + meta.single_end = ( fastq_1 && !fastq_2 && instrument_platform != 'OXFORD_NANOPORE' ) - // Define single_end based on the conditions - meta.single_end = (fastq_1 && !fastq_2 && instrument_platform != 'OXFORD_NANOPORE') + // Define is_fasta based on the presence of fasta + meta.is_fasta = fasta ? true : false - // Define is_fasta based on the presence of fasta - meta.is_fasta = fasta ? true : false - - if (!meta.is_fasta && !fastq_1) { - error("ERROR: Please check input samplesheet: entry `fastq_1` doesn't exist!") - } - if (meta.instrument_platform == 'OXFORD_NANOPORE' && fastq_2) { - error("Error: Please check input samplesheet: for Oxford Nanopore reads entry `fastq_2` should be empty!") - } - if (meta.single_end && fastq_2) { - error("Error: Please check input samplesheet: for single-end reads entry `fastq_2` should be empty") + if ( !meta.is_fasta && !fastq_1 ) { + error("ERROR: Please check input samplesheet: entry `fastq_1` doesn't exist!") + } + if ( meta.instrument_platform == 'OXFORD_NANOPORE' && fastq_2 ) { + error("Error: Please check input samplesheet: for Oxford Nanopore reads entry `fastq_2` should be empty!") + } + if ( meta.single_end && fastq_2 ) { + error("Error: Please check input samplesheet: for single-end reads entry `fastq_2` should be empty") + } + fastq_se: meta.single_end + return [ meta, [ fastq_1 ] ] + nanopore: instrument_platform == 'OXFORD_NANOPORE' + meta.single_end = true + return [ meta, [ fastq_1 ] ] + fastq_pe: fastq_2 + return [ meta, [ fastq_1, fastq_2 ] ] + ch_fasta: meta.is_fasta + meta.single_end = true + return [ meta, [fasta] ] } - // create fastq_se channel if single_end - fastq_se: meta.single_end - return [meta, [fastq_1]] - // - nanopore: instrument_platform == 'OXFORD_NANOPORE' && meta.single_end - return [meta, [fastq_1]] - fastq_pe: fastq_2 - return [meta, [fastq_1, fastq_2]] - ch_fasta: meta.is_fasta && meta.single_end - return [meta, [fasta]] - } - .set { ch_input } + .set { ch_input } // Merge ch_input.fastq_pe and ch_input.fastq_se into a single channel - def ch_fastq = ch_input.fastq_pe.mix(ch_input.fastq_se) + def ch_fastq = ch_input.fastq_pe.mix( ch_input.fastq_se ) // Merge ch_fastq and ch_input.nanopore into a single channel - def ch_input_for_fastqc = ch_fastq.mix(ch_input.nanopore) + def ch_input_for_fastqc = ch_fastq.mix( ch_input.nanopore ) // Validate and decompress databases ch_dbs_for_untar = databases .branch { db_meta, db_path -> - untar: db_path.name.endsWith(".tar.gz") + untar: db_path.name.endsWith( ".tar.gz" ) skip: true } // Filter the channel to untar only those databases for tools that are selected to be run by the user. ch_input_untar = ch_dbs_for_untar.untar .filter { db_meta, db_path -> - params["run_${db_meta.tool}"] + params[ "run_${db_meta.tool}" ] } - UNTAR (ch_input_untar) + UNTAR ( ch_input_untar ) ch_final_dbs = ch_dbs_for_untar.skip.mix( UNTAR.out.untar ) ch_final_dbs - .map { db_meta, db -> [db_meta.db_params] + .map { db_meta, db -> [ db_meta.db_params ] def corrected_db_params = db_meta.db_params == null ? '' : db_meta.db_params db_meta.db_params = corrected_db_params - [db_meta, db] + [ db_meta, db ] } - ch_versions = ch_versions.mix(UNTAR.out.versions.first()) + ch_versions = ch_versions.mix( UNTAR.out.versions.first() ) /* MODULE: Run FastQC From ff977f64ec8df28998743a24a9b937b8fb5f1652 Mon Sep 17 00:00:00 2001 From: LilyAnderssonLee Date: Tue, 19 Mar 2024 07:54:35 +0100 Subject: [PATCH 2/6] add fallback to download pipeline workflow --- .github/workflows/download_pipeline.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/download_pipeline.yml b/.github/workflows/download_pipeline.yml index 08622fd5..2560d9c4 100644 --- a/.github/workflows/download_pipeline.yml +++ b/.github/workflows/download_pipeline.yml @@ -65,8 +65,18 @@ jobs: - name: Inspect download run: tree ./${{ env.REPOTITLE_LOWERCASE }} - - name: Run the downloaded pipeline + - name: Run the downloaded pipeline (stub) + id: stub_run_pipeline + continue-on-error: true env: NXF_SINGULARITY_CACHEDIR: ./ NXF_SINGULARITY_HOME_MOUNT: true run: nextflow run ./${{ env.REPOTITLE_LOWERCASE }}/$( sed 's/\W/_/g' <<< ${{ env.REPO_BRANCH }}) -stub -profile test,singularity --outdir ./results + + - name: Run the downloaded pipeline (stub run not supported) + id: run_pipeline + if: ${{ job.steps.stub_run_pipeline.status == failure() }} + env: + NXF_SINGULARITY_CACHEDIR: ./ + NXF_SINGULARITY_HOME_MOUNT: true + run: nextflow run ./${{ env.REPOTITLE_LOWERCASE }}/$( sed 's/\W/_/g' <<< ${{ env.REPO_BRANCH }}) -profile test,singularity --outdir ./results{% endraw %} From b89aba67a0dee9936b3a500f9580006dbb3dce9a Mon Sep 17 00:00:00 2001 From: LilyAnderssonLee Date: Tue, 19 Mar 2024 14:18:05 +0100 Subject: [PATCH 3/6] update nf-validation --- workflows/taxprofiler.nf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/workflows/taxprofiler.nf b/workflows/taxprofiler.nf index efc68e7c..34883d65 100644 --- a/workflows/taxprofiler.nf +++ b/workflows/taxprofiler.nf @@ -111,8 +111,8 @@ workflow TAXPROFILER { ch_multiqc_files = Channel.empty() // Validate input files and create separate channels for FASTQ, FASTA, and Nanopore data - samplesheet - .branch { meta, run_accession, instrument_platform, fastq_1, fastq_2, fasta -> + ch_input = samplesheet + .map { meta, run_accession, instrument_platform, fastq_1, fastq_2, fasta -> meta.run_accession = run_accession meta.instrument_platform = instrument_platform @@ -131,6 +131,9 @@ workflow TAXPROFILER { if ( meta.single_end && fastq_2 ) { error("Error: Please check input samplesheet: for single-end reads entry `fastq_2` should be empty") } + return [ meta, run_accession, instrument_platform, fastq_1, fastq_2, fasta ] + } + .branch { meta, run_accession, instrument_platform, fastq_1, fastq_2, fasta -> fastq_se: meta.single_end return [ meta, [ fastq_1 ] ] nanopore: instrument_platform == 'OXFORD_NANOPORE' @@ -140,9 +143,8 @@ workflow TAXPROFILER { return [ meta, [ fastq_1, fastq_2 ] ] ch_fasta: meta.is_fasta meta.single_end = true - return [ meta, [fasta] ] + return [ meta, [ fasta ] ] } - .set { ch_input } // Merge ch_input.fastq_pe and ch_input.fastq_se into a single channel def ch_fastq = ch_input.fastq_pe.mix( ch_input.fastq_se ) From d0a58e28c857c0cf570909d4be467d9dfec59cae Mon Sep 17 00:00:00 2001 From: Lili Andersson-Li <64467552+LilyAnderssonLee@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:22:55 +0100 Subject: [PATCH 4/6] Update workflows/taxprofiler.nf Co-authored-by: James A. Fellows Yates --- workflows/taxprofiler.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflows/taxprofiler.nf b/workflows/taxprofiler.nf index 34883d65..15395157 100644 --- a/workflows/taxprofiler.nf +++ b/workflows/taxprofiler.nf @@ -141,7 +141,7 @@ workflow TAXPROFILER { return [ meta, [ fastq_1 ] ] fastq_pe: fastq_2 return [ meta, [ fastq_1, fastq_2 ] ] - ch_fasta: meta.is_fasta + fasta: meta.is_fasta meta.single_end = true return [ meta, [ fasta ] ] } From dabc2534af7218b03dba1b03b6976efc4334a010 Mon Sep 17 00:00:00 2001 From: Lili Andersson-Li <64467552+LilyAnderssonLee@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:28:07 +0100 Subject: [PATCH 5/6] Update taxprofiler.nf --- workflows/taxprofiler.nf | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/workflows/taxprofiler.nf b/workflows/taxprofiler.nf index 15395157..759120a8 100644 --- a/workflows/taxprofiler.nf +++ b/workflows/taxprofiler.nf @@ -134,22 +134,18 @@ workflow TAXPROFILER { return [ meta, run_accession, instrument_platform, fastq_1, fastq_2, fasta ] } .branch { meta, run_accession, instrument_platform, fastq_1, fastq_2, fasta -> - fastq_se: meta.single_end - return [ meta, [ fastq_1 ] ] + fastq: meta.single_end || fastq_2 + return [ meta, fastq_2 ? [ fastq_1, fastq_2 ] : [ fastq_1 ] ] nanopore: instrument_platform == 'OXFORD_NANOPORE' meta.single_end = true return [ meta, [ fastq_1 ] ] - fastq_pe: fastq_2 - return [ meta, [ fastq_1, fastq_2 ] ] fasta: meta.is_fasta meta.single_end = true return [ meta, [ fasta ] ] } - // Merge ch_input.fastq_pe and ch_input.fastq_se into a single channel - def ch_fastq = ch_input.fastq_pe.mix( ch_input.fastq_se ) - // Merge ch_fastq and ch_input.nanopore into a single channel - def ch_input_for_fastqc = ch_fastq.mix( ch_input.nanopore ) + // Merge ch_input.fastq and ch_input.nanopore into a single channel + def ch_input_for_fastqc = ch_input.fastq.mix( ch_input.nanopore ) // Validate and decompress databases ch_dbs_for_untar = databases @@ -193,10 +189,10 @@ workflow TAXPROFILER { */ if ( params.perform_shortread_qc ) { - ch_shortreads_preprocessed = SHORTREAD_PREPROCESSING ( ch_fastq, adapterlist ).reads + ch_shortreads_preprocessed = SHORTREAD_PREPROCESSING ( ch_input.fastq, adapterlist ).reads ch_versions = ch_versions.mix( SHORTREAD_PREPROCESSING.out.versions ) } else { - ch_shortreads_preprocessed = ch_fastq + ch_shortreads_preprocessed = ch_input.fastq } if ( params.perform_longread_qc ) { @@ -274,13 +270,13 @@ workflow TAXPROFILER { meta, reads -> [ meta, [ reads ].flatten() ] } - .mix( ch_input.ch_fasta ) + .mix( ch_input.fasta ) ch_versions = ch_versions.mix(MERGE_RUNS.out.versions) } else { ch_reads_runmerged = ch_shortreads_hostremoved - .mix( ch_longreads_hostremoved, ch_input.ch_fasta ) + .mix( ch_longreads_hostremoved, ch_input.fasta ) } /* From d5762a73e719e71293e21079c3421075e63b805f Mon Sep 17 00:00:00 2001 From: LilyAnderssonLee Date: Wed, 20 Mar 2024 14:58:11 +0100 Subject: [PATCH 6/6] Disable the save of kaiju2krona txt output --- conf/modules.config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/conf/modules.config b/conf/modules.config index 785459e3..de294fab 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -661,6 +661,10 @@ process { withName: KAIJU_KAIJU2KRONA { tag = {"${meta.db_name}|${meta.id}"} ext.args = '-v -u' + publishDir = [ + path: { "${params.outdir}/kaiju/" }, + enabled : false + ] } withName: DIAMOND_BLASTX {