This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bed to BedGraph

I am a bit confused.

Would you please guide me. I want to use DaPars. It need a BedGraph file as input.

I have searched and understand it is possible to covert bed to bedgraph! But how the coverage could be defined then? In DaPars the coverage in needed to find if there is any alternative polyadenylation.

rna-seq dapars bedgraph bed

Two easy ways to make Bedgraph from BED input with common Unix tools are with cut

$ cut -f1-3,5 foo.bed > foo.bedgraph

And with awk:

$ awk '{ print $1"\t"$2"\t"$3"\t"$5 }' foo.bed > foo.bedgraph

Thanks a lot, would you please let me know how to convert wig to BedGraph?

You can use wig2bed:

$ wig2bed < foo.wig | cut -f1-3,5 > foo.bedgraph

Thanks, I got this error wig2bed: line 156: convert2bed: command not found

Install all the binaries into one place available from your path, like /usr/local/bin etc.

Of course I did it but I still face this error

1 answer

How to generate BedGraph from BedTools Coverage? might be a good place to start looking.

Essentially you can use bedtools genome coverage tool to find coverage in your bed file and then output the format as a bedGraph using the -bg parameter.

Log in to answer this question.