Skip to content
Snippets Groups Projects
Verified Commit 66d36c04 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

uscs: modify wig_to_bedgraph

parent a287ac99
No related branches found
No related tags found
No related merge requests found
......@@ -12,12 +12,13 @@ params.dpos_out = ""
workflow dpos_bam_bg {
take:
fasta
fastq
bam
main:
dpos_bam(fastq, bam)
wig2_to_bedgraph2(dpos_bam.out.wig)
wig2_to_bedgraph2(fasta, dpos_bam.out.wig)
emit:
bedgraph = wig2_to_bedgraph2.out.bedgraph
......@@ -249,10 +250,11 @@ awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$4-1, \$4, "Interval_"NR-1, \$
workflow dpeak_bw {
take:
fasta
fastq
bw
main:
dpeak_wig(fastq, bigwig2_to_wig2(bw))
dpeak_wig(fasta, fastq, bigwig2_to_wig2(bw))
wig2_to_bedgraph2(dpeak_wig.out.wig)
emit:
......@@ -311,6 +313,7 @@ awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$4-1, \$4, "Interval_"NR-1, \$
workflow dpeak_bwvsbw {
take:
fasta
fastq
bw_a
bw_b
......@@ -320,7 +323,7 @@ workflow dpeak_bwvsbw {
bigwig2_to_wig2(bw_a),
bigwig2_to_wig2(bw_b),
)
wig2_to_bedgraph2(dpeak_wigvswig.out.wig)
wig2_to_bedgraph2(fasta, dpeak_wigvswig.out.wig)
emit:
bedgraph = wig2_to_bedgraph2.out.bedgraph
......
......@@ -37,46 +37,80 @@ sort -T ./ -k1,1 -k2,2n ${bg} > \
params.wig_to_bedgraph = ""
params.wig_to_bedgraph_out = ""
process wig_to_bedgraph {
workflow wig_to_bedgraph {
take:
fasta
wig
main:
wig_to_bigwig(
fasta,
wig
)
wig_to_bedgraph(
wig_to_bigwig.out.bw
)
emit:
bg = wig_to_bigwig.out.bg
}
workflow wig2_to_bedgraph2 {
take:
fasta
wig
main:
wig2_to_bigwig2(
fasta,
wig
)
wig2_to_bedgraph2(
wig2_to_bigwig2.out.bw
)
emit:
bg = wig2_to_bigwig2.out.bg
}
params.bigwig_to_bedgraph = ""
params.bigwig_to_bedgraph_out = ""
process bigwig_to_bedgraph {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${file_id}"
if (params.wig_to_bedgraph_out != "") {
publishDir "results/${params.wig_to_bedgraph_out}", mode: 'copy'
if (params.bigwig_to_bedgraph_out != "") {
publishDir "results/${params.bigwig_to_bedgraph_out}", mode: 'copy'
}
input:
tuple val(file_id), path(wig)
tuple val(file_id) path(bw)
output:
tuple val(file_id), path("${wig.simpleName}.bg"), emit: bedgraph
tuple val(file_id), path("*.bg"), emit: bg
script:
"""
awk '{print \$1"\\t"\$2-1"\\t"\$2"\\t"\$3}' ${wig} > ${wig.simpleName}.bg
bigWigToBedGraph ${bw} ${bw.simpleName}.bg
"""
}
params.wig2_to_bedgraph2 = ""
params.wig2_to_bedgraph2_out = ""
process wig2_to_bedgraph2 {
params.bigwig2_to_bedgraph2 = ""
params.bigwig2_to_bedgraph2_out = ""
process bigwig2_to_bedgraph2 {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${file_id}"
if (params.wig2_to_bedgraph2_out != "") {
publishDir "results/${params.wig2_to_bedgraph2_out}", mode: 'copy'
if (params.bigwig_to_bedgraph_out != "") {
publishDir "results/${params.bigwig_to_bedgraph_out}", mode: 'copy'
}
input:
tuple val(file_id), path(wig_a), path(wig_b)
tuple val(file_id), path(bw_a), path(bw_b)
output:
tuple val(file_id), path("${wig_a.simpleName}.bg"), path("${wig_b.simpleName}.bg"), emit: bedgraph
tuple val(file_id), path("${bw_a.simpleName}.bg"), path("${bw_b.simpleName}.bg"), emit: bg
script:
"""
awk '{print \$1"\\t"\$2-1"\\t"\$2"\\t"\$3}' ${wig_a} > ${wig_a.simpleName}.bg
awk '{print \$1"\\t"\$2-1"\\t"\$2"\\t"\$3}' ${wig_b} > ${wig_b.simpleName}.bg
bigWigToBedGraph ${bw_a} ${bw_a.simpleName}.bg
bigWigToBedGraph ${bw_b} ${bw_b.simpleName}.bg
"""
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment