Search in sources :

Example 1 with AS_MappingQualityRankSumTest

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

the class MappingQualityRankSumTestUnitTest method testAS_MQRaw.

@Test
public void testAS_MQRaw() {
    final AS_RankSumTest ann = new AS_MappingQualityRankSumTest();
    final String key1 = GATKVCFConstants.AS_RAW_MAP_QUAL_RANK_SUM_KEY;
    final String key2 = GATKVCFConstants.AS_MAP_QUAL_RANK_SUM_KEY;
    final int[] altMappingQualities = { 10, 20 };
    final int[] refMappingQualities = { 100, 110 };
    final List<GATKRead> refReads = Arrays.stream(refMappingQualities).mapToObj(i -> makeRead(i)).collect(Collectors.toList());
    final List<GATKRead> altReads = Arrays.stream(altMappingQualities).mapToObj(i -> makeRead(i)).collect(Collectors.toList());
    final ReadLikelihoods<Allele> likelihoods = AnnotationArtificialData.makeLikelihoods(sample1, 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> annotate = ann.annotate(ref, vc, likelihoods);
    final String expected = refMappingQualities[0] + ",1," + refMappingQualities[1] + ",1" + AS_RankSumTest.PRINT_DELIM + altMappingQualities[0] + ",1," + altMappingQualities[1] + ",1";
    Assert.assertEquals(annotate.get(key1), expected);
    Assert.assertEquals(annotateRaw.get(key1), expected);
    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 : TextCigarCodec(htsjdk.samtools.TextCigarCodec) Cigar(htsjdk.samtools.Cigar) AS_MappingQualityRankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_MappingQualityRankSumTest) Arrays(java.util.Arrays) GATKVCFConstants(org.broadinstitute.hellbender.utils.variant.GATKVCFConstants) Test(org.testng.annotations.Test) htsjdk.variant.variantcontext(htsjdk.variant.variantcontext) GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) Collectors(java.util.stream.Collectors) ReadLikelihoods(org.broadinstitute.hellbender.utils.genotyper.ReadLikelihoods) AS_RankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RankSumTest) List(java.util.List) ArtificialReadUtils(org.broadinstitute.hellbender.utils.read.ArtificialReadUtils) Assert(org.testng.Assert) Map(java.util.Map) ReferenceContext(org.broadinstitute.hellbender.engine.ReferenceContext) MannWhitneyU(org.broadinstitute.hellbender.utils.MannWhitneyU) GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) AS_RankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RankSumTest) AS_MappingQualityRankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_MappingQualityRankSumTest) ReferenceContext(org.broadinstitute.hellbender.engine.ReferenceContext) AS_MappingQualityRankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_MappingQualityRankSumTest) Test(org.testng.annotations.Test) AS_RankSumTest(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RankSumTest)

Aggregations

Cigar (htsjdk.samtools.Cigar)1 TextCigarCodec (htsjdk.samtools.TextCigarCodec)1 htsjdk.variant.variantcontext (htsjdk.variant.variantcontext)1 Arrays (java.util.Arrays)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_MappingQualityRankSumTest (org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_MappingQualityRankSumTest)1 AS_RankSumTest (org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RankSumTest)1 MannWhitneyU (org.broadinstitute.hellbender.utils.MannWhitneyU)1 ReadLikelihoods (org.broadinstitute.hellbender.utils.genotyper.ReadLikelihoods)1 ArtificialReadUtils (org.broadinstitute.hellbender.utils.read.ArtificialReadUtils)1 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)1 GATKVCFConstants (org.broadinstitute.hellbender.utils.variant.GATKVCFConstants)1 Assert (org.testng.Assert)1 Test (org.testng.annotations.Test)1