use of org.broadinstitute.hellbender.utils.svd.SVD in project gatk by broadinstitute.
the class HDF5PCACoveragePoNCreationUtilsUnitTest method testDetermineNumberOfEigensamplesNoSpark.
@Test(dataProvider = "singleEigensample")
public void testDetermineNumberOfEigensamplesNoSpark(final ReadCountCollection logNormals) {
final SVD logNormalsSVD = SVDFactory.createSVD(logNormals.counts());
final int actualNumber = HDF5PCACoveragePoNCreationUtils.determineNumberOfEigensamples(OptionalInt.empty(), logNormals.columnNames().size(), logNormalsSVD, NULL_LOGGER);
Assert.assertEquals(actualNumber, 1);
}
use of org.broadinstitute.hellbender.utils.svd.SVD in project gatk-protected by broadinstitute.
the class DecomposeSingularValuesIntegrationTest method assertSVDValues.
private void assertSVDValues(final File outputFileV, final File outputFileS, final File outputFileU) {
try {
final ReadCountCollection rcc = ReadCountCollectionUtils.parse(CONTROL_PCOV_FULL_FILE);
final SVD svd = SVDFactory.createSVD(rcc.counts());
final RealMatrix sDiag = new DiagonalMatrix(svd.getSingularValues());
assertOutputFileValues(outputFileU, svd.getU());
assertOutputFileValues(outputFileS, sDiag);
assertOutputFileValues(outputFileV, svd.getV());
assertUnitaryMatrix(svd.getV());
assertUnitaryMatrix(svd.getU());
Assert.assertTrue(MatrixUtils.isSymmetric(sDiag, 1e-32));
} catch (final IOException ioe) {
Assert.fail("Could not open test file: " + CONTROL_PCOV_FULL_FILE, ioe);
}
}
use of org.broadinstitute.hellbender.utils.svd.SVD in project gatk-protected by broadinstitute.
the class DecomposeSingularValues method runPipeline.
@Override
protected void runPipeline(final JavaSparkContext ctx) {
try {
final ReadCountCollection rcc = ReadCountCollectionUtils.parse(inputFile);
final SVD svd = SVDFactory.createSVD(rcc.counts(), ctx);
writeMatrix(svd.getV(), outputFileV);
writeMatrix(svd.getU(), outputFileU);
writeMatrix(new DiagonalMatrix(svd.getSingularValues()), outputFileS);
} catch (final IOException ioe) {
throw new UserException.CouldNotReadInputFile(inputFile, ioe.getMessage());
}
}
use of org.broadinstitute.hellbender.utils.svd.SVD in project gatk-protected by broadinstitute.
the class HDF5PCACoveragePoNCreationUtilsUnitTest method testDetermineNumberOfEigensamplesNoSpark.
@Test(dataProvider = "singleEigensample")
public void testDetermineNumberOfEigensamplesNoSpark(final ReadCountCollection logNormals) {
final SVD logNormalsSVD = SVDFactory.createSVD(logNormals.counts());
final int actualNumber = HDF5PCACoveragePoNCreationUtils.determineNumberOfEigensamples(OptionalInt.empty(), logNormals.columnNames().size(), logNormalsSVD, NULL_LOGGER);
Assert.assertEquals(actualNumber, 1);
}
use of org.broadinstitute.hellbender.utils.svd.SVD in project gatk-protected by broadinstitute.
the class HDF5PCACoveragePoNCreationUtilsUnitTest method testDetermineNumberOfEigensamplesSpark.
@Test(dataProvider = "singleEigensample")
public void testDetermineNumberOfEigensamplesSpark(final ReadCountCollection logNormals) {
final JavaSparkContext ctx = SparkContextFactory.getTestSparkContext();
final SVD logNormalsSVD = SVDFactory.createSVD(logNormals.counts(), ctx);
final int actualNumber = HDF5PCACoveragePoNCreationUtils.determineNumberOfEigensamples(OptionalInt.empty(), logNormals.columnNames().size(), logNormalsSVD, NULL_LOGGER);
Assert.assertEquals(actualNumber, 1);
}
Aggregations