Skip to content

Commit 05946f1

Browse files
update set_sequence_register tests
1 parent c6766c3 commit 05946f1

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

conkit/core/contactmap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ def set_sequence_register(self, altloc=False):
539539
else:
540540
res1_index = c.res1_seq
541541
res2_index = c.res2_seq
542-
if res1_index <= seq_len or res2_index <= seq_len:
542+
if res1_index <= seq_len and res2_index <= seq_len:
543543
c.res1 = self.sequence.seq[res1_index - 1]
544544
c.res2 = self.sequence.seq[res2_index - 1]
545545
else:

conkit/core/tests/test_contactmap.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,22 @@ def test_set_sequence_register_2(self):
432432
[("A", "E"), ("B", "F"), ("A", "D"), ("C", "F"), ("B", "E")], [(c.res1, c.res2) for c in contact_map1]
433433
)
434434

435+
def test_set_sequence_register_3(self):
436+
contact_map1 = ContactMap("1")
437+
for comb in [(1, 5, 1.0), (2, 6, 1.0), (1, 4, 1.0), (3, 6, 1.0), (2, 5, 1.0)]:
438+
contact_map1.add(Contact(*comb))
439+
contact_map1.sequence = Sequence("foo", "ABCDE")
440+
with self.assertRaises(ValueError):
441+
contact_map1.set_sequence_register()
442+
443+
def test_set_sequence_register_4(self):
444+
contact_map1 = ContactMap("1")
445+
for comb in [(1, 5, 1.0), (6, 3, 1.0), (1, 4, 1.0), (3, 2, 1.0), (2, 5, 1.0)]:
446+
contact_map1.add(Contact(*comb))
447+
contact_map1.sequence = Sequence("foo", "ABCDE")
448+
with self.assertRaises(ValueError):
449+
contact_map1.set_sequence_register()
450+
435451
def test_match_1(self):
436452
contact_map1 = ContactMap("foo")
437453
for params in [(1, 5, 1.0), (1, 6, 1.0), (2, 7, 1.0), (3, 5, 1.0), (2, 8, 1.0)]:

0 commit comments

Comments
 (0)