forked from klebgenomics/Kleborate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_iro.py
87 lines (76 loc) · 3.47 KB
/
test_iro.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
"""
Copyright 2018 Kat Holt
Copyright 2018 Ryan Wick ([email protected])
https://github.com/katholt/Kleborate/
This file is part of Kleborate. Kleborate is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version. Kleborate is distributed in
the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along with Kleborate. If
not, see <http://www.gnu.org/licenses/>.
"""
import unittest
from kleborate.kleborate import get_data_path, get_iro_mlst_results
class TestIro(unittest.TestCase):
"""
Tests salmochelin ST calls.
"""
def setUp(self):
self.data_dir = get_data_path()
def test_iro_random(self):
"""
This test has just random sequence and should give no iro call.
"""
results = get_iro_mlst_results(self.data_dir, 'test/sequences/test_random.fasta')
self.assertEqual(results['iroB'], '-')
self.assertEqual(results['iroC'], '-')
self.assertEqual(results['iroD'], '-')
self.assertEqual(results['iroN'], '-')
self.assertEqual(results['Salmochelin'], '-')
self.assertEqual(results['SmST'], '0')
def test_iro_exact(self):
"""
This test is an exact match for SmST33.
"""
results = get_iro_mlst_results(self.data_dir, 'test/sequences/test_iro_1.fasta')
self.assertEqual(results['iroB'], '22')
self.assertEqual(results['iroC'], '33')
self.assertEqual(results['iroD'], '12')
self.assertEqual(results['iroN'], '15')
self.assertEqual(results['Salmochelin'], 'iro 4')
self.assertEqual(results['SmST'], '33')
def test_iro_inexact(self):
"""
This test is an inexact match for SmST33. There are single base changes in iroC and in
iroN.
"""
results = get_iro_mlst_results(self.data_dir, 'test/sequences/test_iro_2.fasta')
self.assertEqual(results['iroB'], '22')
self.assertEqual(results['iroC'], '33*')
self.assertEqual(results['iroD'], '12')
self.assertEqual(results['iroN'], '15*')
self.assertEqual(results['Salmochelin'], 'iro 4')
self.assertEqual(results['SmST'], '33-2LV')
def test_iro_novel(self):
"""
This test is an exact match for alleles, but an unknown combination.
"""
results = get_iro_mlst_results(self.data_dir, 'test/sequences/test_iro_3.fasta')
self.assertEqual(results['iroB'], '11')
self.assertEqual(results['iroC'], '1')
self.assertEqual(results['iroD'], '18')
self.assertEqual(results['iroN'], '5')
self.assertEqual(results['Salmochelin'], 'iro unknown')
self.assertEqual(results['SmST'], '0')
def test_iro_incomplete(self):
"""
This test is an exact match for only one allele.
"""
results = get_iro_mlst_results(self.data_dir, 'test/sequences/test_iro_4.fasta')
self.assertEqual(results['iroB'], '-')
self.assertEqual(results['iroC'], '1')
self.assertEqual(results['iroD'], '-')
self.assertEqual(results['iroN'], '-')
self.assertEqual(results['Salmochelin'], '-')
self.assertEqual(results['SmST'], '0')