From 5533b5b124d734311c004012e8a1151a3ae0737f Mon Sep 17 00:00:00 2001
From: jsabban <jules.sabban@inrae.fr>
Date: Wed, 15 May 2024 11:04:02 +0200
Subject: [PATCH 1/4] Hot fix for ngl-bi run creation

	- And create again the RunNGL-Bi.created file if needed

	Ref: #93
---
 sub-workflows/local/begin_nglbi.nf | 24 +++++++++++++++---------
 workflow/illumina_qc.nf            |  2 +-
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/sub-workflows/local/begin_nglbi.nf b/sub-workflows/local/begin_nglbi.nf
index c565408..2e60dd9 100644
--- a/sub-workflows/local/begin_nglbi.nf
+++ b/sub-workflows/local/begin_nglbi.nf
@@ -13,8 +13,8 @@
 // -------------------------------------------------
 
 include {	CREATE_RUN;
-            UPDATE_NGLBI_STATE_FROM_CODE as UPDATE_STATE_FS;
-			UPDATE_NGLBI_STATE_FROM_CODE as UPDATE_STATE_IPRG;
+            UPDATE_NGLBI_STATE_FROM_FILE as UPDATE_STATE_FS;
+			UPDATE_NGLBI_STATE_FROM_FILE as UPDATE_STATE_IPRG;
 			UPDATE_NGLBI_STATE_FROM_FILE as UPDATE_STATE_FRG;
             UPDATE_NGLBI_STATE_FROM_FILE as UPDATE_STATE_IPQC;
 			CREATE_READSETS;
@@ -36,22 +36,27 @@ workflow NGLBI {
         if (params.bi_run_code == '') {
 
             CREATE_RUN(params.sequencer, params.sq_xp_code, '', 1)
-
-            bi_run_code = CREATE_RUN.out.createdFile.splitText().map{it -> it.trim()}
+            createdFile = CREATE_RUN.out.createdFile
+            nglBiRunCode = CREATE_RUN.out.nglBiRunCode
             ready_for_state = CREATE_RUN.out.ready
         } else {
             ready_for_state = Channel.value(1)
-            bi_run_code = Channel.value(params.bi_run_code)
+            createdFile  = Channel.of(params.bi_run_code).map { content ->
+                def file = file('RunNGL-Bi.created')
+                file.text = content
+                file
+            }
+            nglBiRunCode = params.bi_run_code
         }
 
         // Update run state
-		UPDATE_STATE_FS(bi_run_code, 'F-S', ready_for_state)
-		UPDATE_STATE_IPRG(bi_run_code, 'IP-RG', UPDATE_STATE_FS.out.ready)
+		UPDATE_STATE_FS(createdFile, 'F-S', ready_for_state)
+		UPDATE_STATE_IPRG(createdFile, 'IP-RG', UPDATE_STATE_FS.out.ready)
 
         // Creation of ReadSets
 		CREATE_READSETS(
 			params.sq_xp_code,
-			bi_run_code,
+			nglBiRunCode,
 			'',
 			'',
 			UPDATE_STATE_IPRG.out.ready
@@ -64,7 +69,8 @@ workflow NGLBI {
     emit:
         ready = UPDATE_STATE_IPQC.out.ready
 		readsetsFile = CREATE_READSETS.out.createdFile
-        runFile = CREATE_RUN.out.createdFile
+        createdFile = createdFile
+        nglBiRunCode = nglBiRunCode
 }
 
 
diff --git a/workflow/illumina_qc.nf b/workflow/illumina_qc.nf
index eb75e22..7500b06 100644
--- a/workflow/illumina_qc.nf
+++ b/workflow/illumina_qc.nf
@@ -103,7 +103,7 @@ workflow ILLUMINA_QC {
 
 		if (params.insert_to_ngl){
 			// Add demultiplexStat treatments
-			TREATMENT_DEMUX_RUN(NGLBI.out.runFile, CORE_ILLUMINA.out.demuxStat)
+			TREATMENT_DEMUX_RUN(NGLBI.out.nglBiRunCode, CORE_ILLUMINA.out.demuxStat)
 			TREATMENT_DEMUX_READSETS(NGLBI.out.readsetsFile, CORE_ILLUMINA.out.demuxStat)
 		}
 	}
-- 
GitLab


From 6bbdee75ba0e318385b0815365f0a30a7521d2b6 Mon Sep 17 00:00:00 2001
From: jsabban <jules.sabban@inrae.fr>
Date: Wed, 15 May 2024 11:08:10 +0200
Subject: [PATCH 2/4] Cast resource_factor to integer instead of decimal

	Re: #94
---
 conf/base.config | 5 +----
 nextflow.config  | 5 ++++-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/conf/base.config b/conf/base.config
index f6ad4e7..5206416 100644
--- a/conf/base.config
+++ b/conf/base.config
@@ -130,10 +130,7 @@ process {
 
 		publishDir = [
 			path: "${params.outdir}/alignment/bwa",
-			mode: {
-				if (params.DTM_mode) 'symlink'
-				else 'copy'
-			}
+			mode: 'copy'
 		]
 	}
 
diff --git a/nextflow.config b/nextflow.config
index ea9a9d0..d4fa10e 100644
--- a/nextflow.config
+++ b/nextflow.config
@@ -32,6 +32,9 @@ params {
 	miseq_subset_seq = "50000"								// in reads must be a string
 	nova_subset_seq = "50000000"							// in reads 
 	large_indexing_nova_subset_seq = "500000"				// in reads
+	coverage = 0											// coverage in X
+	len_r1 = 150
+	len_r2 = 150
 
 	// DNA / RNA params
 	reference_genome = ""
@@ -99,7 +102,7 @@ def n_read_files = Files.walk(Paths.get(params.inputdir.toString()))
 // on retire les 2 fichiers undetermined
 def n_samples = ( n_read_files - 2 ) / 2 	
 System.out.println "\nNombre d'échantillons trouvés sur cette lane : $n_samples"
-params.resource_factor = 0.1 * n_samples
+params.resource_factor = java.lang.Math.round(0.1 * n_samples)
 
 import java.text.SimpleDateFormat
 SimpleDateFormat uniqueness_format = new SimpleDateFormat("yyyyMMddHHmmss")
-- 
GitLab


From 0abfd1079cc042dc41580c19f116d4f247703d8e Mon Sep 17 00:00:00 2001
From: jsabban <jules.sabban@inrae.fr>
Date: Wed, 15 May 2024 11:12:20 +0200
Subject: [PATCH 3/4] Add NGL codes in emails and MultiQC

	- Only if exists, of course

	Ref: #95
---
 assets/begin_template.txt       | 3 ++-
 assets/final_email_template.txt | 2 ++
 conf/functions.config           | 4 ++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/assets/begin_template.txt b/assets/begin_template.txt
index 1dd968d..69415f3 100644
--- a/assets/begin_template.txt
+++ b/assets/begin_template.txt
@@ -18,7 +18,8 @@ The analysis of the following sequencing is running :
 - FlowCell : $flowcell
 - Lane : $lane
 - Directory : $directory
-
+<% if (xpNGLSq){ out << "- NGL-SQ Experiment : $xpNGLSq " } %>
+<% if (runNGLBi){ out << "- NGL-Bi RunCode : $runNGLBi " } %>
 
 The command used to launch the workflow was as follows :
 
diff --git a/assets/final_email_template.txt b/assets/final_email_template.txt
index 5221db8..64f89de 100644
--- a/assets/final_email_template.txt
+++ b/assets/final_email_template.txt
@@ -9,6 +9,8 @@
 NextFlow Run Name : $runName
 Project : $project
 Run : $run
+<% if (xpNGLSq){ out << "NGL-SQ Experiment : $xpNGLSq " } %>
+<% if (runNGLBi){out << "NGL-Bi RunCode : $runNGLBi" } %>
 
 <% if (success){
     out << """## GeT-nextflow-NGL-Bi/wf-Illumina-nf execution completed successfully! ##
diff --git a/conf/functions.config b/conf/functions.config
index 2099a7a..9be15ad 100644
--- a/conf/functions.config
+++ b/conf/functions.config
@@ -106,6 +106,8 @@ def sendBeginMail(formatted_date) {
     begin_email_fields['version'] = workflow.manifest.version
     begin_email_fields['wfRunName'] = workflow.runName
     begin_email_fields['run_name'] = params.run_name
+    begin_email_fields['runNGLBi'] = (params.bi_run_code ?: '')
+    begin_email_fields['xpNGLSq'] = (params.sq_xp_code ?: '')
     begin_email_fields['project'] = params.project
     begin_email_fields['sequencer'] = params.sequencer
     begin_email_fields['flowcell'] = params.fc_id
@@ -148,6 +150,8 @@ def sendFinalMail(formatted_date, summary) {
 	email_fields['runName'] = workflow.runName
 	email_fields['project'] = params.project
     email_fields['run'] = params.run_name
+    email_fields['runNGLBi'] = (params.bi_run_code ?: '')
+    email_fields['xpNGLSq'] = (params.sq_xp_code ?: '')
 	email_fields['success'] = workflow.success
 	email_fields['dateComplete'] = formatted_date
 	email_fields['duration'] = workflow.duration
-- 
GitLab


From 46d9a035248c3d167636ae4e81fbf6df5e7f21cc Mon Sep 17 00:00:00 2001
From: jsabban <jules.sabban@inrae.fr>
Date: Wed, 15 May 2024 11:16:31 +0200
Subject: [PATCH 4/4] Update shared_modules path in dev mode

---
 conf/report.config | 2 +-
 conf/test.config   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/conf/report.config b/conf/report.config
index 11866bf..af1fc52 100644
--- a/conf/report.config
+++ b/conf/report.config
@@ -29,5 +29,5 @@ manifest {
 	description = "Workflow for Illumina data quality control"
 	mainScript = 'main.nf'
 	nextflowVersion = '>=0.32.0'
-	version = '1.16.1'
+	version = '1.17.0'
 }
\ No newline at end of file
diff --git a/conf/test.config b/conf/test.config
index c6d32e9..4294ca1 100644
--- a/conf/test.config
+++ b/conf/test.config
@@ -4,7 +4,7 @@
 System.out.println "Profil dev => on ajuste les paramètres..."
 params {
 	ngl_bi_client = '/work/project/PlaGe/test/jules/VisualStudioSources/ngl-bi_client/'
-	shared_modules = '/save/user/sbsuser/scripts-ngs/shared_modules_Current/'
+	shared_modules = '/work/project/PlaGe/test/jules/VisualStudioSources/shared_modules/'
 	is_dev_mode = true
 }
 
-- 
GitLab