Genome Analysis Toolkit

Variant Discovery in High-Throughput Sequencing Data

GATK process banner

Need Help?

Search our documentation

Community Forum

Hi, How can we help?

Developed in the Data Sciences Platform at the Broad Institute, the toolkit offers a wide variety of tools with a primary focus on variant discovery and genotyping. Its powerful processing engine and high-performance computing features make it capable of taking on projects of any size. Learn more

How is QD calculate for multiple heterozygous samples?

0

1 comment

  • Avatar
    Gökalp Çelik

    Hi Vinciane Mossion

    When QD is calculated only depth from samples with non homozygous reference calls is taken into accounts. 

    Below is the code snippet that calculates the DP for each site. We don't take averages of DP values when calculating QD for multiple samples. The sum of DPs calculated by the below function is used to divide the QUAL value to find QD.

    public static int getDepth(final GenotypesContext genotypes, final AlleleLikelihoods<GATKRead, Allele> likelihoods) {
            int depth = 0;
            int ADrestrictedDepth = 0;

            for ( final Genotype genotype : genotypes ) {
                // we care only about variant calls with likelihoods
                if ( !genotype.isHet() && !genotype.isHomVar() ) {
                    continue;
                }

                // if we have the AD values for this sample, let's make sure that the variant depth is greater than 1!
                if ( genotype.hasAD() ) {
                    final int[] AD = genotype.getAD();
                    final int totalADdepth = (int) MathUtils.sum(AD);
                    if ( totalADdepth != 0 ) {
                        if (totalADdepth - AD[0] > 1) {
                            ADrestrictedDepth += totalADdepth;
                        }
                        depth += totalADdepth;
                        continue;
                    }
                }
                // if there is no AD value or it is a dummy value, we want to look to other means to get the depth
                if (likelihoods != null) {
                    depth += likelihoods.sampleEvidenceCount(likelihoods.indexOfSample(genotype.getSampleName()));
                } else if ( genotype.hasDP() ) {
                    depth += genotype.getDP();
                }
            }

            // if the AD-restricted depth is a usable value (i.e. not zero), then we should use that one going forward
            if ( ADrestrictedDepth > 0 ) {
                depth = ADrestrictedDepth;
            }
            return depth;
        }

    I hope this helps. 

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk