use of org.broadinstitute.hellbender.engine.ReferenceContext in project gatk by broadinstitute.
the class CoverageUnitTest method testAllNull.
@Test(expectedExceptions = IllegalArgumentException.class)
public void testAllNull() throws Exception {
final VariantContext vc = null;
final ReferenceContext referenceContext = null;
final InfoFieldAnnotation cov = new Coverage();
//vc can't be null
final Map<String, Object> annotate = cov.annotate(referenceContext, vc, null);
}
use of org.broadinstitute.hellbender.engine.ReferenceContext in project gatk by broadinstitute.
the class BaseQualityRankSumTestUnitTest method testBaseQual.
@Test
public void testBaseQual() {
final InfoFieldAnnotation ann = new BaseQualityRankSumTest();
final String key = GATKVCFConstants.BASE_QUAL_RANK_SUM_KEY;
final MannWhitneyU mannWhitneyU = new MannWhitneyU();
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> annotate = ann.annotate(ref, vc, likelihoods);
final double zScore = mannWhitneyU.test(new double[] { altBaseQuals[0], altBaseQuals[1] }, new double[] { refBaseQuals[0], refBaseQuals[1] }, MannWhitneyU.TestType.FIRST_DOMINATES).getZ();
final String zScoreStr = String.format("%.3f", zScore);
Assert.assertEquals(annotate.get(key), zScoreStr);
Assert.assertEquals(ann.getDescriptions().size(), 1);
Assert.assertEquals(ann.getDescriptions().get(0).getID(), key);
Assert.assertEquals(ann.getKeyNames().size(), 1);
Assert.assertEquals(ann.getKeyNames().get(0), key);
}
use of org.broadinstitute.hellbender.engine.ReferenceContext in project gatk by broadinstitute.
the class RMSMappingQualityUnitTest method testNullLikelihoods.
@Test
public void testNullLikelihoods() throws Exception {
final VariantContext vc = makeVC();
final ReferenceContext referenceContext = null;
final InfoFieldAnnotation cov = new RMSMappingQuality();
final Map<String, Object> annotate = cov.annotate(referenceContext, vc, null);
Assert.assertTrue(annotate.isEmpty());
Assert.assertEquals(cov.getDescriptions().get(0).getID(), VCFConstants.RMS_MAPPING_QUALITY_KEY);
Assert.assertEquals(cov.getDescriptions().get(1).getID(), GATKVCFConstants.RAW_RMS_MAPPING_QUALITY_KEY);
Assert.assertEquals(cov.getDescriptions().get(0).getID(), VCFConstants.RMS_MAPPING_QUALITY_KEY);
}
use of org.broadinstitute.hellbender.engine.ReferenceContext in project gatk by broadinstitute.
the class RMSMappingQualityUnitTest method testNullLikelihoods_AS.
@Test
public void testNullLikelihoods_AS() throws Exception {
final VariantContext vc = makeVC();
final ReferenceContext referenceContext = null;
final InfoFieldAnnotation cov = new AS_RMSMappingQuality();
final Map<String, Object> annotate = cov.annotate(referenceContext, vc, null);
Assert.assertTrue(annotate.isEmpty());
Assert.assertEquals(cov.getDescriptions().size(), 1);
Assert.assertEquals(cov.getDescriptions().get(0).getID(), GATKVCFConstants.AS_RAW_RMS_MAPPING_QUALITY_KEY);
}
use of org.broadinstitute.hellbender.engine.ReferenceContext in project gatk by broadinstitute.
the class MappingQualityZeroUnitTest method testNullLikelihoods.
@Test
public void testNullLikelihoods() throws Exception {
final VariantContext vc = makeVC();
final ReferenceContext referenceContext = null;
final InfoFieldAnnotation cov = new MappingQualityZero();
final Map<String, Object> annotate = cov.annotate(referenceContext, vc, null);
Assert.assertTrue(annotate.isEmpty());
Assert.assertEquals(cov.getDescriptions().size(), 1);
Assert.assertEquals(cov.getDescriptions().get(0).getID(), VCFConstants.MAPPING_QUALITY_ZERO_KEY);
}
Aggregations