bed file indexing problem
1
0
Entering edit mode
3.7 years ago
kimkes25 ▴ 50

Hello

I have a bed file that looks like this:

Capture4

I would like to be able to retrieve data from it using samtools with tabix.

the actions I do:

bgzip sample.bed
tabix -s 1 -b 2 -e 3 sample.bed.gz
tabix sample.bed.gz chr1:19922842-19924305

but I have a problem after trying the second action, it returns this error:

Unsorted positions on sequence #1: 244318174 followed by 1179391

what can I do?

bed samtools tabix • 7.0k views
ADD COMMENT
1
Entering edit mode
3.7 years ago
ATpoint 83k

A BED has no header, so get rid of it, then sort it with sort -k1,1 -k2,2n, compress with bgzip and then retry to index.

ADD COMMENT
0
Entering edit mode

Even though unix sort will probably be faster you could also sort sample.bed with bedtools (default parameters are probably fine)

bedtools sort -i sample.bed > sample_sorted.bed
ADD REPLY
0
Entering edit mode

In addition to the first row (header), you also need to drop the first column as BED format is defined with chr, start, end in the first three columns.

ADD REPLY

Login before adding your answer.

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