This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How To Run Tabix Locally

I have a local vcf file on my computer (it is actually the full chromosome 22). I would like to subset it in regions. I know tabix can do it, but I can't find the way...

When I use tabix to connect to the ftp server there is no problem; I easily get the vcf file. But doing it locally, even if I download and put in the same folder the proper index .tbi file, I get nothing.

This is the command I am using:

/home/peixe/tabix-0.2.6/tabix -fh -p vcf ALL.chr22.phase1_release_v3.20101123.snps_indels_svs.genotypes.vcf.gz 22:1500000-1600000

But I am only getting an empty vcf file. In the tabix help manual, it does not not provide any tip about it...

Does anyone know a way to do it?

tabix local vcf

1 answer

to use tabix, you need TWO steps:

first create an index (*.tbi) with the BGZIPpped VCF:

/home/peixe/tabix-0.2.6/tabix -f -p vcf ALL.chr22.phase1_release_v3.20101123.snps_indels_svs.genotypes.vcf.gz

the index is created, you can now query :

/home/peixe/tabix-0.2.6/tabix  -h ALL.chr22.phase1_release_v3.20101123.snps_indels_svs.genotypes.vcf.gz 22:1500000-1600000

Note: the file must be compressed using the bgzip tool provided in the tabix package. If the file is compressed with another tool (e.g. tar), tabix won't work correctly.

Hmmm... This is weird. Before I was skipping the first step. But now, once done, I only get an empty file (just the header)...

chr22 has a big telomeric region in 5': you won't find any variant here: Try another region.

hahaha... I feel silly now. Years in this world, now I know it...

Make sure your chromosomes named as "22" not "chr22", or you need to use "chr22:150000-160000".

Yep, it works now. Thank you all!

Log in to answer this question.