# GATK中如何计算Inbreeding coefficient（近交系数）

GATK近交系数的计算程序在github上可以找到：AS_InbreedingCoeff.java

```protected double calculateIC(final VariantContext vc, final Allele altAllele) {
final int AN = vc.getCalledChrCount();
final double altAF;
final double hetCount = heterozygosityUtils.getHetCount(vc, altAllele);
final double F;
//shortcut to get a value closer to the non-alleleSpecific value for bialleleics
if (vc.isBiallelic()) {
double refAC = heterozygosityUtils.getAlleleCount(vc, vc.getReference());
double altAC = heterozygosityUtils.getAlleleCount(vc, altAllele);
double refAF = refAC/(altAC+refAC);
altAF = 1 - refAF;
F = 1.0 - (hetCount / (2.0 * refAF * altAF * (double) heterozygosityUtils.getSampleCount())); // inbreeding coefficient
} else {
//compare number of hets for this allele (and any other second allele) with the expectation based on AFs
//derive the altAF from the likelihoods to account for any accumulation of fractional counts from non-primary likelihoods,
//e.g. for a GQ10 variant, the probability of the call will be ~0.9 and the second best call will be ~0.1 so adding up those 0.1s for het counts can dramatically change the AF compared with integer counts
altAF = heterozygosityUtils.getAlleleCount(vc, altAllele)/ (double) AN;
// 计算inbreeding coefficient
F = 1.0 - (hetCount / (2.0 * (1 - altAF) * altAF * (double) heterozygosityUtils.getSampleCount())); // heterozygosityUtils.getSampleCount() 获取总样本数
}
return F;
}```

• 版权声明 本文源自 解螺旋的矿工 整理 发表
• 转载请务必保留本文链接：https://www.plob.org/article/11641.html