Exemple #1
0
    def test_select_samples(self):
        '''Create sub-problem by selecting samples/family..'''
        p = io.read_npz(itu.FAMILY13_STAGE3)
        f = p.families()[0]
        ps = p.sub_problem(f.member_list)
        pf = p.sub_problem_of_parents(f.father, f.mother)

        # pf has family_info entry, ps doesn't
        assert_equal(ps.pedigree.graph.nodes(), pf.pedigree.graph.nodes(),
                     'Incorrect pedigree graph nodes')
        assert_equal(set(ps.pedigree.graph.edges()),
                     set(pf.pedigree.graph.edges()),
                     'Incorrect pedigree graph edges')
        assert_equal(ps.pedigree.sample_id.tolist(),
                     pf.pedigree.sample_id.tolist(),
                     'Incorrect pedigree sample ID array')
        assert_equal(ps.pedigree, pf.pedigree, 'Incorrect pedigree')
        assert_equal(ps.genotype, pf.genotype, 'Incorrect genotype')
        assert_equal(ps.haplotype, pf.haplotype, 'Incorrect haplotype')
        self.assertTrue(ps.info.family_info != pf.info.family_info,
                        'Incorrect info family')
        assert_not_equal(ps.info, pf.info, 'Incorrect info')
        assert_not_equal(ps, pf,
                         'pf should have a family_info entry, ps shouldn'
                         't')
Exemple #2
0
 def testMatrixDecompose(self):
     matrix = Matrix("[1,2;3,4]")
     assert (matrix.decompose() == None)
     assert_not_equal(matrix.decompose('D'), matrix.decompose('U'))
     assert_equal(matrix.decompose('D'), Matrix('[1,0;0,4]'))
     assert_equal(matrix.decompose('U'), Matrix('[0,2;0,0]'))
     assert_equal(matrix.decompose('L'), Matrix('[0,0;3,0]'))
     assert_equal(matrix.decompose('LU'), Matrix('[0,2;3,0]'))
     assert_equal(matrix.decompose('DL'), Matrix('[1,0;3,4]'))
Exemple #3
0
    def test_select_samples(self):
        '''Create sub-problem by selecting samples/family..'''
        p = io.read_npz(itu.FAMILY13_STAGE3)
        f = p.families()[0]
        ps = p.sub_problem(f.member_list)
        pf = p.sub_problem_of_parents(f.father, f.mother)

        # pf has family_info entry, ps doesn't
        assert_equal(ps.pedigree.graph.nodes(), pf.pedigree.graph.nodes(), 'Incorrect pedigree graph nodes')
        assert_equal(set(ps.pedigree.graph.edges()), set(pf.pedigree.graph.edges()), 'Incorrect pedigree graph edges')
        assert_equal(ps.pedigree.sample_id.tolist(), pf.pedigree.sample_id.tolist(), 'Incorrect pedigree sample ID array')
        assert_equal(ps.pedigree, pf.pedigree, 'Incorrect pedigree')
        assert_equal(ps.genotype, pf.genotype, 'Incorrect genotype')
        assert_equal(ps.haplotype, pf.haplotype, 'Incorrect haplotype')
        self.assertTrue(ps.info.family_info != pf.info.family_info, 'Incorrect info family')
        assert_not_equal(ps.info, pf.info, 'Incorrect info')
        assert_not_equal(ps, pf, 'pf should have a family_info entry, ps shouldn''t')