snplib 1.0.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- finalreport/__init__.py +7 -0
- finalreport/_finalreport.py +251 -0
- finalreport/tests/__init__.py +7 -0
- finalreport/tests/test_finalreport.py +215 -0
- format/__init__.py +19 -0
- format/__settings.py +7 -0
- format/_plink.py +305 -0
- format/_snp.py +113 -0
- format/tests/__init__.py +7 -0
- format/tests/test_plink_fam.py +121 -0
- format/tests/test_plink_lgen.py +106 -0
- format/tests/test_plink_map.py +42 -0
- format/tests/test_plink_ped.py +136 -0
- format/tests/test_snp.py +128 -0
- parentage/__init__.py +15 -0
- parentage/_discov.py +102 -0
- parentage/_isagmark.py +15 -0
- parentage/_verif.py +91 -0
- parentage/tests/__init__.py +7 -0
- parentage/tests/test_discov.py +164 -0
- parentage/tests/test_verif.py +160 -0
- snplib-1.0.0.dist-info/LICENSE +674 -0
- snplib-1.0.0.dist-info/METADATA +89 -0
- snplib-1.0.0.dist-info/RECORD +36 -0
- snplib-1.0.0.dist-info/WHEEL +5 -0
- snplib-1.0.0.dist-info/top_level.txt +4 -0
- statistics/__init__.py +16 -0
- statistics/_callrate.py +59 -0
- statistics/_freq.py +67 -0
- statistics/_snphwe.py +132 -0
- statistics/tests/__init__.py +7 -0
- statistics/tests/test_callrate.py +171 -0
- statistics/tests/test_freq_allele.py +87 -0
- statistics/tests/test_freq_maf.py +17 -0
- statistics/tests/test_hwe_t.py +41 -0
- statistics/tests/test_snphwe.py +41 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding: utf-8
|
3
|
+
__author__ = "Igor Loschinin (igor.loschinin@gmail.com)"
|
4
|
+
|
5
|
+
from .. import minor_allele_freq as maf
|
6
|
+
|
7
|
+
import pytest
|
8
|
+
|
9
|
+
|
10
|
+
class TestMinorAlleleFreq(object):
|
11
|
+
|
12
|
+
@pytest.mark.parametrize("value, res", [
|
13
|
+
(0.0, 0.0), (0.9, 0.1), (0.889, 0.111),
|
14
|
+
(0.714, 0.286), (0.22, 0.22), (0.45, 0.45), (0.6, 0.4)
|
15
|
+
])
|
16
|
+
def test_minor_allele_freq(self, value: float, res: float) -> None:
|
17
|
+
assert maf(value) == res
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding: utf-8
|
3
|
+
__author__ = "Igor Loschinin (igor.loschinin@gmail.com)"
|
4
|
+
|
5
|
+
from .. import hwe_test
|
6
|
+
|
7
|
+
import pytest
|
8
|
+
import pandas as pd
|
9
|
+
|
10
|
+
|
11
|
+
class TestHWE(object):
|
12
|
+
|
13
|
+
@pytest.mark.parametrize(
|
14
|
+
"seq, freq",
|
15
|
+
[
|
16
|
+
('2212120', 0.714),
|
17
|
+
('02011015010000500', 0.2),
|
18
|
+
('01110152120222512', 0.6),
|
19
|
+
('00005005005', 0.0),
|
20
|
+
('22521212222', 0.9),
|
21
|
+
('52221521222', 0.889)
|
22
|
+
]
|
23
|
+
)
|
24
|
+
def test_hweT_true(self, seq: str, freq: float) -> None:
|
25
|
+
"""
|
26
|
+
check snphwe gives expected p-values
|
27
|
+
"""
|
28
|
+
|
29
|
+
_seq_snp = pd.Series(list(map(int, seq)))
|
30
|
+
|
31
|
+
assert hwe_test(_seq_snp, freq)
|
32
|
+
|
33
|
+
@pytest.mark.parametrize("seq, freq", [('000000000102', 0.125)])
|
34
|
+
def test_hweT_false(self, seq: str, freq: float) -> None:
|
35
|
+
"""
|
36
|
+
check snphwe gives expected p-values
|
37
|
+
"""
|
38
|
+
|
39
|
+
_seq_snp = pd.Series(list(map(int, seq)))
|
40
|
+
|
41
|
+
assert not hwe_test(_seq_snp, freq)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# coding: utf-8
|
3
|
+
__author__ = "Igor Loschinin (igor.loschinin@gmail.com)"
|
4
|
+
|
5
|
+
from .. import hwe
|
6
|
+
|
7
|
+
import pytest
|
8
|
+
|
9
|
+
|
10
|
+
class TestHWE(object):
|
11
|
+
|
12
|
+
def test_snphwe(self) -> None:
|
13
|
+
"""
|
14
|
+
check snphwe gives expected p-values
|
15
|
+
"""
|
16
|
+
assert hwe(500, 10, 5000) == 0.6515718999145375
|
17
|
+
assert hwe(1000, 20, 5000) == 1.2659849194317374e-05
|
18
|
+
|
19
|
+
def test_snphwe_odd_inputs(self) -> None:
|
20
|
+
"""
|
21
|
+
check snphwe with odd inputs
|
22
|
+
"""
|
23
|
+
# should raise errors with odd inputs
|
24
|
+
|
25
|
+
with pytest.raises(ValueError, match="snphwe: zero genotypes"):
|
26
|
+
hwe(0, 0, 0)
|
27
|
+
|
28
|
+
with pytest.raises(ValueError, match="snphwe: negative allele count"):
|
29
|
+
hwe(-5, 10, 1000)
|
30
|
+
|
31
|
+
def test_snphwe_large_input(self) -> None:
|
32
|
+
"""
|
33
|
+
check snphwe doesn't give errors with large sample sizes
|
34
|
+
"""
|
35
|
+
assert hwe(200000, 200000, 200000) == 0.0
|
36
|
+
|
37
|
+
def test_snphwe_uncertain_genotypes(self) -> None:
|
38
|
+
"""
|
39
|
+
check uncertain genotypes give correct p-values
|
40
|
+
"""
|
41
|
+
assert hwe(4989.99999, 494999.999, 9.9999999) == 0.5702231983054381
|