Liftover error: Reference allele does not match the reference
Hi,
I am new to using bcftools +liftover, I want to liftOver from hg38 to hg19. However, I get the error: "Error: the reference allele GT does not match the reference NN at..."
I converted my data from bed/bim/fam to VCF using PLINK. I then ran: bcftools +liftover -Ov input_vcf.vcf -- -s human_1kg_v37.fasta -f GCA_000001405.15_GRCh38_no_alt_analysis_set.fna -c hg38ToHg19.over.chain.gz | bcftools sort -Ov -o chr22_vcf_hg19.vcf
Please could you let me know how I can resolve this error?
Thank you
PLINK does not generate conforming VCFs. You might want to try to fix your VCF with BCFtools/fixref (bcftools +fixref) and BCFtools/norm (bcftools norm --check-ref x) to make sure that your VCF file is conforming
Hi @freeseek - I am getting a similar error when trying to liftOver plugin from canFam3 to canFam4:
bcftools plugin liftover -oZ ${canFam3_vcf} -o canFam_liftOver.vcf.gz -- -f ${canFam4_fasta} -c ${chain_file} -s ${canFam4_fasta} --reject canFam3-reject.vcf.gz --reject-type b --write-src
Error: the reference allele G does not match the reference A at chr1:14391559
when I look in chr1:14391559 on canFam3 and the same position on canFam4
I can confirm the ref bases are different, but the canFam3 VCF has the correct ref base:
chr1 14391559 1:14391559:G:A G A
So I'm not sure how to resolve this. Any advice would be appreciated.
canFam3 has a G at position chr1:14391559 while canFam4 has A at position chr1:14391559. Maybe the issue here is that you should use:
-f ${canFam4_fasta} -c ${chain_file} -s ${canFam3_fasta}
In your comment you seem to have the same fasta file for options -s and -f
hi @freeseek Ah, that was a typo, my corrected command line was this
bcftools plugin liftover -oZ ${canFam3_vcf} -o canFam_liftOver.vcf.gz -- -f ${canFam4_fasta} -c ${chain_file}
-s ${canFam3_fasta} --reject canFam3-reject.vcf.gz --reject-type b --write-src
And I get a different error
Error: the reference allele T does not match the reference C at chr1:47169768
When I run bcftools norm check-ref option, I get a list of mismatched sites to canFam3 fasta. and chr1:47169768
is on the list
bcftools norm --check-ref w -f ${canFam3_fasta} ${canFam3_vcf} -oU -o /dev/null 2& > mismatch-checkref.txt
It looks like I need to either remove these sites from my VCF or fix the PLINK file that generated this VCF
Notice that if you created the VCF using PLINK this will not work correctly as PLINK does not create compliant VCF files. You will need to use an alternative strategy. BCFtools/convert might help
I removed the mismatched ref allele sites and then the liftover worked just fine. I didn't fully appreciate that PLINK doesn't generate compliant VCFs