use of org.broadinstitute.hellbender.tools.exome.germlinehmm.CopyNumberTriState in project gatk by broadinstitute.
the class XHMMSegmentCallerIntegrationTest method assertOutputHasConsistentNumberOfTargets.
private void assertOutputHasConsistentNumberOfTargets(final List<HiddenStateSegmentRecord<CopyNumberTriState, Target>> outputRecords, final TargetCollection<Target> targets) {
for (final HiddenStateSegmentRecord<CopyNumberTriState, Target> nextRecord : outputRecords) {
final IndexRange indexRange = targets.indexRange(nextRecord.getSegment());
Assert.assertEquals(indexRange.to - indexRange.from, nextRecord.getSegment().getTargetCount());
}
}
use of org.broadinstitute.hellbender.tools.exome.germlinehmm.CopyNumberTriState in project gatk by broadinstitute.
the class XHMMSegmentCallerIntegrationTest method assertSampleSegmentsCoverAllTargets.
private void assertSampleSegmentsCoverAllTargets(final List<HiddenStateSegmentRecord<CopyNumberTriState, Target>> sampleRecords, final TargetCollection<Target> targets) {
int next = 0;
for (final HiddenStateSegmentRecord<CopyNumberTriState, Target> record : sampleRecords) {
final IndexRange range = targets.indexRange(record.getSegment());
Assert.assertEquals(range.from, next);
next = range.to;
}
}
use of org.broadinstitute.hellbender.tools.exome.germlinehmm.CopyNumberTriState in project gatk by broadinstitute.
the class XHMMSegmentCallerIntegrationTest method assertOutputIsInOrder.
private void assertOutputIsInOrder(final List<HiddenStateSegmentRecord<CopyNumberTriState, Target>> outputRecords, final TargetCollection<Target> targets) {
for (int i = 1; i < outputRecords.size(); i++) {
final HiddenStateSegmentRecord<CopyNumberTriState, Target> nextRecord = outputRecords.get(i);
final HiddenStateSegmentRecord<CopyNumberTriState, Target> previousRecord = outputRecords.get(i - 1);
final IndexRange nextRange = targets.indexRange(nextRecord.getSegment());
final IndexRange previousRange = targets.indexRange(previousRecord.getSegment());
Assert.assertTrue(nextRange.from >= previousRange.from);
}
}
use of org.broadinstitute.hellbender.tools.exome.germlinehmm.CopyNumberTriState in project gatk by broadinstitute.
the class XHMMSegmentCallerIntegrationTest method assertSampleSegmentsCoordinates.
private void assertSampleSegmentsCoordinates(List<HiddenStateSegmentRecord<CopyNumberTriState, Target>> sampleRecords, TargetCollection<Target> targets) {
for (final HiddenStateSegmentRecord<CopyNumberTriState, Target> record : sampleRecords) {
final IndexRange range = targets.indexRange(record.getSegment());
Assert.assertTrue(range.size() > 0);
Assert.assertEquals(record.getSegment().getContig(), targets.location(range.from).getContig());
Assert.assertEquals(record.getSegment().getStart(), targets.location(range.from).getStart());
Assert.assertEquals(record.getSegment().getEnd(), targets.location(range.to - 1).getEnd());
}
}
use of org.broadinstitute.hellbender.tools.exome.germlinehmm.CopyNumberTriState in project gatk by broadinstitute.
the class XHMMSegmentGenotyperIntegrationTest method assertVariantsAreCoveredBySegments.
private void assertVariantsAreCoveredBySegments(final List<VariantContext> variants, final List<HiddenStateSegmentRecord<CopyNumberTriState, Target>> variantSegments) {
for (final VariantContext variant : variants) {
final List<HiddenStateSegmentRecord<CopyNumberTriState, Target>> matches = variantSegments.stream().filter(s -> new SimpleInterval(variant).equals(s.getSegment().getInterval())).collect(Collectors.toList());
Assert.assertFalse(matches.isEmpty());
for (final Genotype genotype : variant.getGenotypes()) {
final boolean discovery = genotype.getExtendedAttribute(XHMMSegmentGenotyper.DISCOVERY_KEY).toString().equals(XHMMSegmentGenotyper.DISCOVERY_TRUE);
if (discovery) {
Assert.assertTrue(matches.stream().anyMatch(s -> s.getSampleName().equals(genotype.getSampleName())));
} else {
Assert.assertTrue(matches.stream().noneMatch(s -> s.getSampleName().equals(genotype.getSampleName())));
}
}
}
}
Aggregations