I have a simple BED file displays repetitive elements localization (this file was obtained using RepeatMasker).
Here are the first few rows::
2L 840 882 Simple_repeat
2L 2763 2796 Simple_repeat
2L 3409 3498 DNA/Helitron
2L 5405 5432 Simple_repeat
2L 8844 9132 LINE/unknown
Now, I would like to create a BedGraph file that displays the coverage of repetitive elements per selected bin. Let's assume the bin size is 3000. The desired file should look like this::
2L 1 3001 0.025
2L 3001 6001 0.0387
where 0.025 is calculated as ((882-840)+(2796-2763))/3000.
I can write a Python code to accomplish this, but I believe there might be ready-made tools available for this task. Could you assist me? Thank you in advance.
It works, thank you!