How To Run Tabix Locally
1
2
Entering edit mode
8.0 years ago
Peixe ▴ 610

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 • 5.5k views
2
Entering edit mode
8.0 years ago

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

1
Entering edit mode

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.

0
Entering edit mode

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

1
Entering edit mode

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

1
Entering edit mode

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

1
Entering edit mode

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

0
Entering edit mode

Yep, it works now. Thank you all!