how to calculate distance from a single nucleotide position to a peak
1
0
Entering edit mode
3.4 years ago
Lila M ★ 1.2k

Dear community, I am interested in calculate the distances of a specific position list to the peaks called before. Lets say I have some chip seq peaks (bed files, with chr, start and end) and I have other list with different position in which I am interested (again bed file, chr, start and end). First I want to see if there is any overlapping, that is something easy to do with bedtools intersect, but if the position is not in the peak, I would like to calculate the distance from my position to the peak (beginning and end), choosing the smallest one.

I don't know if there is any tool that can help me for doing that or if is something that I should figure out. In both cases, I really appreciate any advice :)

Thank you very much

ChIP-Seq peak distance genome • 972 views
ADD COMMENT
3
Entering edit mode
3.4 years ago

Maybe take a look at closest-features:

$ closest-features --closest --dist peaks.bed snps.bed > answer.bed

If the inputs are not sorted, you can pipe in sorted data via sort-bed:

$ closest-features --closest --dist <(sort-bed peaks.bed) <(sort-bed snps.bed) > answer.bed

The file answer.bed will contain the peak, the nearest SNP to that peak, and the signed distance between peak and SNP, separated by a | character. You can add the --delim <delimiter> option to specify a different delimiter, depending on what you might do downstream of this result.

ADD COMMENT
0
Entering edit mode

Thank you, is exactly what I need!

ADD REPLY

Login before adding your answer.

Traffic: 2510 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6