Is there a way to filter out broad peaks / overlaps from a narrowpeak file? Example: I am looking at Pol II and have very nice sharp peaks at the TSS of genes, and these are the kind of peaks i'm interested in identifying inside exons / introns. I'm looking for overlaps of a TF at Exons but I am only interested in narrow, sharp, clean peaks and not large islands with multiple overlaps of peaks.
I am mainly using bedtools as I have no programming experience, but I don't mind learning another tool if needed.
Not sure how "broad" these peaks are, given its a narrowPeak file, but can't you use a size based filter? Particularly, if you are not interested in regions with overlapping peaks, you can first merge them using bedtools merge, and then filter out large/merged peaks using awk as follows:
Size based method:
Assuming you want to merge all peaks which are less than 50bp apart, and remove all peaks that are larger than 300bp:
Not sure how "broad" these peaks are, given its a narrowPeak file, but can't you use a size based filter? Particularly, if you are not interested in regions with overlapping peaks, you can first merge them using bedtools merge, and then filter out large/merged peaks using awk as follows:
Size based method:
Assuming you want to merge all peaks which are less than 50bp apart, and remove all peaks that are larger than 300bp:
Not sure how "broad" these peaks are, given its a narrowPeak file, but can't you use a size based filter? Particularly, if you are not interested in regions with overlapping peaks, you can first merge them using bedtools merge, and then filter out large/merged peaks using awk as follows:
Size based method:
Assuming you want to merge all peaks which are less than 50bp apart, and remove all peaks that are larger than 300bp:
Overlap based method:
Assuming you want to merge only overlapping peaks, and remove all merged features where more than two peaks are merged:
Note that bedtools merge removes all except the first three columns in the output unless explicitly retained column-wise.
Tej Sowpati you should add this as an answer (not as a reply). Seems logical to me.