Search in sources :

Example 1 with AS_BaseQualityRankSumTest

use of org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_BaseQualityRankSumTest in project gatk by broadinstitute.

the class BaseQualityRankSumTestUnitTest method testBaseQualRawAnnotate.

@Test
public void testBaseQualRawAnnotate() {
    final AS_RankSumTest ann = new AS_BaseQualityRankSumTest();
    final String key1 = GATKVCFConstants.AS_RAW_BASE_QUAL_RANK_SUM_KEY;
    final String key2 = GATKVCFConstants.AS_BASE_QUAL_RANK_SUM_KEY;
    final int[] altBaseQuals = { 10, 20 };
    final int[] refBaseQuals = { 50, 60 };
    final List<GATKRead> refReads = Arrays.stream(refBaseQuals).mapToObj(i -> makeRead(i)).collect(Collectors.toList());
    final List<GATKRead> altReads = Arrays.stream(altBaseQuals).mapToObj(i -> makeRead(i)).collect(Collectors.toList());
    final ReadLikelihoods<Allele> likelihoods = AnnotationArtificialData.makeLikelihoods(SAMPLE_1, refReads, altReads, -100.0, -100.0, REF, ALT);
    final ReferenceContext ref = null;
    final VariantContext vc = makeVC(REF, ALT);
    final Map<String, Object> annotateRaw = ann.annotateRawData(ref, vc, likelihoods);
    final Map<String, Object> annotateNonRaw = ann.annotate(ref, vc, likelihoods);
    final String expectedAnnotation = refBaseQuals[0] + ",1," + refBaseQuals[1] + ",1" + AS_RankSumTest.PRINT_DELIM + altBaseQuals[0] + ",1," + altBaseQuals[1] + ",1";
    Assert.assertEquals(annotateRaw.get(key1), expectedAnnotation);
    Assert.assertEquals(annotateNonRaw.get(key1), expectedAnnotation);
    Assert.assertEquals(ann.getDescriptions().size(), 1);
    Assert.assertEquals(ann.getDescriptions().get(0).getID(), key1);
    Assert.assertEquals(ann.getKeyNames().size(), 1);
    Assert.assertEquals(ann.getKeyNames().get(0), key2);
}
Also used : AS_BaseQualityRankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_BaseQualityRankSumTest) Arrays(java.util.Arrays) ImmutableMap(com.google.common.collect.ImmutableMap) GATKVCFConstants(org.broadinstitute.hellbender.utils.variant.GATKVCFConstants) SampleList(org.broadinstitute.hellbender.utils.genotyper.SampleList) Test(org.testng.annotations.Test) htsjdk.variant.variantcontext(htsjdk.variant.variantcontext) Mockito.when(org.mockito.Mockito.when) GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) Collectors(java.util.stream.Collectors) AS_RankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RankSumTest) List(java.util.List) Assert(org.testng.Assert) Map(java.util.Map) ReferenceContext(org.broadinstitute.hellbender.engine.ReferenceContext) MannWhitneyU(org.broadinstitute.hellbender.utils.MannWhitneyU) Collections(java.util.Collections) org.broadinstitute.hellbender.utils.genotyper(org.broadinstitute.hellbender.utils.genotyper) Mockito.mock(org.mockito.Mockito.mock) GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) AS_RankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RankSumTest) AS_BaseQualityRankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_BaseQualityRankSumTest) ReferenceContext(org.broadinstitute.hellbender.engine.ReferenceContext) AS_BaseQualityRankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_BaseQualityRankSumTest) Test(org.testng.annotations.Test) AS_RankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RankSumTest)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 htsjdk.variant.variantcontext (htsjdk.variant.variantcontext)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 ReferenceContext (org.broadinstitute.hellbender.engine.ReferenceContext)1 AS_BaseQualityRankSumTest (org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_BaseQualityRankSumTest)1 AS_RankSumTest (org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RankSumTest)1 MannWhitneyU (org.broadinstitute.hellbender.utils.MannWhitneyU)1 org.broadinstitute.hellbender.utils.genotyper (org.broadinstitute.hellbender.utils.genotyper)1 SampleList (org.broadinstitute.hellbender.utils.genotyper.SampleList)1 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)1 GATKVCFConstants (org.broadinstitute.hellbender.utils.variant.GATKVCFConstants)1 Mockito.mock (org.mockito.Mockito.mock)1 Mockito.when (org.mockito.Mockito.when)1 Assert (org.testng.Assert)1 Test (org.testng.annotations.Test)1