Search in sources :

Example 1 with RamPCACoveragePoN

use of org.broadinstitute.hellbender.tools.pon.coverage.pca.RamPCACoveragePoN in project gatk by broadinstitute.

the class CreatePanelOfNormalsIntegrationTest method assertRamPoNDuplicate.

/**
     * Assert that we can create a valid ram pon duplicate.
     *
     * @param pon never {@code null}
     */
private void assertRamPoNDuplicate(final PCACoveragePoN pon) {
    final PCACoveragePoN ramPoN = new RamPCACoveragePoN(pon);
    PoNTestUtils.assertEqualsMatrix(pon.getLogNormalizedCounts(), ramPoN.getLogNormalizedCounts(), false);
    PoNTestUtils.assertEqualsMatrix(pon.getLogNormalizedPInverseCounts(), ramPoN.getLogNormalizedPInverseCounts(), false);
    PoNTestUtils.assertEqualsMatrix(pon.getNormalizedCounts(), ramPoN.getNormalizedCounts(), false);
    PoNTestUtils.assertEqualsMatrix(pon.getReducedPanelCounts(), ramPoN.getReducedPanelCounts(), false);
    PoNTestUtils.assertEqualsMatrix(pon.getReducedPanelPInverseCounts(), ramPoN.getReducedPanelPInverseCounts(), false);
    PoNTestUtils.assertEqualsDoubleArrays(pon.getTargetFactors(), ramPoN.getTargetFactors());
    final List<Target> ponPanelTargets = pon.getPanelTargets();
    final List<Target> ponTargets = pon.getTargets();
    final List<Target> ponRawTargets = pon.getRawTargets();
    final List<Target> ramPoNPanelTargets = ramPoN.getPanelTargets();
    final List<Target> ramPoNTargets = ramPoN.getTargets();
    final List<Target> ramPoNRawTargets = ramPoN.getRawTargets();
    Assert.assertEquals(ponPanelTargets.size(), ramPoNPanelTargets.size());
    Assert.assertEquals(ponTargets.size(), ramPoNTargets.size());
    // Make sure every target is the same
    Assert.assertTrue(IntStream.range(0, ponRawTargets.size()).boxed().allMatch(i -> ponRawTargets.get(i).equals(ramPoNRawTargets.get(i))));
    Assert.assertTrue(IntStream.range(0, ponTargets.size()).boxed().allMatch(i -> ponTargets.get(i).equals(ramPoNTargets.get(i))));
    Assert.assertTrue(IntStream.range(0, ponPanelTargets.size()).boxed().allMatch(i -> ponPanelTargets.get(i).equals(ramPoNPanelTargets.get(i))));
    // Make sure every sample name is the same
    Assert.assertTrue(IntStream.range(0, pon.getSampleNames().size()).boxed().allMatch(i -> pon.getSampleNames().get(i).equals(ramPoN.getSampleNames().get(i))));
    Assert.assertTrue(IntStream.range(0, pon.getPanelSampleNames().size()).boxed().allMatch(i -> pon.getPanelSampleNames().get(i).equals(ramPoN.getPanelSampleNames().get(i))));
    // Make sure every target name is the same
    Assert.assertTrue(IntStream.range(0, pon.getTargetNames().size()).boxed().allMatch(i -> pon.getTargetNames().get(i).equals(ramPoN.getTargetNames().get(i))));
    Assert.assertTrue(IntStream.range(0, pon.getPanelTargetNames().size()).boxed().allMatch(i -> pon.getPanelTargetNames().get(i).equals(ramPoN.getPanelTargetNames().get(i))));
}
Also used : IntStream(java.util.stream.IntStream) DataProvider(org.testng.annotations.DataProvider) FileUtils(org.apache.commons.io.FileUtils) StandardArgumentDefinitions(org.broadinstitute.hellbender.cmdline.StandardArgumentDefinitions) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest) File(java.io.File) ArrayList(java.util.ArrayList) HDF5PCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.HDF5PCACoveragePoN) List(java.util.List) PCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.PCACoveragePoN) UserException(org.broadinstitute.hellbender.exceptions.UserException) Assert(org.testng.Assert) HDF5File(org.broadinstitute.hdf5.HDF5File) RamPCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.RamPCACoveragePoN) PoNTestUtils(org.broadinstitute.hellbender.tools.pon.PoNTestUtils) IntRange(org.apache.commons.lang.math.IntRange) HDF5PCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.HDF5PCACoveragePoN) PCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.PCACoveragePoN) RamPCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.RamPCACoveragePoN) RamPCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.RamPCACoveragePoN)

Example 2 with RamPCACoveragePoN

use of org.broadinstitute.hellbender.tools.pon.coverage.pca.RamPCACoveragePoN in project gatk-protected by broadinstitute.

the class CreatePanelOfNormalsIntegrationTest method assertRamPoNDuplicate.

/**
     * Assert that we can create a valid ram pon duplicate.
     *
     * @param pon never {@code null}
     */
