bcftools icon indicating copy to clipboard operation
bcftools copied to clipboard

The REF prefixes differ: G vs C (1,1) Failed to merge alleles at...., combining ddRAD and WGR

Open AliBasuony2022 opened this issue 1 year ago • 2 comments

Dear colleagues,

I'm using bcftools to merge vcf files from ddRAD and whole genome data. The commands below were working fine before for the same data set, but it doesn't work now when I just excluded one sample from ddRAD data- very strange!!!


Step 1: I used below command to extract and write records from A (WGR,sampleslagopuszerda_filtered_1_autosomes38_bisnps_final.vcf.gz) shared by both A (WGR)(sampleslagopuszerda_filtered_1_autosomes38_bisnps_final.vcf.gz) and B (ddRAD) (populations.autosomes38.snps.vcf.gz) using exact allele match

bcftools isec -p dir -n=2 -w1 sampleslagopuszerda_filtered_1_autosomes38_bisnps_final.vcf.gz populations.autosomes38.snps.vcf.gz

Step 2: Then I merged both 0000.vcf (output from step 1) and populations.autosomes38.snps.vcf.gz using the command

This is the command module load bcftools/1.14 #bcftools merge [OPTIONS] A.vcf.gz B.vcf.gz […​] # main command

bcftools merge --merge all -0 --missing-to-ref 0000.vcf.gz populations.autosomes38.snps.vcf.gz --output sampleslagopuszerdaandddRAD_14_no_377_1.vcf

I got this error, The REF prefixes differ: G vs C (1,1) Failed to merge alleles at NC_051824.1:36197229 in populations.autosomes38.snps.vcf.gz

I have removed this two postions and carried on with the analysis, but I'm worry if this could affect the final results.

Any input for this will be highly appraciable.

Kind regrads, Ali

AliBasuony2022 avatar Apr 17 '24 10:04 AliBasuony2022

This happens when the reference alleles don't match across files. Unfortunately, your description does not give enough information, it's hard to say what is going on without seeing the data. It would seem one of the file has G while the other has C at the same position.

I recommend to trace the offending site from the source file through all steps and see when they stop making sense. If you believe it is a bug, a small test case to reproduce the problem is essential.

pd3 avatar Apr 28 '24 11:04 pd3

Thanks so much!

AliBasuony2022 avatar May 05 '24 11:05 AliBasuony2022