Question: tabix indexing issue
1
gravatar for bjlemmer
3.2 years ago by
bjlemmer20
bjlemmer20 wrote:

 

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. 
 

gz tabix vcf • 4.5k views
ADD COMMENTlink modified 3.2 years ago by cmdcolin1.2k • written 3.2 years ago by bjlemmer20
2
gravatar for Chris Miller
3.2 years ago by
Chris Miller20k
Washington University in St. Louis, MO
Chris Miller20k wrote:

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 COMMENTlink modified 3.2 years ago • written 3.2 years ago by Chris Miller20k

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 REPLYlink modified 3.2 years ago • written 3.2 years ago by bjlemmer20
1
gravatar for cmdcolin
3.2 years ago by
cmdcolin1.2k
United States
cmdcolin1.2k wrote:

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 COMMENTlink modified 3.2 years ago • written 3.2 years ago by cmdcolin1.2k
1

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 REPLYlink modified 3.2 years ago • written 3.2 years ago by bjlemmer20

Interesting! glad it is figured out though!

ADD REPLYlink written 3.2 years ago by cmdcolin1.2k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1203 users visited in the last hour