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));
}
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());
}
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));
}
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());
}
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);
}
Aggregations