This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to convert scaffold name to chromosome number in vcf file

How to convert scaffold name to chromosome number in vcf file? for example

NC3251.1 convert to 1
NC3252.1 convert to 2

I would be very grateful if you could help me solve this problem.

vcf scaffold chromosome

1 answer

awk '{printf("%s\t%d\n",$1,NR);}' /path/to/ref.fasta.fai > change.txt

and then

bcftools annotate --rename-chrs  change.txt in.vcf

Thank you Pierre, it worked for me

Log in to answer this question.