use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class HDF5PCACoveragePoNUnitTest method testLogNormalizedPInvMatrixReading.
@Test(dependsOnMethods = { "testTargetNameReading", "testLogNormalizedSampleNameReading" })
public void testLogNormalizedPInvMatrixReading() 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.getLogNormalizedPInverseCounts();
Assert.assertNotNull(actual);
Assert.assertEquals(actual.getRowDimension(), samples.size());
Assert.assertEquals(actual.getColumnDimension(), targets.size());
final RealMatrix expected = readDoubleMatrix(TEST_PON_LOG_NORMALS_PINV);
MathObjectAsserts.assertRealMatrixEquals(actual, expected);
}
use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class PCATangentNormalizationUtilsUnitTest method testSparkNormalizeNormalsFullPoN.
@Test
public void testSparkNormalizeNormalsFullPoN() {
final JavaSparkContext ctx = SparkContextFactory.getTestSparkContext();
try (final HDF5File ponHDF5File = new HDF5File(TEST_FULL_PON)) {
final PCACoveragePoN pon = new HDF5PCACoveragePoN(ponHDF5File);
final RealMatrix gtTNedNormals = PoNTestUtils.readTsvIntoMatrix(TEST_FULL_NORMALS_TN_FILE);
final PCATangentNormalizationResult tnWithSpark = pon.normalizeNormalsInPoN(ctx);
PoNTestUtils.assertEqualsMatrix(tnWithSpark.getTangentNormalized().counts(), gtTNedNormals, false);
}
}
use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class PCATangentNormalizationUtilsUnitTest method testSparkNormalizeNormalsSomePoN.
@Test
public void testSparkNormalizeNormalsSomePoN() {
final JavaSparkContext ctx = SparkContextFactory.getTestSparkContext();
try (final HDF5File ponHDF5File = new HDF5File(TEST_SOME_PON)) {
final PCACoveragePoN pon = new HDF5PCACoveragePoN(ponHDF5File);
final RealMatrix gtTNedNormals = PoNTestUtils.readTsvIntoMatrix(TEST_SOME_NORMALS_TN_FILE);
final PCATangentNormalizationResult tnWithSpark = pon.normalizeNormalsInPoN(ctx);
PoNTestUtils.assertEqualsMatrix(tnWithSpark.getTangentNormalized().counts(), gtTNedNormals, false);
}
}
use of org.broadinstitute.hdf5.HDF5File in project gatk-protected by broadinstitute.
the class RamPCACoveragePoNUnitTest method testCopiesReturnedOfMatrices.
@Test
public void testCopiesReturnedOfMatrices() {
final PCACoveragePoN filePoN = new HDF5PCACoveragePoN(new HDF5File(PoNTestUtils.createDummyHDF5FilePoN(TEST_PCOV_FILE, 20), HDF5File.OpenMode.READ_ONLY));
final PCACoveragePoN ramPoN = new RamPCACoveragePoN(filePoN);
assertNormalizedCounts(filePoN, ramPoN);
assertLogNormalizedCounts(filePoN, ramPoN);
assertLogNormalizedPinvCounts(filePoN, ramPoN);
assertReducedPanelCounts(filePoN, ramPoN);
assertLogNormalizedPinvCounts(filePoN, ramPoN);
assertReducedPanelPInverseCounts(filePoN, ramPoN);
PoNTestUtils.assertEquivalentPoN(ramPoN, filePoN);
}
use of org.broadinstitute.hdf5.HDF5File in project gatk by broadinstitute.
the class HDF5LibraryUnitTest method testMakeDoubleMatrix.
@Test()
public void testMakeDoubleMatrix() throws IOException {
final File testFile = File.createTempFile("hdf5", ".hd5");
HDF5File file = new HDF5File(testFile, HDF5File.OpenMode.CREATE);
file.makeGroup("test-group/double-group");
final double[][] testValues = new double[][] { new double[] { 1.1, -2.2, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0.0111e10 - 10 }, new double[] { -1.1, 2.2, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, -0.01111e10 - 10 } };
Assert.assertTrue(file.makeDoubleMatrix("test-group/double-group/my-double", testValues));
System.err.println(testFile);
file.close();
final long time = System.currentTimeMillis();
Assert.assertTrue(testFile.length() > 0);
Assert.assertTrue(testFile.lastModified() <= time);
file = new HDF5File(testFile, HDF5File.OpenMode.READ_ONLY);
final double[][] theDoubles = file.readDoubleMatrix("test-group/double-group/my-double");
Assert.assertTrue(Arrays.deepEquals(theDoubles, testValues.clone()));
file.close();
}
Aggregations