This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error using vg construct: Index is older than VCF (though it's not)

vg version: v1.41.0 "Salmour",

command line:

./vg construct -r genomic.fna -v bufo.12samples.vcf.gz -t 24 -m 32  > bufo.vg

error:

[tabix++] the index file is older than the vcf file. Please use '-f' to overwrite or reindex.

Describe:

I should clarify that the index for vcf is .csi insdead of .tbi because the bufo chromosomes are big so that can not be stored in tbi index. And I'm pretty sure that bufo.12samples.vcf.gz.csi is younger than bufo.12samples.vcf.gz.

Question:

How can I get rid of this error?

Thanks,

Maxine

vg

error appears running vg construct: [tabix++] the index file is older than the vcf file. Please use '-f' to overwrite or reindex.

Please use concise titles. Add detailed error messages in the body of the post. I've changed it for you this time.

And I'm pretty sure that bufo.12samples.vcf.gz.csi is younger than bufo.12samples.vcf.gz

Just so you're 100% sure, can you run:

[ bufo.12samples.vcf.gz.csi -nt bufo.12samples.vcf.gz ] && echo "Index is younger"

Yes

$ [ bufo.12samples.vcf.gz.csi -nt bufo.12samples.vcf.gz ] && echo "Index is younger"
Index is younger
-rw-r----- 1 maxine91 maxine91 1.1G Jun 14 23:15 bufo.12samples.vcf.gz
-rw-r----- 1 maxine91 maxine91 631K Jun 15 13:22 bufo.12samples.vcf.gz.csi

This might be a bug in their software - they may have not yet accounted for CSI indices. I think you should open a GitHub issue on their repository and point to this post.

A previous issue indicates that the software thinks a non-existent tbi file is somehow older than the VCF file - this is probably what's happening in your case, given that .tbi does not exist. vg needs to check for a .tbi or a .csi that's created after the VCF.

1 answer

re-index

bcftools index --tbi --force bufo.12samples.vcf.gz 

or

tabix -p vcf -f bufo.12samples.vcf.gz 

OP says their index is newer than the VCF. They also say they need to use CSI as TBI doesn't fit their requirements.

tbi index just cannot build even force created.

bcftools index --tbi --force bufo.12samples.vcf.gz 
[E::hts_idx_check_range] Region 961848..611782282 cannot be stored in a tbi index. Try using a csi index
index: failed to create index for "bufo.12samples.vcf.gz"
tabix -p vcf -f bufo.12samples.vcf.gz 
[E::hts_idx_check_range] Region 961848..611782282 cannot be stored in a tbi index. Try using a csi index
tbx_index_build failed: bufo.12samples.vcf.gz

ah sorry, I was too fast ! is vg able to handle large chromosomes ?

I don't think so - they seem to check for a TBI or CSI file (https://github.com/vgteam/vg/blob/2c36d2cd08bef668eca2a8a64ba51abc037c905b/src/index_registry.cpp#L561) before the error message though, so I don't know what's happening.

OP is using a version released on 6-Jun-2022, and this line of code existed before then (whether or not it was executed is not something I can check). Only the devs can answer the question now, and they ask for posts to be opened here on biostars.

thank you for the update!

Log in to answer this question.