Statistics on BED files
1
0
Entering edit mode
7.2 years ago
abedkurdi10 ▴ 190

Hello everybody, I have two BED files. I would like to know which one of them has closer intervals. I already calculated standard deviation for the distances between consecutive intervals. First, I calculated the distances between consecutive intervals using bedtools spacing. since I have different numbers of records in both files, I don't know how to compare standard deviation to make the real comparison.

Does anybody knows how to make the comparison? Is there any other ways?

I appreciate your help, Thank you.

bed statistics intervals • 2.2k views
ADD COMMENT
2
Entering edit mode
7.2 years ago

I think one way is to compute and compare the coefficients of variation for your two files, which are unitless or dimensionless.

Start with set A:

$ cut -f1-4 A.bed | sort-bed - > A.bed4
$ closest-features --closest --dist --no-overlaps --delim '\t' A.bed4 A.bed4 > A.dist.bed5
$ awk '{a+=$5; n[NR]=$5;} END {m=a/NR; s=0; for(i=1;i<=NR;i++) {s+=((n[i]-m)*(n[i]-m));} sd=sqrt(s/(NR-1)); cv=sd/m; print cv;}' A.dist.bed5 > A.cv.txt

Repeat for set B:

$ cut -f1-4 B.bed | sort-bed - > B.bed4
$ closest-features --closest --dist --no-overlaps --delim '\t' B.bed4 B.bed4 > B.dist.bed5
$ awk '{a+=$5; n[NR]=$5;} END {m=a/NR; s=0; for(i=1;i<=NR;i++) {s+=((n[i]-m)*(n[i]-m));} sd=sqrt(s/(NR-1)); cv=sd/m; print cv;}' B.dist.bed5 > B.cv.txt

Then compare A.cv.txt and B.cv.txt to get the relative variability.

ADD COMMENT
0
Entering edit mode

I will give it a try. Thank you.

ADD REPLY

Login before adding your answer.

Traffic: 1696 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