This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Can't create tabix index of the bed file

I've got ATAC-seq fragments file I downloaded from GEO https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM4156599

It doesn't have an index, so I figured I'd create one with tabix. The first error I got was:

[tabix] the compression of 'GSM4156599_brain.atac.fragments.bed.gz' is not BGZF

I fixed that by uncompressing and running bgzip. Now when I run

tabix -p bed GSM4156599_brain.atac.fragments.bed.gz

the output is:

[E::hts_idx_push] Unsorted positions on sequence #1: 3107211 followed by 3107198

tbx_index_build failed: GSM4156599_brain.atac.fragments.bed.gz

I've attached the file https://drive.google.com/file/d/1WkDqWpRQlaEPeiSbChYZCIbSIzVFJ0FX/view?usp=sharing Does something about this bed seem off to you?

Thanks in advance!

samtools tabix bed atac-seq

1 answer

Hi,

You should sort the bed before indexing it

wget https://ftp.ncbi.nlm.nih.gov/geo/samples/GSM4156nnn/GSM4156599/suppl/GSM4156599_brain.atac.fragments.bed.gz
sort -k1,1 -k2,2n -k3,3n GSM4156599_brain.atac.fragments.bed >GSM4156599_brain.atac.fragments.sorted.bed
bgzip GSM4156599_brain.atac.fragments.sorted.bed
tabix -p bed GSM4156599_brain.atac.fragments.sorted.bed.gz

Log in to answer this question.