From 06e54f906b6928edc64be443488c65892498d0a9 Mon Sep 17 00:00:00 2001
From: Mia Croiset <mia.croiset@ens-lyon.fr>
Date: Tue, 24 Oct 2023 09:40:35 +0200
Subject: [PATCH] try skip param validation for bin_size

---
 lib/WorkflowHic.groovy |  9 +++++++++
 workflows/hic.nf       | 24 +++++++++++++++++-------
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/lib/WorkflowHic.groovy b/lib/WorkflowHic.groovy
index 3dea732..0152384 100755
--- a/lib/WorkflowHic.groovy
+++ b/lib/WorkflowHic.groovy
@@ -18,6 +18,15 @@ class WorkflowHic {
             System.exit(1)
         }
 
+        if (params.bin_size instanceof Integer){
+            //skip
+            println("bin_size is int")
+        }
+
+        if (params.res_zoomify instanceof Integer){
+            //skip
+            println("res_zoomify is int")
+        }
         // Check Digestion or DNase Hi-C mode
         //if (!params.dnase && !params.ligation_site) {
         //  log.error "Ligation motif not found. Please either use the `--digestion` parameters or specify the `--restriction_site` and `--ligation_site`. For DNase Hi-C, please use '--dnase' option"
diff --git a/workflows/hic.nf b/workflows/hic.nf
index faa6a59..5c45e54 100644
--- a/workflows/hic.nf
+++ b/workflows/hic.nf
@@ -38,9 +38,19 @@ if (params.digestion){
 //****************************************
 // Combine all maps resolution for downstream analysis
 
-ch_map_res = Channel.from( params.bin_size ).splitCsv().flatten().toInteger()
+if (params.bin_size instanceof Integer) {
+    ch_map_res = Channel.from( params.bin_size ).toInteger()
+}
+else {
+    ch_map_res = Channel.from( params.bin_size ).splitCsv().flatten().toInteger()
+}
 
-if (params.res_zoomify){
+
+if (params.res_zoomify instanceof Integer){
+  ch_zoom_res = Channel.from( params.res_zoomify ).splitCsv().flatten().toInteger()
+  ch_map_res = ch_map_res.concat(ch_zoom_res)
+}
+else{
   ch_zoom_res = Channel.from( params.res_zoomify ).splitCsv().flatten().toInteger()
   ch_map_res = ch_map_res.concat(ch_zoom_res)
 }
@@ -51,7 +61,7 @@ if (params.res_tads && !params.skip_tads){
 }else{
   ch_tads_res=Channel.empty()
   if (!params.skip_tads){
-    log.warn "[nf-core/hic] Hi-C resolution for TADs calling not specified. See --res_tads" 
+    log.warn "[nf-core/hic] Hi-C resolution for TADs calling not specified. See --res_tads"
   }
 }
 
@@ -61,7 +71,7 @@ if (params.res_dist_decay && !params.skip_dist_decay){
 }else{
   ch_ddecay_res = Channel.empty()
   if (!params.skip_dist_decay){
-    log.warn "[nf-core/hic] Hi-C resolution for distance decay not specified. See --res_dist_decay" 
+    log.warn "[nf-core/hic] Hi-C resolution for distance decay not specified. See --res_dist_decay"
   }
 }
 
@@ -71,7 +81,7 @@ if (params.res_compartments && !params.skip_compartments){
 }else{
   ch_comp_res = Channel.empty()
   if (!params.skip_compartments){
-    log.warn "[nf-core/hic] Hi-C resolution for compartment calling not specified. See --res_compartments" 
+    log.warn "[nf-core/hic] Hi-C resolution for compartment calling not specified. See --res_compartments"
   }
 }
 
@@ -96,7 +106,7 @@ ch_multiqc_custom_methods_description = params.multiqc_methods_description ? fil
 //
 // MODULE: Local to the pipeline
 //
-include { HIC_PLOT_DIST_VS_COUNTS } from '../modules/local/hicexplorer/hicPlotDistVsCounts' 
+include { HIC_PLOT_DIST_VS_COUNTS } from '../modules/local/hicexplorer/hicPlotDistVsCounts'
 include { MULTIQC } from '../modules/local/multiqc'
 
 //
@@ -236,7 +246,7 @@ workflow HIC {
       .filter{ it[0].resolution == it[2] }
       .map { it -> [it[0], it[1]]}
       .set{ ch_cool_tads }
-                                                                                                                                                                                                            
+
     TADS(
       ch_cool_tads
     )
-- 
GitLab