forked from reedacartwright/novo-muta
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_trio_model.py
41 lines (31 loc) · 1.06 KB
/
test_trio_model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
import unittest
import numpy as np
from family.trio_model import TrioModel
from family import utilities as ut
class TestTrioModel(unittest.TestCase):
def setUp(self):
self.trio_model = TrioModel(
reads=[[30, 0, 0, 0],
[30, 0, 0, 0],
[30, 0, 0, 0]]
)
def test_pop_sample(self):
parent_prob_mat = self.trio_model.pop_sample()
proba = np.sum(parent_prob_mat)
self.assertAlmostEqual(proba, 1)
def test_germ_muta(self):
proba = np.sum(self.trio_model.child_prob_mat)
self.assertAlmostEqual(proba, 256)
def test_soma_muta(self):
proba = np.sum(self.trio_model.soma_prob_mat)
self.assertAlmostEqual(proba, 16)
def test_seq_err(self):
seq_prob_mat = self.trio_model.seq_err_all()
proba = np.sum(seq_prob_mat)
self.assertAlmostEqual(proba, 3)
def test_trio(self):
proba = self.trio_model.trio()
self.assertAlmostEqual(proba, 0)
if __name__ == '__main__':
unittest.main()