Hi,
I was wondering if there was an easy/straightforward way to calculate the midpoint for each record in a BED file? Currently, I'm using a combination shell and R script to do the following:
For each BED record:
Calculate the peak width (end - start)
(For peak widths that are odd numbers, I do peak_width + 1)
Calculate the midpoint: peak_midpoint <- Peak_Data$"start" + (Peak_Data$Peak_Width/2)
I then add a certain number of base pairs to the left and right of the midpoint location to get midpoint centered windows.
Obtaining these midpoint centered windows is useful for various analysis including motif enrichment/distribution, aggregate plots, etc.
Is there a more sophisticated way of doing these operations using BEDtools commands? Would it be useful to have a BEDTools command that does this (with various options)?
Thanks,
Andy
--
Andy Rampersaud
Graduate Student, Bioinformatics
Waxman Lab, Boston University