private void assertRamPoNDuplicate(final PCACoveragePoN pon) {
    final PCACoveragePoN ramPoN = new RamPCACoveragePoN(pon);
    PoNTestUtils.assertEqualsMatrix(pon.getLogNormalizedCounts(), ramPoN.getLogNormalizedCounts(), false);
    PoNTestUtils.assertEqualsMatrix(pon.getLogNormalizedPInverseCounts(), ramPoN.getLogNormalizedPInverseCounts(), false);
    PoNTestUtils.assertEqualsMatrix(pon.getNormalizedCounts(), ramPoN.getNormalizedCounts(), false);
    PoNTestUtils.assertEqualsMatrix(pon.getReducedPanelCounts(), ramPoN.getReducedPanelCounts(), false);
    PoNTestUtils.assertEqualsMatrix(pon.getReducedPanelPInverseCounts(), ramPoN.getReducedPanelPInverseCounts(), false);
    PoNTestUtils.assertEqualsDoubleArrays(pon.getTargetFactors(), ramPoN.getTargetFactors());
    final List<Target> ponPanelTargets = pon.getPanelTargets();
    final List<Target> ponTargets = pon.getTargets();
    final List<Target> ponRawTargets = pon.getRawTargets();
    final List<Target> ramPoNPanelTargets = ramPoN.getPanelTargets();
    final List<Target> ramPoNTargets = ramPoN.getTargets();
    final List<Target> ramPoNRawTargets = ramPoN.getRawTargets();
    Assert.assertEquals(ponPanelTargets.size(), ramPoNPanelTargets.size());
    Assert.assertEquals(ponTargets.size(), ramPoNTargets.size());
    // Make sure every target is the same
    Assert.assertTrue(IntStream.range(0, ponRawTargets.size()).boxed().allMatch(i -> ponRawTargets.get(i).equals(ramPoNRawTargets.get(i))));
    Assert.assertTrue(IntStream.range(0, ponTargets.size()).boxed().allMatch(i -> ponTargets.get(i).equals(ramPoNTargets.get(i))));
    Assert.assertTrue(IntStream.range(0, ponPanelTargets.size()).boxed().allMatch(i -> ponPanelTargets.get(i).equals(ramPoNPanelTargets.get(i))));
    // Make sure every sample name is the same
    Assert.assertTrue(IntStream.range(0, pon.getSampleNames().size()).boxed().allMatch(i -> pon.getSampleNames().get(i).equals(ramPoN.getSampleNames().get(i))));
    Assert.assertTrue(IntStream.range(0, pon.getPanelSampleNames().size()).boxed().allMatch(i -> pon.getPanelSampleNames().get(i).equals(ramPoN.getPanelSampleNames().get(i))));
    // Make sure every target name is the same
    Assert.assertTrue(IntStream.range(0, pon.getTargetNames().size()).boxed().allMatch(i -> pon.getTargetNames().get(i).equals(ramPoN.getTargetNames().get(i))));
    Assert.assertTrue(IntStream.range(0, pon.getPanelTargetNames().size()).boxed().allMatch(i -> pon.getPanelTargetNames().get(i).equals(ramPoN.getPanelTargetNames().get(i))));
}
Also used : IntStream(java.util.stream.IntStream) DataProvider(org.testng.annotations.DataProvider) FileUtils(org.apache.commons.io.FileUtils) StandardArgumentDefinitions(org.broadinstitute.hellbender.cmdline.StandardArgumentDefinitions) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest) File(java.io.File) ArrayList(java.util.ArrayList) HDF5PCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.HDF5PCACoveragePoN) List(java.util.List) PCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.PCACoveragePoN) UserException(org.broadinstitute.hellbender.exceptions.UserException) Assert(org.testng.Assert) HDF5File(org.broadinstitute.hdf5.HDF5File) RamPCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.RamPCACoveragePoN) PoNTestUtils(org.broadinstitute.hellbender.tools.pon.PoNTestUtils) IntRange(org.apache.commons.lang.math.IntRange) HDF5PCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.HDF5PCACoveragePoN) PCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.PCACoveragePoN) RamPCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.RamPCACoveragePoN) RamPCACoveragePoN(org.broadinstitute.hellbender.tools.pon.coverage.pca.RamPCACoveragePoN)

Aggregations

File (java.io.File)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 IntStream (java.util.stream.IntStream)2 FileUtils (org.apache.commons.io.FileUtils)2 IntRange (org.apache.commons.lang.math.IntRange)2 HDF5File (org.broadinstitute.hdf5.HDF5File)2 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)2 StandardArgumentDefinitions (org.broadinstitute.hellbender.cmdline.StandardArgumentDefinitions)2 UserException (org.broadinstitute.hellbender.exceptions.UserException)2 PoNTestUtils (org.broadinstitute.hellbender.tools.pon.PoNTestUtils)2 HDF5PCACoveragePoN (org.broadinstitute.hellbender.tools.pon.coverage.pca.HDF5PCACoveragePoN)2 PCACoveragePoN (org.broadinstitute.hellbender.tools.pon.coverage.pca.PCACoveragePoN)2 RamPCACoveragePoN (org.broadinstitute.hellbender.tools.pon.coverage.pca.RamPCACoveragePoN)2 Assert (org.testng.Assert)2 DataProvider (org.testng.annotations.DataProvider)2 Test (org.testng.annotations.Test)2