tabix indexing issue
2
1
Entering edit mode
8.8 years ago
bjlemmer ▴ 20

I am unable to view my data which I was able to view and manipulate with similar commands prior to this. Running on a Linux server. This is what I run and the errors I get:

​tabix sequence.snps.vcf.gz chr37>chr37.vcf  
bgzip -c chr37.vcf > chr37.vcf.gz
tabix -p vcf chr37.vcf.gz >chr37.vcf.gz.tbi

ERROR:

tabix the index file already exists. please use '-f- to overwrite

I saw that I had the tbi file so thought I could just run this to see some of the file

tabix chr37.vcf.gz chr37:1-20000
[ti_index_load] wrong magic number
[ti_index_load] fail to load the index: chr.37.vcf.gz.tbi
[tabix] failed to load the index file

I removed the index file and remade it didn't fix the problem. I tried

tabix -p -f vcf chr37.vcf.gz > chr37.vcf.gz.tbi
[main] unrecognized preset

I tried moving the -f in front of the -p, removing the -p, and the vcf still get same error. I even reloaded the sequence.snp file and remade the files. I have no idea what the issue is. Any help would be greatly appreciated.

vcf tabix • 14k views
ADD COMMENT
3
Entering edit mode
8.8 years ago

I believe the command you want for that last part is just:

tabix -p -f vcf chr37.vcf.gz

It automatically creates the appropriate file. When you add the redirect after it, it immediately creates an empty file and prepares to write stdout to that file. Then, when tabix checks, it sees that a file by that name exists.

ADD COMMENT
0
Entering edit mode

Maybe the > was causing an error. I also just deleted the current tbi file and re created it and now it appears to work. I also don't know if having two of the vcf.gz files caused an error at some point, but thanks.

ADD REPLY
2
Entering edit mode
8.8 years ago
cmdcolin ★ 4.0k

Several of the commands that you are using here are unnecessarily using redirects. Basically you can just use

bgzip myfile.vcf
tabix -p vcf myfile.vcf.gz

You don't have to add the redirect when creating the tabix index (e.g. you said tabix -p chr37.vcf.gz > chr37.vcf.gz.tbi) and it is likely that that causes the error too

The other answer by Chris mentions this too, but I would not even use the -f flag, that is probably unneeded, and I believe it is just -p vcf and not -p -f vcf

ADD COMMENT
1
Entering edit mode

The reason I was attempting to use the -f option is because it told me to use that to overwrite the current tbi file. I have been using the > to store into a file because I have been using the cut function to keep only columns I need.

ADD REPLY
0
Entering edit mode

Interesting! glad it is figured out though!

ADD REPLY

Login before adding your answer.

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