bedtools:intersectBed - how to get overlapping information?
1
0
Entering edit mode
9.2 years ago

Hello! I need some help concerning intersectBed.

I have file main.bed that contains information: chomosome, start position, end position. (it contains 350 lines)

I want to intersect my file with annotation file (Ensemble) to know information about regions (coding,noncoding, etc)

which correspond to my coordinates (start-end position). So I expect to get following file: chr,my coordinates + information about regions (maybe another info).

I use: intersectBed -a annotation.bed -b main.bed -c > result.bed

As a result I've got a file with the same information from annotation.bed and the last column - it's the number of overlapping lines from my file.

Does somebody know how I can get the file that contains also 350 lines but with additional information about regions?

annotation intersectBed bedtools • 4.1k views
ADD COMMENT
1
Entering edit mode
9.2 years ago
Sakti ▴ 510

intersectBed will always give you the intersect segments from your datafile overlapping the other features. But seems that what you want to do is simply attach the annotation.bed overlap info onto your original main.bed file. If you're familiar with perl you can write a small script where you save array keys for your chr:start:end positions and then go over it and search against your annotation.bed file for chromosomal region overlaps (also in array chr:start:end key format) and save the overlaps onto the main.bed keys.

ADD COMMENT
0
Entering edit mode

Thank you very much! I'll try to do it.

ADD REPLY

Login before adding your answer.

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