コード例 #1
0
class TestFileIdCoefDao(unittest.TestCase):
    #---------------------------------------------
    # Constants
    #---------------------------------------------

    #---------------------------------------------
    # Setup Methods
    #---------------------------------------------
    def setUp(self):
        '''Use a localhost UCSC copy.'''
        self.idcoef_dao = IdCoefDao(tu.abs_path('pedigree/example.id'))
        self.kinship_dao = KinshipDao(tu.abs_path('pedigree/example.kinship'))

    #---------------------------------------------
    # Test Methods
    #---------------------------------------------
    def test_num_records(self):
        '''Test getting the total # of SNP records.'''
        assert_equal(self.idcoef_dao.num_records(), 3**2,
                     'Wrong row count from SNP table')

    def test_delta(self):
        '''Test retrieving condensed identity coefficient for a pair of samples.'''
        lam, delta = self.idcoef_dao.id_coefs(168042, 163352)
        assert_almost_equal(
            lam,
            0.341689,
            decimal=5,
            err_msg='Wrong SNP lambda coefficient loading from file')
        assert_almost_equal(delta,
                            np.array([
                                6.89670924e-05, 0.0016811301, 0.00197529634,
                                0.0418526094, 0.00258931545, 0.0338666878,
                                0.00123981348, 0.0908498468, 0.825876333
                            ]),
                            decimal=5,
                            err_msg='Wrong SNP Delta loading from file')

    def test_kinship(self):
        '''Test retrieving kinship coefficients for a pair of samples.'''
        assert_equal(self.kinship_dao.num_records(), 3**2,
                     'Wrong row count from SNP table')

        _, delta = self.idcoef_dao.id_coefs(168042, 163352)
        f = self.kinship_dao.kinship(168042, 163352)

        assert_almost_equal(
            f,
            _kinship(delta),
            decimal=5,
            err_msg=
            'Kinship coefficient does not match value derived from identity coefficients'
        )
コード例 #2
0
ファイル: TestFileIdCoefDao.py プロジェクト: orenlivne/ober
class TestFileIdCoefDao(unittest.TestCase):
    #---------------------------------------------
    # Constants
    #---------------------------------------------
    
    #---------------------------------------------
    # Setup Methods
    #---------------------------------------------
    def setUp(self):
        '''Use a localhost UCSC copy.'''
        self.idcoef_dao = IdCoefDao(tu.abs_path('pedigree/example.id'))
        self.kinship_dao = KinshipDao(tu.abs_path('pedigree/example.kinship'))
    
    #---------------------------------------------
    # Test Methods
    #---------------------------------------------
    def test_num_records(self):
        '''Test getting the total # of SNP records.'''
        assert_equal(self.idcoef_dao.num_records(), 3 ** 2, 'Wrong row count from SNP table')

    def test_delta(self):
        '''Test retrieving condensed identity coefficient for a pair of samples.'''
        lam, delta = self.idcoef_dao.id_coefs(168042, 163352)
        assert_almost_equal(lam, 0.341689,
                            decimal=5, err_msg='Wrong SNP lambda coefficient loading from file')
        assert_almost_equal(delta,
                            np.array([6.89670924e-05, 0.0016811301, 0.00197529634, 0.0418526094,
                                      0.00258931545, 0.0338666878, 0.00123981348, 0.0908498468,
                                      0.825876333]),
                            decimal=5, err_msg='Wrong SNP Delta loading from file')

    def test_kinship(self):
        '''Test retrieving kinship coefficients for a pair of samples.'''
        assert_equal(self.kinship_dao.num_records(), 3 ** 2, 'Wrong row count from SNP table')

        _, delta = self.idcoef_dao.id_coefs(168042, 163352)
        f = self.kinship_dao.kinship(168042, 163352)
        
        assert_almost_equal(f, _kinship(delta),
                            decimal=5, err_msg='Kinship coefficient does not match value derived from identity coefficients')
コード例 #3
0
 def setUp(self):
     '''Use a localhost UCSC copy.'''
     self.idcoef_dao = IdCoefDao(tu.abs_path('pedigree/example.id'))
     self.kinship_dao = KinshipDao(tu.abs_path('pedigree/example.kinship'))
コード例 #4
0
ファイル: TestFileIdCoefDao.py プロジェクト: orenlivne/ober
 def setUp(self):
     '''Use a localhost UCSC copy.'''
     self.idcoef_dao = IdCoefDao(tu.abs_path('pedigree/example.id'))
     self.kinship_dao = KinshipDao(tu.abs_path('pedigree/example.kinship'))