use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class HDF5PCACoveragePoNCreationUtilsUnitTest method testCalculateVarianceCalculation.
@Test
public void testCalculateVarianceCalculation() {
final JavaSparkContext ctx = SparkContextFactory.getTestSparkContext();
try (final HDF5File ponHDF5File = new HDF5File(TEST_FULL_PON_FILE)) {
final PCACoveragePoN pon = new HDF5PCACoveragePoN(ponHDF5File);
final PCATangentNormalizationResult tnWithSpark = pon.normalizeNormalsInPoN(ctx);
final double[] variances = MatrixSummaryUtils.getRowVariances(tnWithSpark.getTangentNormalized().counts());
final double[] targetVariances = pon.getTargetVariances();
PoNTestUtils.assertEqualsDoubleArrays(targetVariances, variances);
}
}
use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class HDF5PCACoveragePoNUnitTest method testTargetNameReading.
@Test
public void testTargetNameReading() throws IOException {
final HDF5File reader = new HDF5File(TEST_PON);
final PCACoveragePoN pon = new HDF5PCACoveragePoN(reader);
final List<String> targetNames = pon.getTargetNames();
final List<String> expected = readLines(TEST_PON_TARGETS);
Assert.assertNotNull(targetNames);
Assert.assertEquals(targetNames, expected);
reader.close();
}
use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class HDF5PCACoveragePoNUnitTest method testReducedPoNPInvMatrixReading.
@Test(dependsOnMethods = { "testTargetNameReading", "testLogNormalizedSampleNameReading" })
public void testReducedPoNPInvMatrixReading() throws IOException {
final HDF5File reader = new HDF5File(TEST_PON);
final PCACoveragePoN pon = new HDF5PCACoveragePoN(reader);
final List<String> targets = pon.getTargetNames();
final List<String> samples = pon.getPanelSampleNames();
final RealMatrix actual = pon.getReducedPanelPInverseCounts();
Assert.assertNotNull(actual);
Assert.assertTrue(actual.getRowDimension() <= samples.size());
Assert.assertEquals(actual.getColumnDimension(), targets.size());
final RealMatrix expected = readDoubleMatrix(TEST_PON_REDUCED_PON_PINV);
MathObjectAsserts.assertRealMatrixEquals(actual, expected);
}
use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class HDF5PCACoveragePoNUnitTest method testVersionReading.
@Test
public void testVersionReading() {
final HDF5File reader = new HDF5File(TEST_PON);
final PCACoveragePoN pon = new HDF5PCACoveragePoN(reader);
Assert.assertEquals(pon.getVersion(), TEST_PON_VERSION);
reader.close();
}
use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class HDF5PCACoveragePoNUnitTest method testReducedPoNMatrixReading.
@Test(dependsOnMethods = { "testTargetNameReading", "testLogNormalizedSampleNameReading" })
public void testReducedPoNMatrixReading() throws IOException {
final HDF5File reader = new HDF5File(TEST_PON);
final PCACoveragePoN pon = new HDF5PCACoveragePoN(reader);
final List<String> targets = pon.getTargetNames();
final List<String> samples = pon.getPanelSampleNames();
final RealMatrix actual = pon.getReducedPanelCounts();
Assert.assertNotNull(actual);
Assert.assertEquals(actual.getRowDimension(), targets.size());
Assert.assertTrue(actual.getColumnDimension() <= samples.size());
final RealMatrix expected = readDoubleMatrix(TEST_PON_REDUCED_PON);
MathObjectAsserts.assertRealMatrixEquals(actual, expected);
}
Aggregations