Search in sources :

Example 6 with GenotypeLikelihoods

use of htsjdk.variant.variantcontext.GenotypeLikelihoods in project gatk by broadinstitute.

the class ReferenceConfidenceModelUnitTest method testIndelLikelihoods.

@Test
public void testIndelLikelihoods() {
    GenotypeLikelihoods prev = model.getIndelPLs(HomoSapiensConstants.DEFAULT_PLOIDY, 0);
    Assert.assertEquals(prev.getAsPLs(), new int[] { 0, 0, 0 });
    Assert.assertEquals(-10 * GenotypeLikelihoods.getGQLog10FromLikelihoods(GenotypeType.HOM_REF.ordinal() - 1, prev.getAsVector()), 0.0);
    for (int i = 1; i <= ReferenceConfidenceModel.MAX_N_INDEL_INFORMATIVE_READS; i++) {
        final GenotypeLikelihoods current = model.getIndelPLs(HomoSapiensConstants.DEFAULT_PLOIDY, i);
        final double prevGQ = -10 * GenotypeLikelihoods.getGQLog10FromLikelihoods(GenotypeType.HOM_REF.ordinal() - 1, prev.getAsVector());
        final double currGQ = -10 * GenotypeLikelihoods.getGQLog10FromLikelihoods(GenotypeType.HOM_REF.ordinal() - 1, current.getAsVector());
        Assert.assertTrue(prevGQ < currGQ, "GQ Failed with prev " + prev + " curr " + current + " at " + i);
        Assert.assertTrue(prev.getAsPLs()[1] < current.getAsPLs()[1], "het PL failed with prev " + prev + " curr " + current + " at " + i);
        Assert.assertTrue(prev.getAsPLs()[2] < current.getAsPLs()[2], "hom-var PL Failed with prev " + prev + " curr " + current + " at " + i);
        //            logger.warn("result at " + i + " is " + current);
        prev = current;
    }
}
Also used : GenotypeLikelihoods(htsjdk.variant.variantcontext.GenotypeLikelihoods) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Aggregations

GenotypeLikelihoods (htsjdk.variant.variantcontext.GenotypeLikelihoods)6 Test (org.testng.annotations.Test)6 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)4 Allele (htsjdk.variant.variantcontext.Allele)2