This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to plot the output of bedtools genomecov as a histogram using gnuplot?

I have genomecov output as

chr1 0 145821816 195123441 0.747331

chr1 1 28676143 195123441 0.146964

chr1 2 6883876 195123441 0.0352796

chr1 3 3340282 195123441 0.0171188

chr1 4 2296338 195123441 0.0117686

chr1 5 1775261 195123441 0.00909814

chr1 6 1423228 195123441 0.00729399

I would like to plot the output as a histogram preferably in gnuplot. How can I do that? Thanks a lot,

genomecov histogram gnuplot

1 answer

if that data is in a file you could do

plot'FILE' u (($3+$4)/2.):5:(($4-$3/2.)) w boxes

the location of the box is (($3+$4)/2.)

the width of the box is ($4-$3)/2

the height of the box is from the 5th column of your file.

if you have large files this will be slow.

cheers

Log in to answer this question.