use of org.broadinstitute.hellbender.tools.exome.Target in project gatk by broadinstitute.
the class XHMMModelUnitTest method testLogTransitionProbability.
@Test(dataProvider = "testData", dependsOnMethods = "testInstantiation")
public void testLogTransitionProbability(final double eventStartProbability, final double meanEventSize, final double deletionMean, final double duplicationMean) {
final XHMMModel model = new XHMMModel(eventStartProbability, meanEventSize, deletionMean, duplicationMean);
final Target fromTarget = new Target("target1", new SimpleInterval("1", 1000000000, 1000000100));
for (final int distance : TEST_TARGET_DISTANCES) {
final Target toTargetDownstream = new Target("target2", new SimpleInterval("1", 1000000100 + distance + 1, 1000000200 + distance + 1));
final Target toTargetUpstream = new Target("target2", new SimpleInterval("1", 999999900 - distance - 1, 1000000000 - distance - 1));
for (final Target toTarget : Arrays.asList(toTargetDownstream, toTargetUpstream)) {
assertTransitionProbabilities(eventStartProbability, meanEventSize, model, fromTarget, toTarget);
}
}
}
use of org.broadinstitute.hellbender.tools.exome.Target in project gatk by broadinstitute.
the class XHMMModelUnitTest method testLogPrior.
//the prior should be the infinite distance limit of the transition matrix
@Test(dataProvider = "testData", dependsOnMethods = "testInstantiation")
public void testLogPrior(final double eventStartProbability, final double meanEventSize, final double deletionMean, final double duplicationMean) {
final XHMMModel model = new XHMMModel(eventStartProbability, meanEventSize, deletionMean, duplicationMean);
final Target target = new Target("NAME");
final CopyNumberTriStateTransitionProbabilityCache logTransitionProbabilityCache = new CopyNumberTriStateTransitionProbabilityCache(meanEventSize, eventStartProbability);
for (final CopyNumberTriState state : CopyNumberTriState.values()) {
Assert.assertEquals(model.logPriorProbability(state, target), logTransitionProbabilityCache.logProbability(Integer.MAX_VALUE, state, CopyNumberTriState.NEUTRAL), 1e-10);
}
}
use of org.broadinstitute.hellbender.tools.exome.Target in project gatk by broadinstitute.
the class ConvertGSVariantsToSegmentsIntegrationTest method composeExpectedSegments.
private List<HiddenStateSegmentRecord<CopyNumberTriState, Target>> composeExpectedSegments(final File vcf, final TargetCollection<Target> targets) throws IOException {
final VCFFileReader reader = new VCFFileReader(vcf, false);
final List<HiddenStateSegmentRecord<CopyNumberTriState, Target>> result = new ArrayList<>();
reader.iterator().forEachRemaining(vc -> {
final int targetCount = targets.indexRange(vc).size();
for (final Genotype genotype : vc.getGenotypes()) {
final int cn = Integer.parseInt(genotype.getExtendedAttribute("CN").toString());
final double[] cnp = Stream.of(genotype.getExtendedAttribute("CNP").toString().replaceAll("\\[\\]", "").split(",")).mapToDouble(Double::parseDouble).toArray();
final double cnpSum = MathUtils.approximateLog10SumLog10(cnp);
final CopyNumberTriState call = expectedCall(cn);
final double exactLog10Prob = expectedExactLog10(call, cnp);
final HiddenStateSegment<CopyNumberTriState, Target> expectedSegment = new HiddenStateSegment<>(new SimpleInterval(vc), targetCount, Double.parseDouble(genotype.getExtendedAttribute("CNF").toString()), 0.000, call, -10.0 * exactLog10Prob, Double.NaN, Double.NaN, Double.NaN, -10.0 * (cnp[ConvertGSVariantsToSegments.NEUTRAL_COPY_NUMBER_DEFAULT] - cnpSum));
result.add(new HiddenStateSegmentRecord<>(genotype.getSampleName(), expectedSegment));
}
});
return result;
}
use of org.broadinstitute.hellbender.tools.exome.Target in project gatk-protected by broadinstitute.
the class GermlineCNVCallerIntegrationTest method runCaseSampleCallingTestOnExactModelParams.
private void runCaseSampleCallingTestOnExactModelParams(final String... extraArgs) {
runCommandLine(getCallingOnExactModelArgs(ArrayUtils.addAll(new String[] { "--" + GermlineCNVCaller.INPUT_MODEL_PATH_LONG_NAME, TEST_TRUTH_SIM_MODEL.getAbsolutePath() }, extraArgs)));
final List<Target> callingTargets = TargetTableReader.readTargetFile(new File(CALLING_POSTERIORS_OUTPUT_PATH, CoverageModelGlobalConstants.TARGET_LIST_OUTPUT_FILE));
reportCopyNumberSummaryStatistics(CALLING_POSTERIORS_OUTPUT_PATH, TEST_CALLING_COMBINED_COPY_NUMBER_FILE, callingTargets, CALLING_SEX_GENOTYPES_DATA);
logger.info("Copy number concordance test passed for case sample calling");
}
use of org.broadinstitute.hellbender.tools.exome.Target in project gatk-protected by broadinstitute.
the class GermlineCNVCallerIntegrationTest method runLearningAndCallingTest.
private void runLearningAndCallingTest(final String... extraArgs) {
runCommandLine(getLearningArgs(extraArgs));
final List<Target> modelledTargets = TargetTableReader.readTargetFile(new File(LEARNING_MODEL_OUTPUT_PATH, CoverageModelGlobalConstants.TARGET_LIST_OUTPUT_FILE));
reportCopyNumberSummaryStatistics(LEARNING_POSTERIORS_OUTPUT_PATH, TEST_LEARNING_COMBINED_COPY_NUMBER_FILE, modelledTargets, LEARNING_SEX_GENOTYPES_DATA);
logger.info("Copy number concordance test passed for simultaneous learning and calling");
}
Aggregations