Wrong AF from bcftools merge

Open
#1,189 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
c

Research direction

Start with the supplied bcftools merge command context and compare the INFO fields with the listed genotype counts before and after merging. Trace how AF, AC, and AN are represented or propagated by merge, then verify the expected result on this variant with a reproducible merge example. Done means explaining the unchanged AF and documenting a reliable way to generate the correct value.

Written by the indexing model from the issue text.

Description

I have the below variant with AF=0.0009107 in the INFO field as shown below:

chr18 40492946 . A T 2012.92 PASS BaseQRankSum=1.45;ClippingRankSum=0;ExcessHet=3.0585;FS=1.205;InbreedingCoeff=-0.0081;MQ=60;MQRankSum=0;QD=12.05;ReadPosRankSum=-0.76;SOR=0.587;MQ0=0;set=variant;;DP=22895;AF=0.0009107;MLEAC=1;MLEAF=0.0009091;AN=1562;AC=5

Upon inspecting, the genotype counts for the above variant are found to be:

 304    ./.  
 776   0/0
   5    0/1

Firstly, can someone enlighten me on how the AF is calcluated here? I assumed AF=AC/AN but this is not true here.

Second, I have included additional samples using bcftools merge and the INFO field looks like below with unchanged AF.

chr18 40492946 . A T 2044.2 PASS BaseQRankSum=1.45;ClippingRankSum=0;ExcessHet=3.0573;FS=1.205;InbreedingCoeff=-0.0079;MQ=60;MQRankSum=0;QD=12.24;RAW_MQ=608400;ReadPosRankSum=-0.76;SOR=0.587;DP=23085;AF=0.0009107;MLEAC=1;MLEAF=0.0009091;AN=1576;AC=5

And the genotype counts for the variant after merging are found to be:

 304    ./.  
 783   0/0
   5    0/1

The AF in unchanged after merging while AN and other tags are updated as per the new samples. Could someone help why bcftools merge resulted in incorrect AF and ways to generate correct AF?

Dominant language
C
Stars
891
Forks
277
Avg merge
2d 23h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from samtools/bcftools

All issues in samtools/bcftools

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.