Example #1
0
 def test_homalt_homalt(self):
     parents = np.hstack([self.halt_parent, self.halt_parent])
     non_mendelian = diploid_mendelian_error_biallelic(
         parental_genotypes=parents,
         progeny_genotypes=self.progeny
     )
     self.assertTrue(np.array_equal(non_mendelian[0], [2, 1, 0, 0]))
Example #2
0
    def test_multiple_variants(self):
        parents = np.vstack([np.hstack([self.href_parent, self.href_parent]),
                             np.hstack([self.halt_parent, self.halt_parent]),
                             np.hstack([self.het_parent, self.halt_parent]),
                             np.hstack([self.het_parent, self.het_parent])])

        multiv_progeny = np.repeat(self.progeny, 4, axis=0)

        non_mendelian = diploid_mendelian_error_biallelic(
            parental_genotypes=parents,
            progeny_genotypes=multiv_progeny
        )

        expected_result = np.array([[0, 1, 2, 0],
                                    [2, 1, 0, 0],
                                    [1, 0, 0, 0],
                                    [0, 0, 0, 0]])
        self.assertTrue(np.array_equal(parents.shape, (4, 2, 2)))
        self.assertTrue(np.array_equal(non_mendelian.shape,
                                       expected_result.shape))

        self.assertTrue(np.array_equal(non_mendelian, expected_result))