From f4ac2086159af3422cabee13a4bb315ddfd774a9 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Mon, 30 Sep 2024 16:14:29 +0200 Subject: [PATCH] add 3o21 disu test --- prody/tests/datafiles/3o21_disu.npy | Bin 0 -> 1028 bytes prody/tests/datafiles/__init__.py | 5 ++- prody/tests/proteins/test_insty.py | 49 ++++++++++++++++++++-------- 3 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 prody/tests/datafiles/3o21_disu.npy diff --git a/prody/tests/datafiles/3o21_disu.npy b/prody/tests/datafiles/3o21_disu.npy new file mode 100644 index 0000000000000000000000000000000000000000..3f132d62e88f0a2661a9edbcd11e2ee3fb26296e GIT binary patch literal 1028 zcmbV}T~E_c0ERop$Ee?;h@VUpH*^lRwW9-cgCSMQHaKHiVhriFnwgAkZ&yqRm>7vg zu8p@Q-Wc!v3nX59qsCu=f500r^&DoClO^7GE}EW?JkN95*V#g5am6D%6*dE9vstnN z6aK(fE)enu9@j0~GHR=Jt8B96IiuP%>3XwbG)y`VN+G{867oOu|Nju5drP(TwZ=xc zRJY9V+IrP~Vpx{3A+B0xsa|W^)_TbnA+%13wQ_409!+?Oj(qP> zy8j+6+Zzp2M33Gf2trPQZ}-&>dI`j!=G8rPZ3~C8+3fspIu0IM(#GN9?jsxt>Rog{ zy^@c|a8&Q1?|F4KE+xir>>stwl2J7*5yvYnUm=1M%y*KY&-G2=6!p`UvW4ZRrt1EAmzLjV8( literal 0 HcmV?d00001 diff --git a/prody/tests/datafiles/__init__.py b/prody/tests/datafiles/__init__.py index 54f7c00de..8de8f0955 100644 --- a/prody/tests/datafiles/__init__.py +++ b/prody/tests/datafiles/__init__.py @@ -358,7 +358,10 @@ }, '2k39_disu': { 'file': '2k39_disu.npy' - }, + }, + '3o21_disu': { + 'file': '3o21_disu.npy' + }, '2k39_all': { 'file': '2k39_all.npy' }, diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index 305f69fa6..247710413 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -19,7 +19,7 @@ def setUp(self): """Generating new data to compare it with the existing one""" if prody.PY3K: - self.ATOMS = parseDatafile('2k39_insty') + self.ATOMS = parseDatafile('2k39_insty') # no disulfides self.ALL_INTERACTIONS = parseDatafile('2k39_all') self.ALL_INTERACTIONS2 = parseDatafile('2k39_all2') self.HBS_INTERACTIONS = parseDatafile('2k39_hbs') @@ -31,6 +31,9 @@ def setUp(self): self.HPH_INTERACTIONS2 = parseDatafile('2k39_hph2') self.DISU_INTERACTIONS = parseDatafile('2k39_disu') + self.ATOMS_3O21 = parseDatafile('3o21') # has disulfides & not traj + self.DISU_INTERACTIONS_3O21 = parseDatafile('3o21_disu') + def testAllInteractionsCalc(self): """Test for calculating all types of interactions.""" @@ -132,26 +135,46 @@ def testHydrophobicInteractions(self): 'failed to get correct hydrophobic interactions with hpb.so') - def testDisulfideBondsCalc(self): + def testDisulfideBondsCalcNone(self): """Test for disulfide bonds interactions without saving and loading.""" if prody.PY3K: data_test = calcDisulfideBondsTrajectory(self.ATOMS) - assert_equal(sorted([i[-1][-1] for i in data_test if len(i) > 0]), sorted([i[-1][-1] for i in self.DISU_INTERACTIONS if len(i) > 0]), - 'failed to get correct disulfide bonds from calculation') - - def testDisulfideBondsSave(self): + assert_equal(sorted([i[-1][-1] for i in data_test if len(i) > 0]), + sorted([i[-1][-1] for i in self.DISU_INTERACTIONS if len(i) > 0]), + 'failed to get correct disulfide bonds from 2k39 (None) from calculation') + + def testDisulfideBondsSaveNone(self): """Test for disulfide bonds interactions with saving and loading (one type of interactions with 0).""" if prody.PY3K: data_test = calcDisulfideBondsTrajectory(self.ATOMS) - assert_equal(sorted([i[-1][-1] for i in data_test if len(i) > 0]), sorted([i[-1][-1] for i in self.DISU_INTERACTIONS if len(i) > 0]), - 'failed to get correct disulfide bonds from calculation') - - np.save('test_2k39_disu.npy', np.array(data_test, dtype=object), allow_pickle=True) + np.save('test_2k39_disu.npy', np.array(data_test, dtype=object), + allow_pickle=True) data_test = np.load('test_2k39_disu.npy', allow_pickle=True) - assert_equal(sorted([i[-1][-1] for i in data_test if len(i) > 0]), sorted([i[-1][-1] for i in self.DISU_INTERACTIONS if len(i) > 0]), - 'failed to get correct disulfide bonds from saving and loading') - + assert_equal(sorted([i[-1][-1] for i in data_test if len(i) > 0]), + sorted([i[-1][-1] for i in self.DISU_INTERACTIONS if len(i) > 0]), + 'failed to get correct disulfide bonds from 2k39 (None) from saving and loading') + + def testDisulfideBondsCalcSomeNotTraj(self): + """Test for disulfide bonds interactions without saving and loading.""" + if prody.PY3K: + data_test = calcDisulfideBonds(self.ATOMS_3O21) + assert_equal(sorted([i[-1] for i in data_test if len(i) > 0]), + sorted([i[-1] for i in self.DISU_INTERACTIONS_3O21 if len(i) > 0]), + 'failed to get correct disulfide bonds from 3o21 from calculation') + + def testDisulfideBondsSaveSomeNotTraj(self): + """Test for disulfide bonds interactions with saving and loading (one type of interactions with 0).""" + if prody.PY3K: + data_test = calcDisulfideBonds(self.ATOMS_3O21) + np.save('test_3o21_disu.npy', np.array(data_test, dtype=object), + allow_pickle=True) + + data_test = np.load('test_3o21_disu.npy', allow_pickle=True) + assert_equal(sorted([i[-1] for i in data_test if len(i) > 0]), + sorted([i[-1] for i in self.DISU_INTERACTIONS_3O21 if len(i) > 0]), + 'failed to get correct disulfide bonds from 3o21 from saving and loading') + def testImportHpb(self): try: