From aa7d2c97e8afb8d5abbecae782f4ec2d00e00ca1 Mon Sep 17 00:00:00 2001 From: jsabban <jules.sabban@inrae.fr> Date: Wed, 4 Dec 2024 10:10:39 +0100 Subject: [PATCH 1/5] Remove techno arg in Analysis creation Ref: #133 --- conf/base.config | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/conf/base.config b/conf/base.config index 74e388b..0ce330c 100644 --- a/conf/base.config +++ b/conf/base.config @@ -256,9 +256,7 @@ process { //========================================= process { withName: CREATE_ANALYSIS { - def techno = params.sequencer =~ "MiSeq|NovaSeq" ? 'illumina' : params.sequencer =~ "AVITI" ? 'elembio' : 'other' - ext.args = "--techno $techno " - ext.args += params.project_hash ? "--projectDir '${params.project}-${params.project_hash}'" : '' + ext.args = params.project_hash ? "--projectDir '${params.project}-${params.project_hash}'" : '' } withName: CREATE_READSETS { -- GitLab From df85a4b431f405aeeb4e5d11a0300e9faeca3b7f Mon Sep 17 00:00:00 2001 From: jsabban <jules.sabban@inrae.fr> Date: Wed, 4 Dec 2024 10:11:16 +0100 Subject: [PATCH 2/5] Little changes in shared_modules/lib/utils.groovy Ref: #132 --- lib/pipeline.groovy | 80 ++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/lib/pipeline.groovy b/lib/pipeline.groovy index d4de1f5..caaf64c 100644 --- a/lib/pipeline.groovy +++ b/lib/pipeline.groovy @@ -28,19 +28,7 @@ pipeline_group = pipeline_info[0] pipeline_project = pipeline_info[1] pipeline_techno = pipeline_project.split('-')[1] -if (params.email == null) { - email_main = params.email_bioinfo -} else { - email_main = params.email -} - -emails_map = [ - main: email_main, - bioinfo: params.email_bioinfo, - labo: params.email_labo, - failure: params.email_on_fail, - dev: params.email_dev -] +emails_map = create_email_map() pipeline_options_map = [ inputdir: [default: '', optional: false, help: 'Path to the input directory [demultiplexing output directory]'], @@ -132,6 +120,35 @@ begin_email_fields = get_workflow_info( // ---------------------------------- // Functions Definition // ---------------------------------- +def create_email_map() { + def hash = [:] + + def email_main = '' + def email_bioinfo = '' + def email_labo = '' + def email_failure = '' + + email_main = params.email ?: params.email_bioinfo?: '' + email_bioinfo = params.email_bioinfo ?: '' + email_labo = params.email_labo ?: '' + email_failure = params.email_on_fail ?: '' + + if (params.is_dev_mode) { + email_main = params.email_dev + email_bioinfo = email_main + email_labo = email_main + email_failure = email_main + log.info "DEV mode activated : overwriting every email adresses to $email_main" + } + + hash.main = email_main + hash.bioinfo = email_bioinfo + hash.labo = email_labo + hash.failure = email_failure + + return hash +} + def create_final_email_fields(formatted_date, summary) { return get_workflow_info( [ @@ -160,28 +177,19 @@ def create_error_email_fields(formatted_date) { def endOfPipelineEvents(summary) { SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss") end_mail_sent = false - - def email_address = emails_map.main - def email_cc = emails_map.bioinfo - - if (emails_map.main && emails_map.failure && !workflow.success) { - email_address = emails_map.failure - email_cc = '' - } - log.debug "IS DEV MODE ? $params.is_dev_mode" - if (params.is_dev_mode) { - email_address = emails_map.dev - email_cc = '' - } - + workflow.onComplete { + emails_map = create_email_map() + if (emails_map.main && emails_map.failure && !workflow.success) { + emails_map.main = emails_map.failure + } log.info "Sending final e-mail" template_final = "$baseDir/assets/final_email_template.txt" final_email_fields = create_final_email_fields(format.format(new Date()), summary) - end_mail_sent = sendFinalMail(template_final, final_email_fields, email_address, email_cc, end_mail_sent) + end_mail_sent = sendFinalMail(template_final, final_email_fields, emails_map, end_mail_sent) //email_address, email_cc // remove work directory if pipeline is successful - if (workflow.success) { + if (workflow.success && !params.sequencer.equalsIgnoreCase('AVITI')) { if (!workflow.profile.contains('dev') ) { println "Pipeline terminé avec succès => suppression du workdir : $workflow.workDir" exec: @@ -202,16 +210,23 @@ def endOfPipelineEvents(summary) { } workflow.onError { + emails_map = create_email_map() + if (emails_map.main && emails_map.failure && !workflow.success) { + emails_map.main = emails_map.failure + } error_email_fields = create_error_email_fields(format.format(new Date())) template_error = "$baseDir/assets/error_email_template.txt" log.info "Sending error e-mail" - end_mail_sent = sendFinalMail(template_error, error_email_fields, email_address, email_cc, end_mail_sent) + end_mail_sent = sendFinalMail(template_error, error_email_fields, emails_map, end_mail_sent) } } def getSummary() { SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss") - return createSummary(format.format(new Date())) + def summary = createSummary(format.format(new Date())) + summary['Sequencing Type'] = params.is_multiplex ? 'Multiplex' : 'Simplex' + summary['Reference'] = params.reference_genome ?: params.reference_transcriptome?: '' + return summary } // ---------------------------------- @@ -236,8 +251,7 @@ if (paramsValidation(pipeline_options_map)) { // true s'il manque 1 param customMailSend( "$baseDir/assets/begin_template.txt", begin_email_fields, - emails_map.main, - "${emails_map.labo},${emails_map.bioinfo}", + emails_map, !workflow.resume, false ) -- GitLab From bd50ec1fbe5c1f2836680f8f01e33d85075a62c2 Mon Sep 17 00:00:00 2001 From: jsabban <jules.sabban@inrae.fr> Date: Wed, 4 Dec 2024 15:03:31 +0100 Subject: [PATCH 3/5] bad if on workflow.success in lib/pipepline.groovy --- lib/pipeline.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pipeline.groovy b/lib/pipeline.groovy index caaf64c..e785788 100644 --- a/lib/pipeline.groovy +++ b/lib/pipeline.groovy @@ -189,11 +189,11 @@ def endOfPipelineEvents(summary) { end_mail_sent = sendFinalMail(template_final, final_email_fields, emails_map, end_mail_sent) //email_address, email_cc // remove work directory if pipeline is successful - if (workflow.success && !params.sequencer.equalsIgnoreCase('AVITI')) { - if (!workflow.profile.contains('dev') ) { - println "Pipeline terminé avec succès => suppression du workdir : $workflow.workDir" - exec: - workflow.workDir.deleteDir() + if (workflow.success) { + if (!workflow.profile.contains('dev') && !params.sequencer.equalsIgnoreCase('AVITI')) { + println "Pipeline terminé avec succès => suppression du workdir : $workflow.workDir" + exec: + workflow.workDir.deleteDir() } if (workflow.stats.ignoredCount > 0) { -- GitLab From 28d173e996c7a6bd9f10096355550e248c796259 Mon Sep 17 00:00:00 2001 From: jsabban <jules.sabban@inrae.fr> Date: Wed, 4 Dec 2024 15:05:10 +0100 Subject: [PATCH 4/5] Add NGSRG treatment for elembio Ref: #130 --- modules/local/module_NGL-Bi.nf | 28 +++++++++++++++++++++++++++- sub-workflows/local/ngl.nf | 7 +++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/modules/local/module_NGL-Bi.nf b/modules/local/module_NGL-Bi.nf index dd2aeb8..59f2360 100644 --- a/modules/local/module_NGL-Bi.nf +++ b/modules/local/module_NGL-Bi.nf @@ -72,7 +72,7 @@ process FILE_RENAME { """ } -process NGSRG { +process NGSRG_ILLUMINA { label 'ngl' input: @@ -94,4 +94,30 @@ process NGSRG { 1> treatment_ngsrg_${level}.log """ +} + +process NGSRG_ELEMBIO { + label 'ngl' + + input: + path nglFile + path demuxDirectory + val lane + val level + + output: + path("*.log"), emit: log + + script: + def args = task.ext.args ?: '' + """ + perl ${params.ngl_bi_client}/GeT/perl/elemBio/createNGL-BiTreatmentNGSRG.pl \\ + --objectFile $nglFile \\ + --pathdemuxRunStatsFile $demuxDirectory/RunStats.json \\ + --pathdemuxRunParametersFile $demuxDirectory/RunParameters.json \\ + --laneNumberToWorkOn $lane \\ + --level $level \\ + $args \\ + 1> treatment_ngsrg_${level}_${lane}.log + """ } \ No newline at end of file diff --git a/sub-workflows/local/ngl.nf b/sub-workflows/local/ngl.nf index 6a22fbf..20ebc14 100644 --- a/sub-workflows/local/ngl.nf +++ b/sub-workflows/local/ngl.nf @@ -21,7 +21,8 @@ include { UPDATE_NGLBI_STATE_FROM_FILE as UPDATE_STATE_FQC; include { FILE_RENAME as RENAME_FASTQ; FILE_RENAME as RENAME_INDEX; - NGSRG as NGSRG_READSET; } from "$baseDir/modules/local/module_NGL-Bi.nf" + NGSRG_ILLUMINA; + NGSRG_ELEMBIO; } from "$baseDir/modules/local/module_NGL-Bi.nf" // ------------------------------------------------- // WORKFLOW // ------------------------------------------------- @@ -48,7 +49,9 @@ workflow NGL { ready = BEGIN.out.ready if(sequencer_name =~ "NovaSeq|MiSeq") { - NGSRG_READSET(readsets_created, demux_stat_json, 'readsets') + NGSRG_ILLUMINA(readsets_created, demux_stat_json, 'readsets') + } else if (sequencer_name =~ "AVITI") { + NGSRG_ELEMBIO(readsets_created, params.inputdir, params.lane, 'readsets') } bi_run_code = nglBiRunCode.collect().map { it.toString() } -- GitLab From 8c1ba5df616a22a667b68bc4daac8ec52a95f0ef Mon Sep 17 00:00:00 2001 From: jsabban <jules.sabban@inrae.fr> Date: Wed, 4 Dec 2024 15:16:20 +0100 Subject: [PATCH 5/5] Add analysis name Ref: #134 --- sub-workflows/local/ngl.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sub-workflows/local/ngl.nf b/sub-workflows/local/ngl.nf index 20ebc14..34a1f01 100644 --- a/sub-workflows/local/ngl.nf +++ b/sub-workflows/local/ngl.nf @@ -80,7 +80,7 @@ workflow NGL { project_hash, fq, MD5SUM_FASTQ.out.md5sum, - techno + params.run_name ) emit: -- GitLab