Search in sources :

Example 1 with IndexedAlleleList

use of org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList in project gatk by broadinstitute.

the class RMSMappingQualityUnitTest method testLikelihoodsEmpty_AS.

@Test
public void testLikelihoodsEmpty_AS() throws Exception {
    final List<GATKRead> reads = Collections.emptyList();
    final Map<String, List<GATKRead>> readsBySample = ImmutableMap.of("sample1", reads);
    final org.broadinstitute.hellbender.utils.genotyper.SampleList sampleList = new IndexedSampleList(Arrays.asList("sample1"));
    final AlleleList<Allele> alleleList = new IndexedAlleleList<>(Arrays.asList(Allele.create("A")));
    final ReadLikelihoods<Allele> likelihoods = new ReadLikelihoods<>(sampleList, alleleList, readsBySample);
    final VariantContext vc = makeVC();
    final ReferenceContext referenceContext = null;
    final Map<String, Object> annotate = new AS_RMSMappingQuality().annotate(referenceContext, vc, likelihoods);
    final String[] split = ((String) annotate.get(GATKVCFConstants.AS_RAW_RMS_MAPPING_QUALITY_KEY)).split(AS_RMSMappingQuality.SPLIT_DELIM);
    Assert.assertEquals(split.length, 2);
    Assert.assertEquals(split[0], String.format("%.2f", 0.0));
    Assert.assertEquals(split[1], String.format("%.2f", 0.0));
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) IndexedAlleleList(org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList) ReadLikelihoods(org.broadinstitute.hellbender.utils.genotyper.ReadLikelihoods) AS_RMSMappingQuality(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RMSMappingQuality) IndexedSampleList(org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList) ReferenceContext(org.broadinstitute.hellbender.engine.ReferenceContext) AlleleList(org.broadinstitute.hellbender.utils.genotyper.AlleleList) IndexedAlleleList(org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList) IndexedSampleList(org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList) Test(org.testng.annotations.Test)

Example 2 with IndexedAlleleList

use of org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList in project gatk by broadinstitute.

the class RMSMappingQualityUnitTest method testEmptyLikelihoods.

@Test
public void testEmptyLikelihoods() throws Exception {
    final List<GATKRead> reads = Collections.emptyList();
    final Map<String, List<GATKRead>> readsBySample = ImmutableMap.of("sample1", reads);
    final org.broadinstitute.hellbender.utils.genotyper.SampleList sampleList = new IndexedSampleList(Arrays.asList("sample1"));
    final AlleleList<Allele> alleleList = new IndexedAlleleList<>(Arrays.asList(Allele.create("A")));
    final ReadLikelihoods<Allele> likelihoods = new ReadLikelihoods<>(sampleList, alleleList, readsBySample);
    final VariantContext vc = makeVC();
    final ReferenceContext referenceContext = null;
    final Map<String, Object> annotate = new RMSMappingQuality().annotate(referenceContext, vc, likelihoods);
    Assert.assertTrue(annotate.isEmpty());
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) IndexedAlleleList(org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList) ReadLikelihoods(org.broadinstitute.hellbender.utils.genotyper.ReadLikelihoods) IndexedSampleList(org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList) ReferenceContext(org.broadinstitute.hellbender.engine.ReferenceContext) AlleleList(org.broadinstitute.hellbender.utils.genotyper.AlleleList) IndexedAlleleList(org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList) IndexedSampleList(org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList) AS_RMSMappingQuality(org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RMSMappingQuality) Test(org.testng.annotations.Test)

Example 3 with IndexedAlleleList

use of org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList in project gatk by broadinstitute.

the class MappingQualityZeroUnitTest method testEmptyLikelihoods.

@Test
public void testEmptyLikelihoods() throws Exception {
    final List<GATKRead> reads = Collections.emptyList();
    final Map<String, List<GATKRead>> readsBySample = ImmutableMap.of("sample1", reads);
    final org.broadinstitute.hellbender.utils.genotyper.SampleList sampleList = new IndexedSampleList(Arrays.asList("sample1"));
    final AlleleList<Allele> alleleList = new IndexedAlleleList<>(Arrays.asList(Allele.create("A")));
    final ReadLikelihoods<Allele> likelihoods = new ReadLikelihoods<>(sampleList, alleleList, readsBySample);
    final VariantContext vc = makeVC();
    final ReferenceContext referenceContext = null;
    final Map<String, Object> annotate = new MappingQualityZero().annotate(referenceContext, vc, likelihoods);
    //strangely,  MappingQualityZero returns 0 if likelihoods is empty
    final int n = 0;
    Assert.assertEquals(annotate.get(VCFConstants.MAPPING_QUALITY_ZERO_KEY), String.valueOf(n));
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) VariantContext(htsjdk.variant.variantcontext.VariantContext) IndexedAlleleList(org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList) ReadLikelihoods(org.broadinstitute.hellbender.utils.genotyper.ReadLikelihoods) Allele(htsjdk.variant.variantcontext.Allele) IndexedSampleList(org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList) ReferenceContext(org.broadinstitute.hellbender.engine.ReferenceContext) List(java.util.List) AlleleList(org.broadinstitute.hellbender.utils.genotyper.AlleleList) IndexedAlleleList(org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList) IndexedSampleList(org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList) Test(org.testng.annotations.Test)

Example 4 with IndexedAlleleList

use of org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList in project gatk by broadinstitute.

the class CoverageUnitTest method testLikelihoodsEmpty.

@Test
public void testLikelihoodsEmpty() throws Exception {
    final List<GATKRead> reads = new ArrayList<>();
    final Map<String, List<GATKRead>> readsBySample = ImmutableMap.of("sample1", reads);
    final org.broadinstitute.hellbender.utils.genotyper.SampleList sampleList = new IndexedSampleList(Arrays.asList("sample1"));
    final AlleleList<Allele> alleleList = new IndexedAlleleList<>(Arrays.asList(Allele.NO_CALL));
    final ReadLikelihoods<Allele> likelihoods = new ReadLikelihoods<>(sampleList, alleleList, readsBySample);
    final VariantContext vc = makeVC();
    final ReferenceContext referenceContext = null;
    final Map<String, Object> annotate = new Coverage().annotate(referenceContext, vc, likelihoods);
    Assert.assertTrue(annotate.isEmpty());
}
Also used : GATKRead(org.broadinstitute.hellbender.utils.read.GATKRead) VariantContext(htsjdk.variant.variantcontext.VariantContext) IndexedAlleleList(org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList) ReadLikelihoods(org.broadinstitute.hellbender.utils.genotyper.ReadLikelihoods) Allele(htsjdk.variant.variantcontext.Allele) IndexedSampleList(org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList) ReferenceContext(org.broadinstitute.hellbender.engine.ReferenceContext) AlleleList(org.broadinstitute.hellbender.utils.genotyper.AlleleList) IndexedAlleleList(org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList) IndexedSampleList(org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Aggregations

ReferenceContext (org.broadinstitute.hellbender.engine.ReferenceContext)4 AlleleList (org.broadinstitute.hellbender.utils.genotyper.AlleleList)4 IndexedAlleleList (org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList)4 IndexedSampleList (org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList)4 ReadLikelihoods (org.broadinstitute.hellbender.utils.genotyper.ReadLikelihoods)4 GATKRead (org.broadinstitute.hellbender.utils.read.GATKRead)4 Test (org.testng.annotations.Test)4 Allele (htsjdk.variant.variantcontext.Allele)2 VariantContext (htsjdk.variant.variantcontext.VariantContext)2 AS_RMSMappingQuality (org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RMSMappingQuality)2 List (java.util.List)1 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)1