Search in sources :

Example 1 with AlleleList

use of org.broadinstitute.hellbender.utils.genotyper.AlleleList 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 AlleleList

use of org.broadinstitute.hellbender.utils.genotyper.AlleleList 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 AlleleList

use of org.broadinstitute.hellbender.utils.genotyper.AlleleList 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 AlleleList

use of org.broadinstitute.hellbender.utils.genotyper.AlleleList 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)

Example 5 with AlleleList

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

the class HaplotypeBAMWriterUnitTest method generateReadLikelihoods.

private ReadLikelihoods<Haplotype> generateReadLikelihoods(final int[] readCount) {
    final AlleleList<Haplotype> haplotypeList = generateHaplotypeList();
    final SampleList sampleList = generateSampleList(readCount.length);
    final Map<String, List<GATKRead>> readSamples = new LinkedHashMap<>(readCount.length);
    for (int i = 0; i < readCount.length; i++) {
        readSamples.put(sampleList.getSample(i), generateReadsList(i, readCount[i]));
    }
    return new ReadLikelihoods<>(sampleList, haplotypeList, readSamples);
}
Also used : ArrayList(java.util.ArrayList) SampleList(org.broadinstitute.hellbender.utils.genotyper.SampleList) 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) SampleList(org.broadinstitute.hellbender.utils.genotyper.SampleList) IndexedSampleList(org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList) ReadLikelihoods(org.broadinstitute.hellbender.utils.genotyper.ReadLikelihoods) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

AlleleList (org.broadinstitute.hellbender.utils.genotyper.AlleleList)5 IndexedAlleleList (org.broadinstitute.hellbender.utils.genotyper.IndexedAlleleList)5 IndexedSampleList (org.broadinstitute.hellbender.utils.genotyper.IndexedSampleList)5 ReadLikelihoods (org.broadinstitute.hellbender.utils.genotyper.ReadLikelihoods)5 ReferenceContext (org.broadinstitute.hellbender.engine.ReferenceContext)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 List (java.util.List)2 AS_RMSMappingQuality (org.broadinstitute.hellbender.tools.walkers.annotator.allelespecific.AS_RMSMappingQuality)2 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 SampleList (org.broadinstitute.hellbender.utils.genotyper.SampleList)1 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)1