From 47eba2c496b8c0406fbfd1da798531e8e8a3388f Mon Sep 17 00:00:00 2001
From: Laurent Modolo <laurent.modolo@ens-lyon.fr>
Date: Fri, 8 Oct 2021 14:48:21 +0200
Subject: [PATCH] ucsc: add wigtobigwig convertion

---
 src/nf_modules/ucsc/main.nf | 45 +++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/src/nf_modules/ucsc/main.nf b/src/nf_modules/ucsc/main.nf
index 6e0c016d..e3076ebd 100644
--- a/src/nf_modules/ucsc/main.nf
+++ b/src/nf_modules/ucsc/main.nf
@@ -78,4 +78,49 @@ bedgraph_to_wig.pl --bedgraph ${bw_a.simpleName}.bg --wig ${bw_a.simpleName}.wig
 bigWigToBedGraph ${bw_b} ${bw_b.simpleName}.bg
 bedgraph_to_wig.pl --bedgraph ${bw_b.simpleName}.bg --wig ${bw_b.simpleName}.wig --step 10
 """
+}
+
+params.wig_to_bigwig = ""
+params.wig_to_bigwig_out = ""
+process wig_to_bigwig {
+  container = "${container_url}"
+  label "big_mem_mono_cpus"
+  tag "${file_id}"
+  if (params.bigwig_to_wig_out != "") {
+    publishDir "results/${params.bigwig_to_wig_out}", mode: 'copy'
+  }
+
+  input:
+  tuple val(file_id), path(w)
+
+  output:
+  tuple val(file_id), path("${bw.simpleName}.bw"), emit: bw
+
+  script:
+"""
+wigToBigWig ${w} ${w.simpleName}.bw
+"""
+}
+
+params.wig2_to_bigwig2 = ""
+params.wig2_to_bigwig2_out = ""
+process wig2_to_bigwig2 {
+  container = "${container_url}"
+  label "big_mem_mono_cpus"
+  tag "${file_id}"
+  if (params.bigwig_to_wig_out != "") {
+    publishDir "results/${params.bigwig_to_wig_out}", mode: 'copy'
+  }
+
+  input:
+  tuple val(file_id), path(w_a), path(w_b)
+
+  output:
+  tuple val(file_id), path("${bw_a.simpleName}.bw"), path("${bw_b.simpleName}.bw"), emit: bw
+
+  script:
+"""
+wigToBigWig ${w_a} ${w_a.simpleName}.bw
+wigToBigWig ${w_b} ${w_b.simpleName}.bw
+"""
 }
\ No newline at end of file
-- 
GitLab