Skip to content

Commit 1d5126d

Browse files
committed
[LabelerGPCR.top2domains] new method, tests
1 parent 1b09421 commit 1d5126d

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

mdciao/nomenclature/nomenclature.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,38 @@ class LabelerGPCR(LabelerGPCRdb):
13811381
def __init__(self, *args, **kwargs):
13821382
super().__init__(*args, **kwargs)
13831383

1384+
@_kwargs_subs(LabelerConsensus.top2frags)
1385+
def top2domains(self, top, **top2frags_kwargs):
1386+
r"""
1387+
Like :obj:`top2frags` but for separating a GPCR into GAIN and TM domains.
1388+
1389+
As in :obj:`top2frags`, regions of the topology withoug
1390+
generic residue labels (e.g. ligands or other
1391+
components) are left out of the returned domains.
1392+
1393+
Parameters
1394+
----------
1395+
top:
1396+
:obj:`~mdtraj.Topology` or path to topology file (e.g. a pdb)
1397+
%(substitute_kwargs)s
1398+
1399+
Returns
1400+
-------
1401+
domains : list
1402+
A list of two lists, each one containing the
1403+
residue indices of the GAIN domain and
1404+
of the TM domain, in that order. Empty list(s)
1405+
represent missing domains.
1406+
"""
1407+
1408+
dict = self.top2frags(top, **top2frags_kwargs)
1409+
1410+
domains = [[val for key, val in dict.items() if key[0] in ["A","B"]],
1411+
[val for key, val in dict.items() if key[0] not in ["A", "B"]]]
1412+
domains = [[_np.hstack(dd).tolist() if len(dd)>0 else dd][0] for dd in domains]
1413+
1414+
return domains
1415+
13841416
class LabelerCGN(LabelerGPCRdb):
13851417
r"""
13861418
Obtain and manipulate G-protein generic residue numbering, i.e. 'Common Gα Numbering', CGN[1]

tests/test_nomenclature.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ def setUp(self):
161161
self.file = test_filenames.agrg1_human_xlsx
162162

163163
def test_works(self):
164-
pass
165164
CL = nomenclature.LabelerGPCRdb(self.file)
166165

167166
def test_scheme_BW(self):
@@ -185,6 +184,11 @@ def test_GPS_cleaved(self):
185184
assert "B.GPS" in CL.fragment_names
186185
assert "B.GPSc" in CL.fragment_names
187186

187+
def test_top2domains(self):
188+
CL = nomenclature.LabelerGPCR(test_filenames.adrb2_human_xlsx)
189+
domains = CL.top2domains(test_filenames.actor_pdb)
190+
assert len(domains[0])==0 #no GAIN domain
191+
self.assertListEqual(domains[1], list(range(0,279+1)))
188192

189193
class Test_GPCRdbDataFrame2conlabs(unittest.TestCase):
190194
def setUp(self):

0 commit comments

Comments
 (0)