This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Tabix -P Vcf Error

Hello everyone, I'm handling self-made VCF files and I need to bgzip and tabix -p them ibn order to use some vcf-tools perl scripts. When I apply the tabiz command: Tabix -p vcf file1.vcf.gz the following error appears:

[ti_index_core] the file out of order at line 8

I had previous errors because I had an extra withespace at the end of each line which I removed using:

sed -e 's/ $//' file1.vcf

I have to say that the VCF file is all tab separated.

So, there are the first 20 lines of my vcf file:

##fileformat=VCFv4.1
##source=pseq
##FILTER=<ID=PASS,Description="Passed variant FILTERs">
#CHROM    POS    ID    REF    ALT    QUAL    FILTER    INFO    FORMAT    45125
1    109440678    1KG_1_109440678    I    D    .    PASS    .    GT    1/1
1    110655430    1KG_1_110655430    I    D    .    PASS    .    GT    1/1
1    113933669    1KG_1_113933669    I    D    .    PASS    .    GT    1/1
1    1158675    1KG_1_1158675    I    D    .    PASS    .    GT    1/1
1    12343587    1KG_1_12343587    I    D    .    PASS    .    GT    1/1
1    12632789    1KG_1_12632789    I    D    .    PASS    .    GT    1/1
1    1323216    1KG_1_1323216    I    D    .    PASS    .    GT    1/1
1    14106394    1KG_1_14106394    D    I    .    PASS    .    GT    1/1
1    150201529    1KG_1_150201529    I    D    .    PASS    .    GT    1/1
1    150938672    1KG_1_150938672    I    D    .    PASS    .    GT    1/1
1    152085296    1KG_1_152085296    I    D    .    PASS    .    GT    1/1
1    153641026    1KG_1_153641026    I    D    .    PASS    .    GT    1/1
1    167097500    1KG_1_167097500    I    D    .    PASS    .    GT    1/1
1    169512078    1KG_1_169512078    I    D    .    PASS    .    GT    1/1
1    170967308    1KG_1_170967308    I    D    .    PASS    .    GT    1/1
1    171079942    1KG_1_171079942    I    D    .    PASS    .    GT    1/1

Hope you can help me

tabix vcf

1 answer

your VCF must be sorted on CHROM/POS . It is not.

http://samtools.sourceforge.net/tabix.shtml

" The input data file must be position sorted and compressed by bgzip..."

Hence the error message: POS in lines 5-8 goes 109440678, 110655430, 113933669, 1158675.

Thank you Pierre, that was the solution, I used vcf-sort and everything went ok!!

Log in to answer this question.