Entering edit mode
23 months ago
mohsamir2016
▴
30
Dear all,
I am trying hard to add contigs information to the header of a vcf file because when I try to modify the names of chromosomes in a VCF file using
bcftools annotate --rename-chrs Names.txt gallus_gallus.vcf -Ov -o gallus_gallusrenamed.vcf
It gave me the following error :
[W::vcf_parse] Contig '1' is not defined in the header. (Quick workaround: index the file with tabix.)
Encountered an error, cannot proceed. Please check the error output above.
If feeling adventurous, use the --force option. (At your own risk!)
By checking the unique names of the contigs in this VCF file using
bcftools query -f '%CHROM\n' gallus_gallus.vcf|uniq
I realized that it gave me:
So I think I need to first add the contig tag to VCF header
Could any one suggest a code for that?
Thanks
Thanks, can you explain more, I think the first option is more convenient (i.e. UpdateVcfSequenceDictionary https://gatk.broadinstitute.org/hc/en-us/articles/360042477832-UpdateVcfSequenceDictionary-Picard-)
Does this means that my command might look like :
gatk UpdateVcfSequenceDictionary -I oldfile.vcf -O newfile.vcf -SD referencegenome.dict
In such case, the input is the old VCF, outputing the newfile, and then I used the dictionarized fasta file of the reference genome ?
Thanks