From 7622abdd745c3f2f6e882e2d6fba5a6ce7c1f812 Mon Sep 17 00:00:00 2001 From: Joon-Klaps Date: Thu, 28 Sep 2023 11:49:09 +0200 Subject: [PATCH] catching quast error --- conf/modules.config | 18 ++++++++++++++---- subworkflows/local/fasta_contig_filtering.nf | 4 ++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/conf/modules.config b/conf/modules.config index 5e616530..dcf825b5 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -134,15 +134,25 @@ process { ] } - - withName: ".*:UNPACK_DB.*" { + if (params.kaiju_db || params.kraken2_db || params.checkv_db || params.blast_db) { + withName: ".*:UNPACK_DB.*:GUNZIP" { publishDir = [ path: { "${params.outdir}/databases/" }, mode: params.publish_dir_mode, enabled: params.save_databases ] + } + + withName: ".*:UNPACK_DB.*:UNTAR" { + publishDir = [ + path: { "${params.outdir}/databases/" }, + mode: params.publish_dir_mode, + enabled: params.save_databases + ] + } } + // // Taxonomic classification // @@ -219,7 +229,7 @@ process { withName: TRINITY { cpus = { check_max( 12 * task.attempt, 'cpus' ) } // defeault was 1 - errorStrategy = { task.exitStatus == 2 ? 'ignore' : 'retry' } // can fail with very few reads + errorStrategy = { task.exitStatus in [1,2] ? 'ignore' : 'retry' } // can fail with very few reads ext.args = "--min_contig_length ${params.min_contig_size} --NO_SEQTK" publishDir = [ path: { "${params.outdir}/assembly/assemblers/trinity/" }, @@ -905,7 +915,7 @@ process { withName: QUAST { ext.args = "--min-contig 0" - errorStrategy = { task.exitStatus == 4 ? 'ignore' : 'terminate' } // can fail if no contigs are present + errorStrategy = { task.exitStatus == 4 ? 'ignore' : 'retry' } // can fail if no contigs are present publishDir = [ path: { "${params.outdir}/consensus_qc/quast/" }, mode: params.publish_dir_mode, diff --git a/subworkflows/local/fasta_contig_filtering.nf b/subworkflows/local/fasta_contig_filtering.nf index c4f94740..aac73282 100644 --- a/subworkflows/local/fasta_contig_filtering.nf +++ b/subworkflows/local/fasta_contig_filtering.nf @@ -7,12 +7,12 @@ include { QUAST } from '../../modules/nf-core/quast/main' // Function to extract the contig size & N' per 100 kbp from the QUAST report def getQuastStats(report_file) { def contig_size = 0 - def n_100 = 0 + def n_100 = 100000 // assume the worst report_file.eachLine { line -> def contig_size_match = line =~ /Largest contig\s([\d]+)/ def n_100_match = line =~ /N's per 100 kbp\s([\d\.]+)/ if (contig_size_match) contig_size = contig_size_match[0][1].toFloat() - if (n_100) n_100 = n_100_match[0][1].toFloat() + if (n_100_match) n_100 = n_100_match[0][1].toFloat() } return [contig_size : contig_size, n_100 : n_100] }