From f5ded041d84709b5769bc4126bc81f518051c9a6 Mon Sep 17 00:00:00 2001 From: Laurent Modolo <laurent.modolo@ens-lyon.fr> Date: Fri, 8 Oct 2021 10:46:00 +0200 Subject: [PATCH] ucsc: add bedgraph_to_wig.pl script --- src/.docker_modules/ucsc/407/Dockerfile | 3 ++ src/nf_modules/ucsc/main.nf | 49 +++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/.docker_modules/ucsc/407/Dockerfile b/src/.docker_modules/ucsc/407/Dockerfile index 1499bdb1..b0c01263 100644 --- a/src/.docker_modules/ucsc/407/Dockerfile +++ b/src/.docker_modules/ucsc/407/Dockerfile @@ -25,3 +25,6 @@ cd .. &&\ mv userApps/bin/* /usr/bin/ &&\ rm -R userApps.v${UCSC_VERSION}.src.tgz &&\ rm -R userApps + +COPY bedgraph_to_wig.pl /usr/bin/ +RUN chmod +x /usr/bin/bedgraph_to_wig.pl \ No newline at end of file diff --git a/src/nf_modules/ucsc/main.nf b/src/nf_modules/ucsc/main.nf index f193f047..5b203c8e 100644 --- a/src/nf_modules/ucsc/main.nf +++ b/src/nf_modules/ucsc/main.nf @@ -30,3 +30,52 @@ sort -T ./ -k1,1 -k2,2n ${bg} > \ ${bg.simpleName}_norm.bw """ } + + +params.bigwig_to_wig = "" +params.bigwig_to_wig_out = "" +process bigwig_to_wig { + 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(bw) + + output: + tuple val(file_id), path("*.wig"), emit: wig + + script: +""" +bigWigToBedGraph ${bw} ${bw.simpleName}.bg +bedgraph_to_wig.pl --bedgraph ${bw.simpleName}.bg --wig ${bw.simpleName}.wig --step 1 +""" +} + +params.bigwig2_to_wig2 = "" +params.bigwig2_to_wig2_out = "" +process bigwig2_to_wig2 { + 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(bw_a), path(bw_b) + + output: + tuple val(file_id), path("${bw_a.simpleName}.wig"), path("${bw_b.simpleName}.wig"), emit: wig + + script: +""" +bigWigToBedGraph ${bw_a} ${bw_a.simpleName}.bg +bedgraph_to_wig.pl --bedgraph ${bw_a.simpleName}.bg --wig ${bw_a.simpleName}.wig --step 1 +bigWigToBedGraph ${bw_b} ${bw_b.simpleName}.bg +bedgraph_to_wig.pl --bedgraph ${bw_b.simpleName}.bg --wig ${bw_b.simpleName}.wig --step 1 +""" +} \ No newline at end of file -- GitLab