use of org.broadinstitute.hdf5.HDF5File in project gatk by broadinstitute.
the class HDF5PCACoveragePoNUnitTest method testLogNormalizedMatrixReading.
@Test(dependsOnMethods = { "testTargetNameReading", "testLogNormalizedSampleNameReading" })
public void testLogNormalizedMatrixReading() 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.getLogNormalizedCounts();
Assert.assertNotNull(actual);
Assert.assertEquals(actual.getRowDimension(), targets.size());
Assert.assertEquals(actual.getColumnDimension(), samples.size());
final RealMatrix expected = readDoubleMatrix(TEST_PON_LOG_NORMALS);
MathObjectAsserts.assertRealMatrixEquals(actual, expected);
}
use of org.broadinstitute.hdf5.HDF5File in project gatk 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 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 by broadinstitute.
the class PCATangentNormalizationUtilsUnitTest method testSparkTangentNormalizeSparkVsNoSpark.
@Test
public void testSparkTangentNormalizeSparkVsNoSpark() {
final JavaSparkContext ctx = SparkContextFactory.getTestSparkContext();
final File ponFile = PoNTestUtils.createDummyHDF5FilePoN(TEST_PCOV_FILE, 20);
try (final HDF5File ponHDF5File = new HDF5File(ponFile)) {
final PCACoveragePoN pon = new HDF5PCACoveragePoN(ponHDF5File);
final PCATangentNormalizationResult tnWithSpark = pon.normalizeNormalsInPoN(ctx);
final PCATangentNormalizationResult tnWithoutSpark = pon.normalizeNormalsInPoN();
PoNTestUtils.assertEqualsMatrix(tnWithSpark.getTangentNormalized().counts(), tnWithoutSpark.getTangentNormalized().counts(), false);
PoNTestUtils.assertEqualsMatrix(tnWithSpark.getPreTangentNormalized().counts(), tnWithoutSpark.getPreTangentNormalized().counts(), false);
PoNTestUtils.assertEqualsMatrix(tnWithSpark.getTangentBetaHats(), tnWithoutSpark.getTangentBetaHats(), false);
}
}
use of org.broadinstitute.hdf5.HDF5File in project gatk 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);
}
Aggregations