Skip to content

Commit

Permalink
[nomenclature._GPCR_fragments] fix typo in TM1, add C-term, update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gph82 committed Nov 20, 2024
1 parent ce3fbc1 commit a9d2698
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions mdciao/nomenclature/nomenclature.py
Original file line number Diff line number Diff line change
Expand Up @@ -2542,8 +2542,8 @@ def _sort_all_consensus_labels(labels, append_diffset=True, order=["GPCR","CGN",
"8": "H8",
}

_GPCR_fragments = ("NT",
"1", "TM1 ",
_GPCR_fragments = ("NT", "N-term",
"1", "TM1",
"12", "ICL1",
"2", "TM2",
"23", "ECL1",
Expand All @@ -2558,7 +2558,7 @@ def _sort_all_consensus_labels(labels, append_diffset=True, order=["GPCR","CGN",
"7", "TM7",
"78",
"8", "H8",
"CT")
"CT","C-term")

_CGN_fragments = ('G.HN',
'G.hns1',
Expand Down
33 changes: 17 additions & 16 deletions tests/test_nomenclature.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,28 +827,28 @@ def test_finds_frags_nothing_None(self):
class Test_sort_consensus_labels(unittest.TestCase):

def setUp(self):
self.tosort = ["G.H1.10", "H.HA.20", 'a.l.85', "H8.10", 'αC.25', "V34", "H8.1", "3.50", "2.50", "G.H1.1", "H.HA.10", 'αD.55']
self.tosort = ["C-term", "G.H1.10", "H.HA.20", 'a.l.85', "H8.10", 'αC.25', "V34", "H8.1", "3.50", "2.50", "G.H1.1", "H.HA.10", 'αD.55', "TM1"]

def test_GPCR(self):
def test_GPCR_1(self):
sorted = nomenclature._sort_GPCR_consensus_labels(self.tosort)
_np.testing.assert_array_equal(
["2.50", "3.50", "H8.1", "H8.10", "G.H1.10", "H.HA.20", 'a.l.85', 'αC.25', "V34", "G.H1.1", "H.HA.10", 'αD.55'],
["TM1", "2.50", "3.50", "H8.1", "H8.10", "C-term", "G.H1.10", "H.HA.20", 'a.l.85', 'αC.25', "V34", "G.H1.1", "H.HA.10", 'αD.55'],
sorted)
def test_GPCR(self):
def test_GPCR_2(self):
sorted = nomenclature._sort_GPCR_consensus_labels(["TM3", "TM2"])
_np.testing.assert_array_equal(
["TM2","TM3"],
sorted)

def test_GPCR_dont_append(self):
sorted = nomenclature._sort_GPCR_consensus_labels(self.tosort, append_diffset=False)
_np.testing.assert_array_equal(["2.50", "3.50", "H8.1", "H8.10"],
_np.testing.assert_array_equal(["TM1", "2.50", "3.50", "H8.1", "H8.10","C-term"],
sorted)

def test_CGN(self):
sorted = nomenclature._sort_CGN_consensus_labels(self.tosort)
_np.testing.assert_array_equal(
["G.H1.1", "G.H1.10", "H.HA.10", "H.HA.20", 'a.l.85', "H8.10", 'αC.25', "V34", "H8.1", "3.50", "2.50", 'αD.55'],
["G.H1.1", "G.H1.10", "H.HA.10", "H.HA.20", "C-term", 'a.l.85', "H8.10", 'αC.25', "V34", "H8.1", "3.50", "2.50", 'αD.55', "TM1"],
sorted)

def test_CGN_dont_append(self):
Expand All @@ -859,7 +859,7 @@ def test_CGN_dont_append(self):
def test_KLIFS(self):
sorted = nomenclature._sort_KLIFS_consensus_labels(self.tosort)
_np.testing.assert_array_equal(
[ 'αC.25', 'αD.55', 'a.l.85',"G.H1.10", "H.HA.20","H8.10", "V34", "H8.1", "3.50", "2.50", "G.H1.1", "H.HA.10"],
[ 'αC.25', 'αD.55', 'a.l.85', "C-term", "G.H1.10", "H.HA.20","H8.10", "V34", "H8.1", "3.50", "2.50", "G.H1.1", "H.HA.10", "TM1"],
sorted)

def test_KLIFS_dont_append(self):
Expand All @@ -873,30 +873,31 @@ def test_sort_all_consensus_labels(self):
[
"G.H1.1", "G.H1.10", "H.HA.10", "H.HA.20",
'αC.25', 'αD.55', 'a.l.85',
"2.50", "3.50", "H8.1", "H8.10"],
"TM1", "2.50", "3.50", "H8.1", "H8.10", "C-term"],
sorted)

_np.testing.assert_array_equal(
[9, 0, 10, 1,
4, 11, 2,
8, 7, 6, 3],
[10, 1, 11, 2,
5, 12, 3,
13, 9, 8, 7, 4, 0],
sorted_indices)

def test_sort_all_consensus_labels_append(self):
sorted, sorted_indices = nomenclature._sort_all_consensus_labels(self.tosort, append_diffset=True,
sorted, sorted_indices = nomenclature._sort_all_consensus_labels(self.tosort, append_diffset=False,
order=["CGN", "KLIFS"])
_np.testing.assert_array_equal(
[
"G.H1.1", "G.H1.10", "H.HA.10", "H.HA.20",
'αC.25', 'αD.55', 'a.l.85',
"H8.10", "V34", "H8.1", "3.50", "2.50"
#"H8.10", "V34", "H8.1", "3.50", "2.50"
],
sorted)

_np.testing.assert_array_equal(
[9, 0, 10, 1,
4, 11, 2,
3, 5, 6, 7, 8],
[10, 1, 11, 2,
5, 12, 3,
#13, 9, 8, 7, 4, 0
],
sorted_indices)

class Test_lexsort_consensus_ctc_labels(unittest.TestCase):
Expand Down

0 comments on commit a9d2698

Please sign in to comment.