Generate vcf.gz file and its index file vcf.gz.tbi
4
30
Entering edit mode
11.9 years ago
lyz10302012 ▴ 470

Can anyone tell me how to generate vcf.gz file and its index file vcf.gz.tbi in 1000 Genomes Project?

ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20110521/

vcf tabix • 192k views
ADD COMMENT
89
Entering edit mode
11.9 years ago
bgzip -c file.vcf > file.vcf.gz
tabix -p vcf file.vcf.gz

tabix documentation

ADD COMMENT
0
Entering edit mode

Does the VCF have to be sorted like SAM/BAM does?

ADD REPLY
1
Entering edit mode

Yes, tabix requires sorted input files. I don't think the sorting order matters, but records must be grouped together by rows.

ADD REPLY
0
Entering edit mode

You mean numeric or alphanumeric by chromosome in ascending or descending order plus numeric by position ascending or descending order? I can't think how else sorting order could not matter.

ADD REPLY
0
Entering edit mode

Yes. To clarify, I think you just need your chromosomes grouped together, and then records for each chromosome need to be sorted in ascending coordinate order.

ADD REPLY
23
Entering edit mode
11.9 years ago
Erik Garrison ★ 2.4k

I have a script which does this using a VCF stream on stdin:

#!/bin/bash

file=$1

bgzip >$file
tabix -f -p vcf $file

I found I was always writing the same lines over and over when indexing VCF files. You can use it like this:

cat uncompressed.vcf | bgziptabix compressed.vcf.gz
ADD COMMENT
21
Entering edit mode
6.7 years ago
miaowzai ▴ 390
bgzip file.vcf       # or:   bcftools view file.vcf -Oz -o file.vcf.gz
tabix file.vcf.gz    # or:   bcftools index file.vcf.gz

this is convenient where tabix and bgzip are not installed. saw this from: https://github.com/samtools/bcftools/issues/668

ADD COMMENT
4
Entering edit mode
7.2 years ago
ATCG ▴ 400
bgzip genotypes.vcf && tabix -p vcf genotypes.vcf.gz

see details if you need to:

https://qtltools.github.io/qtltools/pages/input_files.html

ADD COMMENT

Login before adding your answer.

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