From 26b99a3780d870ef13c1001bd6e4545f2f190a38 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 22 Aug 2024 17:24:56 +0200 Subject: [PATCH 01/13] parallel insty --- prody/proteins/interactions.py | 80 +++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/prody/proteins/interactions.py b/prody/proteins/interactions.py index 40f3dd3d6..6f371fc00 100644 --- a/prody/proteins/interactions.py +++ b/prody/proteins/interactions.py @@ -31,7 +31,7 @@ from prody.trajectory import TrajBase, Trajectory from prody.ensemble import Ensemble -import multiprocessing +import multiprocessing as mp __all__ = ['calcHydrogenBonds', 'calcChHydrogenBonds', 'calcSaltBridges', 'calcRepulsiveIonicBonding', 'calcPiStacking', 'calcPiCation', @@ -43,7 +43,7 @@ 'calcSASA', 'calcVolume','compareInteractions', 'showInteractionsGraph', 'calcLigandInteractions', 'listLigandInteractions', 'showProteinInteractions_VMD', 'showLigandInteraction_VMD', - 'calcHydrogenBondsTrajectory', 'calcHydrophobicOverlapingAreas', + 'calcHydrophobicOverlapingAreas', 'Interactions', 'InteractionsTrajectory', 'LigandInteractionsTrajectory', 'calcSminaBindingAffinity', 'calcSminaPerAtomInteractions', 'calcSminaTermValues', 'showSminaTermValues'] @@ -845,7 +845,7 @@ def calcPiStacking(atoms, **kwargs): str(sele2.getResnames()[0])+str(sele2.getResnums()[0]), '_'.join(map(str,sele2.getIndices())), str(sele2.getChids()[0])]]) # create a process pool that uses all cpus - with multiprocessing.Pool() as pool: + with mp.Pool() as pool: # call the function for each item in parallel with multiple arguments for result in pool.starmap(calcPiStacking_once, items): if result is not None: @@ -1297,7 +1297,12 @@ def calcMetalInteractions(atoms, distA=3.0, extraIons=['FE'], excluded_ions=['SO def calcInteractionsMultipleFrames(atoms, interaction_type, trajectory, **kwargs): """Compute selected type interactions for DCD trajectory or multi-model PDB - using default parameters.""" + using default parameters. + + :arg max_proc: maximum number of processes to use + default is half of the number of CPUs + :type max_proc: int + """ try: coords = getCoords(atoms) @@ -1311,6 +1316,7 @@ def calcInteractionsMultipleFrames(atoms, interaction_type, trajectory, **kwargs interactions_all = [] start_frame = kwargs.pop('start_frame', 0) stop_frame = kwargs.pop('stop_frame', -1) + max_proc = kwargs.pop('max_proc', mp.cpu_count()//2) interactions_dic = { "HBs": calcHydrogenBonds, @@ -1336,22 +1342,84 @@ def calcInteractionsMultipleFrames(atoms, interaction_type, trajectory, **kwargs traj = trajectory[start_frame:stop_frame+1] atoms_copy = atoms.copy() - for j0, frame0 in enumerate(traj, start=start_frame): + def analyseFrame(j0, start_frame, frame0, interactions_all): LOGGER.info('Frame: {0}'.format(j0)) atoms_copy.setCoords(frame0.getCoords()) protein = atoms_copy.select('protein') interactions = interactions_dic[interaction_type](protein, **kwargs) interactions_all.append(interactions) + + if max_proc == 1: + interactions_all = [] + for j0, frame0 in enumerate(traj, start=start_frame): + interactions_all.append([]) + analyseFrame(j0, start_frame, frame0, interactions_all) + else: + with mp.Manager() as manager: + interactions_all = manager.list() + for j0, frame0 in enumerate(traj, start=start_frame): + interactions_all.append([]) + + j0 = start_frame + while j0 < traj.numConfs()+start_frame: + + processes = [] + for _ in range(max_proc): + frame0 = traj[j0-start_frame] + + p = mp.Process(target=analyseFrame, args=(j0, start_frame, + frame0, + interactions_all)) + p.start() + processes.append(p) + + j0 += 1 + if j0 >= traj.numConfs()+start_frame: + break + + for p in processes: + p.join() + + interactions_all = interactions_all[:] + trajectory._nfi = nfi else: if atoms.numCoordsets() > 1: - for i in range(len(atoms.getCoordsets()[start_frame:stop_frame])): + def analyseFrame(i, interactions_all): LOGGER.info('Model: {0}'.format(i+start_frame)) atoms.setACSIndex(i+start_frame) protein = atoms.select('protein') interactions = interactions_dic[interaction_type](protein, **kwargs) interactions_all.append(interactions) + + if max_proc == 1: + interactions_all = [] + for i in range(len(atoms.getCoordsets()[start_frame:stop_frame])): + interactions_all.append([]) + analyseFrame(i, interactions_all) + else: + with mp.Manager() as manager: + interactions_all = manager.list() + for i in range(len(atoms.getCoordsets()[start_frame:stop_frame])): + interactions_all.append([]) + + i = start_frame + while i < len(atoms.getCoordsets()[start_frame:stop_frame]): + processes = [] + for _ in range(max_proc): + p = mp.Process(target=analyseFrame, args=(i, interactions_all)) + p.start() + processes.append(p) + + i += 1 + if i >= len(atoms.getCoordsets()[start_frame:stop_frame]): + break + + for p in processes: + p.join() + + interactions_all = interactions_all[:] else: LOGGER.info('Include trajectory or use multi-model PDB file.') From 368a673d7d6fb4b4caf9837ec4325a8f56c92ab1 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 22 Aug 2024 19:38:57 +0200 Subject: [PATCH 02/13] parallel inside class - somewhat working --- prody/proteins/interactions.py | 179 ++++++++++++++++++++++++--------- 1 file changed, 129 insertions(+), 50 deletions(-) diff --git a/prody/proteins/interactions.py b/prody/proteins/interactions.py index 6f371fc00..9be43dde4 100644 --- a/prody/proteins/interactions.py +++ b/prody/proteins/interactions.py @@ -3508,6 +3508,10 @@ def calcProteinInteractionsTrajectory(self, atoms, trajectory=None, filename=Non :arg stop_frame: index of last frame to read :type stop_frame: int + :arg max_proc: maximum number of processes to use + default is half of the number of CPUs + :type max_proc: int + Selection: If we want to select interactions for the particular residue or group of residues: selection='chain A and resid 1 to 50' @@ -3540,8 +3544,12 @@ def calcProteinInteractionsTrajectory(self, atoms, trajectory=None, filename=Non HPh_nb = [] DiBs_nb = [] + interactions_traj = [HBs_all, SBs_all, RIB_all, PiStack_all, PiCat_all, HPh_all, DiBs_all] + interactions_nb_traj = [HBs_nb, SBs_nb, RIB_nb, PiStack_nb, PiCat_nb, HPh_nb, DiBs_nb] + start_frame = kwargs.pop('start_frame', 0) stop_frame = kwargs.pop('stop_frame', -1) + max_proc = kwargs.pop('max_proc', mp.cpu_count()//2) if trajectory is not None: if isinstance(trajectory, Atomic): @@ -3559,7 +3567,7 @@ def calcProteinInteractionsTrajectory(self, atoms, trajectory=None, filename=Non atoms_copy = atoms.copy() protein = atoms_copy.protein - for j0, frame0 in enumerate(traj, start=start_frame): + def analyseFrame(j0, frame0, interactions_all, interactions_nb): LOGGER.info('Frame: {0}'.format(j0)) atoms_copy.setCoords(frame0.getCoords()) @@ -3571,66 +3579,137 @@ def calcProteinInteractionsTrajectory(self, atoms, trajectory=None, filename=Non hydrophobic = calcHydrophobic(protein, **kwargs) Disulfide_Bonds = calcDisulfideBonds(protein, **kwargs) - HBs_all.append(hydrogen_bonds) - SBs_all.append(salt_bridges) - RIB_all.append(RepulsiveIonicBonding) - PiStack_all.append(Pi_stacking) - PiCat_all.append(Pi_cation) - HPh_all.append(hydrophobic) - DiBs_all.append(Disulfide_Bonds) + interactions_all[0].append(hydrogen_bonds) + interactions_all[1].append(salt_bridges) + interactions_all[2].append(RepulsiveIonicBonding) + interactions_all[3].append(Pi_stacking) + interactions_all[4].append(Pi_cation) + interactions_all[5].append(hydrophobic) + interactions_all[6].append(Disulfide_Bonds) - HBs_nb.append(len(hydrogen_bonds)) - SBs_nb.append(len(salt_bridges)) - RIB_nb.append(len(RepulsiveIonicBonding)) - PiStack_nb.append(len(Pi_stacking)) - PiCat_nb.append(len(Pi_cation)) - HPh_nb.append(len(hydrophobic)) - DiBs_nb.append(len(Disulfide_Bonds)) - + interactions_nb[0].append(len(hydrogen_bonds)) + interactions_nb[1].append(len(salt_bridges)) + interactions_nb[2].append(len(RepulsiveIonicBonding)) + interactions_nb[3].append(len(Pi_stacking)) + interactions_nb[4].append(len(Pi_cation)) + interactions_nb[5].append(len(hydrophobic)) + interactions_nb[6].append(len(Disulfide_Bonds)) + + if max_proc == 1: + interactions_all = [] + interactions_all.extend(interactions_traj) + interactions_nb = [] + interactions_nb.extend(interactions_nb_traj) + for j0, frame0 in enumerate(traj, start=start_frame): + analyseFrame(j0, frame0, interactions_all, interactions_nb) + else: + with mp.Manager() as manager: + interactions_all = manager.list() + interactions_all.extend([manager.list() for _ in interactions_traj]) + + interactions_nb = manager.list() + interactions_nb.extend([manager.list() for _ in interactions_nb_traj]) + + j0 = start_frame + while j0 < traj.numConfs()+start_frame: + + processes = [] + for _ in range(max_proc): + frame0 = traj[j0-start_frame] + + p = mp.Process(target=analyseFrame, args=(j0, frame0, + interactions_all, + interactions_nb)) + p.start() + processes.append(p) + + j0 += 1 + if j0 >= traj.numConfs()+start_frame: + break + + for p in processes: + p.join() + + interactions_all = [entry[:] for entry in interactions_all] + interactions_nb = [entry[:] for entry in interactions_nb] else: if atoms.numCoordsets() > 1: - for i in range(len(atoms.getCoordsets()[start_frame:stop_frame])): + def analyseFrame(i, interactions_all, interactions_nb): LOGGER.info('Model: {0}'.format(i+start_frame)) atoms.setACSIndex(i+start_frame) protein = atoms.select('protein') - hydrogen_bonds = calcHydrogenBonds(atoms.protein, **kwargs) - salt_bridges = calcSaltBridges(atoms.protein, **kwargs) - RepulsiveIonicBonding = calcRepulsiveIonicBonding(atoms.protein, **kwargs) - Pi_stacking = calcPiStacking(atoms.protein, **kwargs) - Pi_cation = calcPiCation(atoms.protein, **kwargs) - hydrophobic = calcHydrophobic(atoms.protein, **kwargs) - Disulfide_Bonds = calcDisulfideBonds(atoms.protein, **kwargs) - - HBs_all.append(hydrogen_bonds) - SBs_all.append(salt_bridges) - RIB_all.append(RepulsiveIonicBonding) - PiStack_all.append(Pi_stacking) - PiCat_all.append(Pi_cation) - HPh_all.append(hydrophobic) - DiBs_all.append(Disulfide_Bonds) - - HBs_nb.append(len(hydrogen_bonds)) - SBs_nb.append(len(salt_bridges)) - RIB_nb.append(len(RepulsiveIonicBonding)) - PiStack_nb.append(len(Pi_stacking)) - PiCat_nb.append(len(Pi_cation)) - HPh_nb.append(len(hydrophobic)) - DiBs_nb.append(len(Disulfide_Bonds)) + hydrogen_bonds = calcHydrogenBonds(protein, **kwargs) + salt_bridges = calcSaltBridges(protein, **kwargs) + RepulsiveIonicBonding = calcRepulsiveIonicBonding(protein, **kwargs) + Pi_stacking = calcPiStacking(protein, **kwargs) + Pi_cation = calcPiCation(protein, **kwargs) + hydrophobic = calcHydrophobic(protein, **kwargs) + Disulfide_Bonds = calcDisulfideBonds(protein, **kwargs) + + interactions_all[0].append(hydrogen_bonds) + interactions_all[1].append(salt_bridges) + interactions_all[2].append(RepulsiveIonicBonding) + interactions_all[3].append(Pi_stacking) + interactions_all[4].append(Pi_cation) + interactions_all[5].append(hydrophobic) + interactions_all[6].append(Disulfide_Bonds) + + interactions_nb[0].append(len(hydrogen_bonds)) + interactions_nb[1].append(len(salt_bridges)) + interactions_nb[2].append(len(RepulsiveIonicBonding)) + interactions_nb[3].append(len(Pi_stacking)) + interactions_nb[4].append(len(Pi_cation)) + interactions_nb[5].append(len(hydrophobic)) + interactions_nb[6].append(len(Disulfide_Bonds)) + + if max_proc == 1: + interactions_all = [] + interactions_all.extend(interactions_traj) + interactions_nb = [] + interactions_nb.extend(interactions_nb_traj) + for i in range(len(atoms.getCoordsets()[start_frame:stop_frame])): + analyseFrame(i, interactions_all, interactions_nb) + else: + with mp.Manager() as manager: + interactions_all = manager.list() + interactions_all.extend([manager.list() for _ in interactions_traj]) + + interactions_nb = manager.list() + interactions_nb.extend([manager.list() for _ in interactions_nb_traj]) + + i = start_frame + while i < len(atoms.getCoordsets()[start_frame:stop_frame]): + processes = [] + for _ in range(max_proc): + p = mp.Process(target=analyseFrame, args=(i, interactions_all, + interactions_nb)) + p.start() + processes.append(p) + + i += 1 + if i >= len(atoms.getCoordsets()[start_frame:stop_frame]): + break + + for p in processes: + p.join() + + interactions_all = [entry[:] for entry in interactions_all] + interactions_nb = [entry[:] for entry in interactions_nb] else: LOGGER.info('Include trajectory or use multi-model PDB file.') self._atoms = atoms self._traj = trajectory - self._interactions_traj = [HBs_all, SBs_all, RIB_all, PiStack_all, PiCat_all, HPh_all, DiBs_all] - self._interactions_nb_traj = [HBs_nb, SBs_nb, RIB_nb, PiStack_nb, PiCat_nb, HPh_nb, DiBs_nb] - self._hbs_traj = HBs_all - self._sbs_traj = SBs_all - self._rib_traj = RIB_all - self._piStack_traj = PiStack_all - self._piCat_traj = PiCat_all - self._hps_traj = HPh_all - self._dibs_traj = DiBs_all + self._interactions_traj = interactions_all + self._interactions_nb_traj = interactions_nb + self._hbs_traj = interactions_all[0] + self._sbs_traj = interactions_all[1] + self._rib_traj = interactions_all[2] + self._piStack_traj = interactions_all[3] + self._piCat_traj = interactions_all[4] + self._hps_traj = interactions_all[5] + self._dibs_traj = interactions_all[6] if filename is not None: import pickle @@ -3638,7 +3717,7 @@ def calcProteinInteractionsTrajectory(self, atoms, trajectory=None, filename=Non pickle.dump(self._interactions_traj, f) LOGGER.info('File with interactions saved.') - return HBs_nb, SBs_nb, RIB_nb, PiStack_nb, PiCat_nb, HPh_nb, DiBs_nb + return interactions_nb def getInteractions(self, **kwargs): From c34f8de2307029cfdf970d995a657b268888907c Mon Sep 17 00:00:00 2001 From: James Krieger Date: Thu, 22 Aug 2024 20:32:36 +0200 Subject: [PATCH 03/13] limit frames and procs --- prody/tests/proteins/test_insty.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index 0fd6a47ac..4ea931073 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -31,28 +31,28 @@ def setUp(self): self.DISU_INTERACTIONS = parseDatafile('2k39_disu') self.INTERACTIONS_ALL = InteractionsTrajectory() - self.data_all = self.INTERACTIONS_ALL.calcProteinInteractionsTrajectory(self.ATOMS) + self.data_all = self.INTERACTIONS_ALL.calcProteinInteractionsTrajectory(self.ATOMS, stop_frame=4, max_proc=2) np.save('test_2k39_all.npy', self.data_all, allow_pickle=True) - self.data_hbs = calcHydrogenBondsTrajectory(self.ATOMS) + self.data_hbs = calcHydrogenBondsTrajectory(self.ATOMS, stop_frame=4, max_proc=2) np.save('test_2k39_hbs.npy', np.array(self.data_hbs, dtype=object), allow_pickle=True) - self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS) + self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS, stop_frame=4, max_proc=2) np.save('test_2k39_sbs.npy', np.array(self.data_sbs, dtype=object), allow_pickle=True) - self.data_rib = calcRepulsiveIonicBondingTrajectory(self.ATOMS) + self.data_rib = calcRepulsiveIonicBondingTrajectory(self.ATOMS, stop_frame=4, max_proc=2) np.save('test_2k39_rib.npy', np.array(self.data_rib, dtype=object), allow_pickle=True) - self.data_PiStack = calcPiStackingTrajectory(self.ATOMS) + self.data_PiStack = calcPiStackingTrajectory(self.ATOMS, stop_frame=4, max_proc=2) np.save('test_2k39_PiStack.npy', np.array(self.data_PiStack, dtype=object), allow_pickle=True) - self.data_PiCat = calcPiCationTrajectory(self.ATOMS) + self.data_PiCat = calcPiCationTrajectory(self.ATOMS, stop_frame=4, max_proc=2) np.save('test_2k39_PiCat.npy', np.array(self.data_PiCat, dtype=object), allow_pickle=True) - self.data_hph = calcHydrophobicTrajectory(self.ATOMS) + self.data_hph = calcHydrophobicTrajectory(self.ATOMS, stop_frame=4, max_proc=2) np.save('test_2k39_hph.npy', np.array(self.data_hph, dtype=object), allow_pickle=True) - self.data_disu = calcDisulfideBondsTrajectory(self.ATOMS) + self.data_disu = calcDisulfideBondsTrajectory(self.ATOMS, stop_frame=4, max_proc=2) np.save('test_2k39_disu.npy', np.array(self.data_disu, dtype=object), allow_pickle=True) def testAllInsteractions(self): From 3e9568bb93664388f20a8f375bb3b1905710a097 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 13 Dec 2024 15:46:21 +0000 Subject: [PATCH 04/13] simplify calcProteinInteractionsTrajectory --- prody/proteins/interactions.py | 214 ++++++++++++--------------------- 1 file changed, 77 insertions(+), 137 deletions(-) diff --git a/prody/proteins/interactions.py b/prody/proteins/interactions.py index 299070c50..84ca35811 100644 --- a/prody/proteins/interactions.py +++ b/prody/proteins/interactions.py @@ -5110,7 +5110,7 @@ def calcProteinInteractionsTrajectory(self, atoms, trajectory=None, filename=Non except TypeError: raise TypeError('coords must be an object ' 'with `getCoords` method') - + HBs_all = [] SBs_all = [] RIB_all = [] @@ -5134,153 +5134,93 @@ def calcProteinInteractionsTrajectory(self, atoms, trajectory=None, filename=Non stop_frame = kwargs.pop('stop_frame', -1) max_proc = kwargs.pop('max_proc', mp.cpu_count()//2) - if trajectory is not None: - if isinstance(trajectory, Atomic): - trajectory = Ensemble(trajectory) - - nfi = trajectory._nfi - trajectory.reset() - numFrames = trajectory._n_csets - - if stop_frame == -1: - traj = trajectory[start_frame:] + if trajectory is None: + if atoms.numCoordsets() > 1: + trajectory = atoms else: - traj = trajectory[start_frame:stop_frame+1] + LOGGER.info('Include trajectory or use multi-model PDB file.') + return interactions_nb_traj - atoms_copy = atoms.copy() - protein = atoms_copy.protein + if isinstance(trajectory, Atomic): + trajectory = Ensemble(trajectory) + + #nfi = trajectory._nfi + #trajectory.reset() + #numFrames = trajectory._n_csets - def analyseFrame(j0, frame0, interactions_all, interactions_nb): - LOGGER.info('Frame: {0}'.format(j0)) - atoms_copy.setCoords(frame0.getCoords()) - - hydrogen_bonds = calcHydrogenBonds(protein, **kwargs) - salt_bridges = calcSaltBridges(protein, **kwargs) - RepulsiveIonicBonding = calcRepulsiveIonicBonding(protein, **kwargs) - Pi_stacking = calcPiStacking(protein, **kwargs) - Pi_cation = calcPiCation(protein, **kwargs) - hydrophobic = calcHydrophobic(protein, **kwargs) - Disulfide_Bonds = calcDisulfideBonds(protein, **kwargs) - - interactions_all[0].append(hydrogen_bonds) - interactions_all[1].append(salt_bridges) - interactions_all[2].append(RepulsiveIonicBonding) - interactions_all[3].append(Pi_stacking) - interactions_all[4].append(Pi_cation) - interactions_all[5].append(hydrophobic) - interactions_all[6].append(Disulfide_Bonds) + if stop_frame == -1: + traj = trajectory[start_frame:] + else: + traj = trajectory[start_frame:stop_frame+1] + + atoms_copy = atoms.copy() + protein = atoms_copy.protein + + def analyseFrame(j0, frame0, interactions_all, interactions_nb): + LOGGER.info('Frame: {0}'.format(j0)) + atoms_copy.setCoords(frame0.getCoords()) - interactions_nb[0].append(len(hydrogen_bonds)) - interactions_nb[1].append(len(salt_bridges)) - interactions_nb[2].append(len(RepulsiveIonicBonding)) - interactions_nb[3].append(len(Pi_stacking)) - interactions_nb[4].append(len(Pi_cation)) - interactions_nb[5].append(len(hydrophobic)) - interactions_nb[6].append(len(Disulfide_Bonds)) + hydrogen_bonds = calcHydrogenBonds(protein, **kwargs) + salt_bridges = calcSaltBridges(protein, **kwargs) + RepulsiveIonicBonding = calcRepulsiveIonicBonding(protein, **kwargs) + Pi_stacking = calcPiStacking(protein, **kwargs) + Pi_cation = calcPiCation(protein, **kwargs) + hydrophobic = calcHydrophobic(protein, **kwargs) + Disulfide_Bonds = calcDisulfideBonds(protein, **kwargs) + + interactions_all[0].append(hydrogen_bonds) + interactions_all[1].append(salt_bridges) + interactions_all[2].append(RepulsiveIonicBonding) + interactions_all[3].append(Pi_stacking) + interactions_all[4].append(Pi_cation) + interactions_all[5].append(hydrophobic) + interactions_all[6].append(Disulfide_Bonds) + + interactions_nb[0].append(len(hydrogen_bonds)) + interactions_nb[1].append(len(salt_bridges)) + interactions_nb[2].append(len(RepulsiveIonicBonding)) + interactions_nb[3].append(len(Pi_stacking)) + interactions_nb[4].append(len(Pi_cation)) + interactions_nb[5].append(len(hydrophobic)) + interactions_nb[6].append(len(Disulfide_Bonds)) - if max_proc == 1: - interactions_all = [] - interactions_all.extend(interactions_traj) - interactions_nb = [] - interactions_nb.extend(interactions_nb_traj) - for j0, frame0 in enumerate(traj, start=start_frame): - analyseFrame(j0, frame0, interactions_all, interactions_nb) - else: - with mp.Manager() as manager: - interactions_all = manager.list() - interactions_all.extend([manager.list() for _ in interactions_traj]) + if max_proc == 1: + interactions_all = [] + interactions_all.extend(interactions_traj) + interactions_nb = [] + interactions_nb.extend(interactions_nb_traj) + for j0, frame0 in enumerate(traj, start=start_frame): + analyseFrame(j0, frame0, interactions_all, interactions_nb) + else: + with mp.Manager() as manager: + interactions_all = manager.list() + interactions_all.extend([manager.list() for _ in interactions_traj]) - interactions_nb = manager.list() - interactions_nb.extend([manager.list() for _ in interactions_nb_traj]) + interactions_nb = manager.list() + interactions_nb.extend([manager.list() for _ in interactions_nb_traj]) - j0 = start_frame - while j0 < traj.numConfs()+start_frame: + j0 = start_frame + while j0 < traj.numConfs()+start_frame: - processes = [] - for _ in range(max_proc): - frame0 = traj[j0-start_frame] - - p = mp.Process(target=analyseFrame, args=(j0, frame0, - interactions_all, - interactions_nb)) - p.start() - processes.append(p) + processes = [] + for _ in range(max_proc): + frame0 = traj[j0-start_frame] + + p = mp.Process(target=analyseFrame, args=(j0, frame0, + interactions_all, + interactions_nb)) + p.start() + processes.append(p) - j0 += 1 - if j0 >= traj.numConfs()+start_frame: - break + j0 += 1 + if j0 >= traj.numConfs()+start_frame: + break - for p in processes: - p.join() + for p in processes: + p.join() - interactions_all = [entry[:] for entry in interactions_all] - interactions_nb = [entry[:] for entry in interactions_nb] - else: - if atoms.numCoordsets() > 1: - def analyseFrame(i, interactions_all, interactions_nb): - LOGGER.info('Model: {0}'.format(i+start_frame)) - atoms.setACSIndex(i+start_frame) - protein = atoms.select('protein') - - hydrogen_bonds = calcHydrogenBonds(protein, **kwargs) - salt_bridges = calcSaltBridges(protein, **kwargs) - RepulsiveIonicBonding = calcRepulsiveIonicBonding(protein, **kwargs) - Pi_stacking = calcPiStacking(protein, **kwargs) - Pi_cation = calcPiCation(protein, **kwargs) - hydrophobic = calcHydrophobic(protein, **kwargs) - Disulfide_Bonds = calcDisulfideBonds(protein, **kwargs) - - interactions_all[0].append(hydrogen_bonds) - interactions_all[1].append(salt_bridges) - interactions_all[2].append(RepulsiveIonicBonding) - interactions_all[3].append(Pi_stacking) - interactions_all[4].append(Pi_cation) - interactions_all[5].append(hydrophobic) - interactions_all[6].append(Disulfide_Bonds) - - interactions_nb[0].append(len(hydrogen_bonds)) - interactions_nb[1].append(len(salt_bridges)) - interactions_nb[2].append(len(RepulsiveIonicBonding)) - interactions_nb[3].append(len(Pi_stacking)) - interactions_nb[4].append(len(Pi_cation)) - interactions_nb[5].append(len(hydrophobic)) - interactions_nb[6].append(len(Disulfide_Bonds)) - - if max_proc == 1: - interactions_all = [] - interactions_all.extend(interactions_traj) - interactions_nb = [] - interactions_nb.extend(interactions_nb_traj) - for i in range(len(atoms.getCoordsets()[start_frame:stop_frame])): - analyseFrame(i, interactions_all, interactions_nb) - else: - with mp.Manager() as manager: - interactions_all = manager.list() - interactions_all.extend([manager.list() for _ in interactions_traj]) - - interactions_nb = manager.list() - interactions_nb.extend([manager.list() for _ in interactions_nb_traj]) - - i = start_frame - while i < len(atoms.getCoordsets()[start_frame:stop_frame]): - processes = [] - for _ in range(max_proc): - p = mp.Process(target=analyseFrame, args=(i, interactions_all, - interactions_nb)) - p.start() - processes.append(p) - - i += 1 - if i >= len(atoms.getCoordsets()[start_frame:stop_frame]): - break - - for p in processes: - p.join() - - interactions_all = [entry[:] for entry in interactions_all] - interactions_nb = [entry[:] for entry in interactions_nb] - else: - LOGGER.info('Include trajectory or use multi-model PDB file.') + interactions_all = [entry[:] for entry in interactions_all] + interactions_nb = [entry[:] for entry in interactions_nb] self._atoms = atoms self._traj = trajectory From 7cf5d6c1ddb46134c020a70ea98efb903eee6b44 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 13 Dec 2024 16:32:24 +0000 Subject: [PATCH 05/13] replace insty 2k39_all2.npy hpb results --- prody/tests/datafiles/2k39_all2.npy | Bin 912 -> 494 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/prody/tests/datafiles/2k39_all2.npy b/prody/tests/datafiles/2k39_all2.npy index 939bc885cee80f1c251f024fb758f602f6d0a928..8378e52e178663c7f69c5697cbe03987dcb9d0da 100644 GIT binary patch literal 494 zcmbVGO-sW-5ZyFQt5KWQUyxfO#?Xpl@!~=7;9x2Rp&q24OTK9>N!jGqkh`LRF~Ksqh^BwZ7|-k^|KnuBIP=^Ck@8fXowrDk0ox7QMW;zDC8}0%k#X;FN&(b znZ)g2b%#4P>_eY&07Ez+K7=E1sB=m6!2*rYgciN0LZi~9QY)naqo1&<*1Ya(UVG)n d-%+3HfdO4g19k}=(mmqR=@NdujZ5qV?l)=9bIt$& literal 912 zcmbR27wQ`j$;eQ~P_3SlTAW;@Zl$1ZlWC!@qoAIaUsO_*m=~X4l#&V(cT3DEP6dh= zXCxM+0{I%|Itqp+nmP)#3giMV3kC=4(uUeK2(}8fqNfC;*4IA9?@) From 1a1db6df2d58a34dedb5a385980aebb1467ded0b Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 13 Dec 2024 17:08:24 +0000 Subject: [PATCH 06/13] replace 2k39_all.npy with new 2k39_all2.npy --- prody/tests/datafiles/2k39_all.npy | Bin 912 -> 494 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/prody/tests/datafiles/2k39_all.npy b/prody/tests/datafiles/2k39_all.npy index e2f33f4cd9e05f7c479fd974f81c9c5386b64e6e..8378e52e178663c7f69c5697cbe03987dcb9d0da 100644 GIT binary patch literal 494 zcmbVGO-sW-5ZyFQt5KWQUyxfO#?Xpl@!~=7;9x2Rp&q24OTK9>N!jGqkh`LRF~Ksqh^BwZ7|-k^|KnuBIP=^Ck@8fXowrDk0ox7QMW;zDC8}0%k#X;FN&(b znZ)g2b%#4P>_eY&07Ez+K7=E1sB=m6!2*rYgciN0LZi~9QY)naqo1&<*1Ya(UVG)n d-%+3HfdO4g19k}=(mmqR=@NdujZ5qV?l)=9bIt$& literal 912 zcmbR27wQ`j$;eQ~P_3SlTAW;@Zl$1ZlWC!@qoAIaUsO_*m=~X4l#&V(cT3DEP6dh= zXCxM+0{I%|Itqp+nmP)#3giMV3kC= Date: Mon, 16 Dec 2024 18:13:19 +0000 Subject: [PATCH 07/13] fix double backtick --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index c6d6f336b..835f29b5d 100644 --- a/README.rst +++ b/README.rst @@ -41,7 +41,7 @@ ProDy has a modular structure with modules inside various subpackages. The main ones are: -- :mod:`~prody.atomic`` handles all :class:`~prody.atomic.Atomic` objects including :class:`~prody.atomic.AtomGroup` and :class:`.Selection` +- :mod:`~prody.atomic` handles all :class:`~prody.atomic.Atomic` objects including :class:`~prody.atomic.AtomGroup` and :class:`.Selection` - :mod:`~prody.database` interfaces with databases such as CATH, DALI, UniProt and Pfam From fcb14c3310f219a6fb0ef12e97401cbb237a96b2 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Tue, 17 Dec 2024 16:17:58 +0000 Subject: [PATCH 08/13] reorder parallel insty results --- prody/proteins/interactions.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/prody/proteins/interactions.py b/prody/proteins/interactions.py index e8475e2c4..79fe85831 100644 --- a/prody/proteins/interactions.py +++ b/prody/proteins/interactions.py @@ -5156,7 +5156,7 @@ def calcProteinInteractionsTrajectory(self, atoms, trajectory=None, filename=Non atoms_copy = atoms.copy() protein = atoms_copy.protein - def analyseFrame(j0, frame0, interactions_all, interactions_nb): + def analyseFrame(j0, frame0, interactions_all, interactions_nb, j0_list): LOGGER.info('Frame: {0}'.format(j0)) atoms_copy.setCoords(frame0.getCoords()) @@ -5184,13 +5184,17 @@ def analyseFrame(j0, frame0, interactions_all, interactions_nb): interactions_nb[5].append(len(hydrophobic)) interactions_nb[6].append(len(Disulfide_Bonds)) + j0_list.append(j0) + if max_proc == 1: interactions_all = [] interactions_all.extend(interactions_traj) interactions_nb = [] interactions_nb.extend(interactions_nb_traj) + j0_list = [] for j0, frame0 in enumerate(traj, start=start_frame): - analyseFrame(j0, frame0, interactions_all, interactions_nb) + analyseFrame(j0, frame0, interactions_all, interactions_nb, + j0_list) else: with mp.Manager() as manager: interactions_all = manager.list() @@ -5200,6 +5204,7 @@ def analyseFrame(j0, frame0, interactions_all, interactions_nb): interactions_nb.extend([manager.list() for _ in interactions_nb_traj]) j0 = start_frame + j0_list = manager.list() while j0 < traj.numConfs()+start_frame: processes = [] @@ -5207,8 +5212,9 @@ def analyseFrame(j0, frame0, interactions_all, interactions_nb): frame0 = traj[j0-start_frame] p = mp.Process(target=analyseFrame, args=(j0, frame0, - interactions_all, - interactions_nb)) + interactions_all, + interactions_nb, + j0_list)) p.start() processes.append(p) @@ -5221,6 +5227,13 @@ def analyseFrame(j0, frame0, interactions_all, interactions_nb): interactions_all = [entry[:] for entry in interactions_all] interactions_nb = [entry[:] for entry in interactions_nb] + j0_list = [entry for entry in j0_list] + + ids = np.argsort(j0_list) + interactions_all = [list(np.array(interactions_type, dtype=object)[ids]) + for interactions_type in interactions_all] + interactions_nb = [list(np.array(interactions_type, dtype=object)[ids]) + for interactions_type in interactions_nb] self._atoms = atoms self._traj = trajectory From 197fcf90408f0c01362187cf3342c30a5028bc0e Mon Sep 17 00:00:00 2001 From: James Krieger Date: Tue, 17 Dec 2024 16:28:32 +0000 Subject: [PATCH 09/13] fix tests --- prody/tests/datafiles/2k39_all.npy | Bin 494 -> 912 bytes prody/tests/datafiles/2k39_all2.npy | Bin 494 -> 912 bytes prody/tests/proteins/test_insty.py | 28 ++-------------------------- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/prody/tests/datafiles/2k39_all.npy b/prody/tests/datafiles/2k39_all.npy index 8378e52e178663c7f69c5697cbe03987dcb9d0da..e2f33f4cd9e05f7c479fd974f81c9c5386b64e6e 100644 GIT binary patch literal 912 zcmbR27wQ`j$;eQ~P_3SlTAW;@Zl$1ZlWC!@qoAIaUsO_*m=~X4l#&V(cT3DEP6dh= zXCxM+0{I%|Itqp+nmP)#3giMV3kC=4OTK9>N!jGqkh`LRF~Ksqh^BwZ7|-k^|KnuBIP=^Ck@8fXowrDk0ox7QMW;zDC8}0%k#X;FN&(b znZ)g2b%#4P>_eY&07Ez+K7=E1sB=m6!2*rYgciN0LZi~9QY)naqo1&<*1Ya(UVG)n d-%+3HfdO4g19k}=(mmqR=@NdujZ5qV?l)=9bIt$& diff --git a/prody/tests/datafiles/2k39_all2.npy b/prody/tests/datafiles/2k39_all2.npy index 8378e52e178663c7f69c5697cbe03987dcb9d0da..939bc885cee80f1c251f024fb758f602f6d0a928 100644 GIT binary patch literal 912 zcmbR27wQ`j$;eQ~P_3SlTAW;@Zl$1ZlWC!@qoAIaUsO_*m=~X4l#&V(cT3DEP6dh= zXCxM+0{I%|Itqp+nmP)#3giMV3kC=4(uUeK2(}8fqNfC;*4IA9?@) literal 494 zcmbVGO-sW-5ZyFQt5KWQUyxfO#?Xpl@!~=7;9x2Rp&q24OTK9>N!jGqkh`LRF~Ksqh^BwZ7|-k^|KnuBIP=^Ck@8fXowrDk0ox7QMW;zDC8}0%k#X;FN&(b znZ)g2b%#4P>_eY&07Ez+K7=E1sB=m6!2*rYgciN0LZi~9QY)naqo1&<*1Ya(UVG)n d-%+3HfdO4g19k}=(mmqR=@NdujZ5qV?l)=9bIt$& diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index 0bc9612ba..7c9e81cd5 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -30,31 +30,6 @@ def setUp(self): self.HPH_INTERACTIONS = parseDatafile('2k39_hph') self.HPH_INTERACTIONS2 = parseDatafile('2k39_hph2') self.DISU_INTERACTIONS = parseDatafile('2k39_disu') - - self.INTERACTIONS_ALL = InteractionsTrajectory() - self.data_all = self.INTERACTIONS_ALL.calcProteinInteractionsTrajectory(self.ATOMS, stop_frame=4, max_proc=2) - np.save('test_2k39_all.npy', self.data_all, allow_pickle=True) - - self.data_hbs = calcHydrogenBondsTrajectory(self.ATOMS, stop_frame=4, max_proc=2) - np.save('test_2k39_hbs.npy', np.array(self.data_hbs, dtype=object), allow_pickle=True) - - self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS, stop_frame=4, max_proc=2) - np.save('test_2k39_sbs.npy', np.array(self.data_sbs, dtype=object), allow_pickle=True) - - self.data_rib = calcRepulsiveIonicBondingTrajectory(self.ATOMS, stop_frame=4, max_proc=2) - np.save('test_2k39_rib.npy', np.array(self.data_rib, dtype=object), allow_pickle=True) - - self.data_PiStack = calcPiStackingTrajectory(self.ATOMS, stop_frame=4, max_proc=2) - np.save('test_2k39_PiStack.npy', np.array(self.data_PiStack, dtype=object), allow_pickle=True) - - self.data_PiCat = calcPiCationTrajectory(self.ATOMS, stop_frame=4, max_proc=2) - np.save('test_2k39_PiCat.npy', np.array(self.data_PiCat, dtype=object), allow_pickle=True) - - self.data_hph = calcHydrophobicTrajectory(self.ATOMS, stop_frame=4, max_proc=2) - np.save('test_2k39_hph.npy', np.array(self.data_hph, dtype=object), allow_pickle=True) - - self.data_disu = calcDisulfideBondsTrajectory(self.ATOMS, stop_frame=4, max_proc=2) - np.save('test_2k39_disu.npy', np.array(self.data_disu, dtype=object), allow_pickle=True) self.ATOMS_3O21 = parseDatafile('3o21') # has disulfides & not traj self.DISU_INTERACTIONS_3O21 = parseDatafile('3o21_disu') @@ -64,7 +39,8 @@ def testAllInteractionsCalc(self): if prody.PY3K: self.INTERACTIONS_ALL = InteractionsTrajectory() - self.data_all = self.INTERACTIONS_ALL.calcProteinInteractionsTrajectory(self.ATOMS) + self.data_all = np.array(self.INTERACTIONS_ALL.calcProteinInteractionsTrajectory(self.ATOMS, + stop_frame=13)) try: assert_equal(self.data_all, self.ALL_INTERACTIONS2, From be0883a38f54429a815d902d3634cd2da64f20d8 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Tue, 17 Dec 2024 16:42:39 +0000 Subject: [PATCH 10/13] fix save load test --- prody/tests/proteins/test_insty.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index 7c9e81cd5..029ff6a85 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -53,7 +53,8 @@ def testAllInteractionsSave(self): """Test for saving and loading all types of interactions.""" if prody.PY3K: self.INTERACTIONS_ALL = InteractionsTrajectory() - self.data_all = self.INTERACTIONS_ALL.calcProteinInteractionsTrajectory(self.ATOMS) + self.data_all = np.array(self.INTERACTIONS_ALL.calcProteinInteractionsTrajectory(self.ATOMS, + stop_frame=13)) np.save('test_2k39_all.npy', np.array(self.data_all, dtype=object), allow_pickle=True) From ab3d7f703da851d7fe8c564ba3613b4337298a0d Mon Sep 17 00:00:00 2001 From: James Krieger Date: Tue, 17 Dec 2024 17:13:47 +0000 Subject: [PATCH 11/13] fix other tests --- prody/tests/proteins/test_insty.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index 029ff6a85..cc3c07d16 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -73,7 +73,7 @@ def testHydrogenBonds(self): order can be also different in the interactions""" if prody.PY3K: - data_test = calcHydrogenBondsTrajectory(self.ATOMS) + data_test = calcHydrogenBondsTrajectory(self.ATOMS, stop_frame=13) assert_equal(sorted([i[-1][-1] for i in data_test]), sorted([i[-1][-1] for i in self.HBS_INTERACTIONS]), 'failed to get correct hydrogen bonds') @@ -81,7 +81,7 @@ def testSaltBridgesCalc(self): """Test for salt bridges without saving and loading.""" if prody.PY3K: - self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS) + self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS, stop_frame=13) assert_equal(sorted([i[-1][-1] for i in self.data_sbs]), sorted([i[-1][-1] for i in self.SBS_INTERACTIONS]), 'failed to get correct salt bridges') @@ -90,7 +90,7 @@ def testSaltBridgesSave(self): """Test for salt bridges with saving and loading (one type with results).""" if prody.PY3K: - self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS) + self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS, stop_frame=13) np.save('test_2k39_sbs.npy', np.array(self.data_sbs, dtype=object), allow_pickle=True) @@ -103,7 +103,7 @@ def testRepulsiveIonicBonding(self): """Test for repulsive ionic bonding.""" if prody.PY3K: - data_test = calcRepulsiveIonicBondingTrajectory(self.ATOMS) + data_test = calcRepulsiveIonicBondingTrajectory(self.ATOMS, stop_frame=13) assert_equal(sorted([i[-1][-1] for i in data_test if len(i) > 0]), sorted([i[-1][-1] for i in self.RIB_INTERACTIONS if len(i) > 0]), 'failed to get correct repulsive ionic bonding') @@ -111,7 +111,7 @@ def testPiStacking(self): """Test for pi-stacking interactions.""" if prody.PY3K: - data_test = calcPiStackingTrajectory(self.ATOMS) + data_test = calcPiStackingTrajectory(self.ATOMS, stop_frame=13) assert_equal(sorted([i[-1][-1] for i in data_test if len(i) > 0]), sorted([i[-1][-1] for i in self.PISTACK_INTERACTIONS if len(i) > 0]), 'failed to get correct pi-stacking interactions') @@ -119,7 +119,7 @@ def testPiCation(self): """Test for pi-stacking interactions.""" if prody.PY3K: - data_test = calcPiCationTrajectory(self.ATOMS) + data_test = calcPiCationTrajectory(self.ATOMS, stop_frame=13) assert_equal(sorted([i[-1][-1] for i in data_test if len(i) > 0]), sorted([i[-1][-1] for i in self.PICAT_INTERACTIONS if len(i) > 0]), 'failed to get correct pi-cation interactions') @@ -128,7 +128,7 @@ def testHydrophobicInteractions(self): """Test for hydrophobic interactions.""" if prody.PY3K: - data_test = calcHydrophobicTrajectory(self.ATOMS) + data_test = calcHydrophobicTrajectory(self.ATOMS, stop_frame=13) try: assert_equal(sorted([i[-1][-1] for i in data_test]), sorted([i[-1][-1] for i in self.HPH_INTERACTIONS2]), 'failed to get correct hydrophobic interactions without hpb.so') @@ -140,7 +140,7 @@ def testHydrophobicInteractions(self): def testDisulfideBondsCalcNone(self): """Test for disulfide bonds interactions without saving and loading.""" if prody.PY3K: - data_test = calcDisulfideBondsTrajectory(self.ATOMS) + data_test = calcDisulfideBondsTrajectory(self.ATOMS, stop_frame=13) 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') @@ -148,7 +148,7 @@ def testDisulfideBondsCalcNone(self): 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) + data_test = calcDisulfideBondsTrajectory(self.ATOMS, stop_frame=13) np.save('test_2k39_disu.npy', np.array(data_test, dtype=object), allow_pickle=True) From 9c00da753047c013600907f045375ecb35f749fa Mon Sep 17 00:00:00 2001 From: James Krieger Date: Tue, 17 Dec 2024 17:55:55 +0000 Subject: [PATCH 12/13] fix calcInteractionsMultipleFrames double appending --- prody/proteins/interactions.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/prody/proteins/interactions.py b/prody/proteins/interactions.py index 79fe85831..c23b3d5f5 100644 --- a/prody/proteins/interactions.py +++ b/prody/proteins/interactions.py @@ -1781,13 +1781,10 @@ def analyseFrame(i, interactions_all): if max_proc == 1: interactions_all = [] for i in range(len(atoms.getCoordsets()[start_frame:stop_frame])): - interactions_all.append([]) analyseFrame(i, interactions_all) else: with mp.Manager() as manager: interactions_all = manager.list() - for i in range(len(atoms.getCoordsets()[start_frame:stop_frame])): - interactions_all.append([]) i = start_frame while i < len(atoms.getCoordsets()[start_frame:stop_frame]): From 5e58c2034800f3768ef037d9e8aa4b5df381f639 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Tue, 17 Dec 2024 18:26:51 +0000 Subject: [PATCH 13/13] revert stop_frame on testing types --- prody/tests/proteins/test_insty.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/prody/tests/proteins/test_insty.py b/prody/tests/proteins/test_insty.py index cc3c07d16..029ff6a85 100644 --- a/prody/tests/proteins/test_insty.py +++ b/prody/tests/proteins/test_insty.py @@ -73,7 +73,7 @@ def testHydrogenBonds(self): order can be also different in the interactions""" if prody.PY3K: - data_test = calcHydrogenBondsTrajectory(self.ATOMS, stop_frame=13) + data_test = calcHydrogenBondsTrajectory(self.ATOMS) assert_equal(sorted([i[-1][-1] for i in data_test]), sorted([i[-1][-1] for i in self.HBS_INTERACTIONS]), 'failed to get correct hydrogen bonds') @@ -81,7 +81,7 @@ def testSaltBridgesCalc(self): """Test for salt bridges without saving and loading.""" if prody.PY3K: - self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS, stop_frame=13) + self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS) assert_equal(sorted([i[-1][-1] for i in self.data_sbs]), sorted([i[-1][-1] for i in self.SBS_INTERACTIONS]), 'failed to get correct salt bridges') @@ -90,7 +90,7 @@ def testSaltBridgesSave(self): """Test for salt bridges with saving and loading (one type with results).""" if prody.PY3K: - self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS, stop_frame=13) + self.data_sbs = calcSaltBridgesTrajectory(self.ATOMS) np.save('test_2k39_sbs.npy', np.array(self.data_sbs, dtype=object), allow_pickle=True) @@ -103,7 +103,7 @@ def testRepulsiveIonicBonding(self): """Test for repulsive ionic bonding.""" if prody.PY3K: - data_test = calcRepulsiveIonicBondingTrajectory(self.ATOMS, stop_frame=13) + data_test = calcRepulsiveIonicBondingTrajectory(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.RIB_INTERACTIONS if len(i) > 0]), 'failed to get correct repulsive ionic bonding') @@ -111,7 +111,7 @@ def testPiStacking(self): """Test for pi-stacking interactions.""" if prody.PY3K: - data_test = calcPiStackingTrajectory(self.ATOMS, stop_frame=13) + data_test = calcPiStackingTrajectory(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.PISTACK_INTERACTIONS if len(i) > 0]), 'failed to get correct pi-stacking interactions') @@ -119,7 +119,7 @@ def testPiCation(self): """Test for pi-stacking interactions.""" if prody.PY3K: - data_test = calcPiCationTrajectory(self.ATOMS, stop_frame=13) + data_test = calcPiCationTrajectory(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.PICAT_INTERACTIONS if len(i) > 0]), 'failed to get correct pi-cation interactions') @@ -128,7 +128,7 @@ def testHydrophobicInteractions(self): """Test for hydrophobic interactions.""" if prody.PY3K: - data_test = calcHydrophobicTrajectory(self.ATOMS, stop_frame=13) + data_test = calcHydrophobicTrajectory(self.ATOMS) try: assert_equal(sorted([i[-1][-1] for i in data_test]), sorted([i[-1][-1] for i in self.HPH_INTERACTIONS2]), 'failed to get correct hydrophobic interactions without hpb.so') @@ -140,7 +140,7 @@ def testHydrophobicInteractions(self): def testDisulfideBondsCalcNone(self): """Test for disulfide bonds interactions without saving and loading.""" if prody.PY3K: - data_test = calcDisulfideBondsTrajectory(self.ATOMS, stop_frame=13) + 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 2k39 (None) from calculation') @@ -148,7 +148,7 @@ def testDisulfideBondsCalcNone(self): 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, stop_frame=13) + data_test = calcDisulfideBondsTrajectory(self.ATOMS) np.save('test_2k39_disu.npy', np.array(data_test, dtype=object), allow_pickle=True)