From 3724094778ff0bfaa6f2fd3a2a0feafa1e283700 Mon Sep 17 00:00:00 2001 From: James Krieger Date: Fri, 22 Nov 2024 18:10:48 +0100 Subject: [PATCH] add selstr to cum ints --- prody/proteins/interactions.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/prody/proteins/interactions.py b/prody/proteins/interactions.py index eacd6c354..183345a0e 100644 --- a/prody/proteins/interactions.py +++ b/prody/proteins/interactions.py @@ -21,7 +21,7 @@ from numpy import * from prody import LOGGER, SETTINGS, PY3K from prody.atomic import AtomGroup, Atom, Atomic, Selection, Select -from prody.atomic import flags +from prody.atomic import flags, sliceAtomicData from prody.utilities import importLA, checkCoords, showFigure, getCoords from prody.measure import calcDistance, calcAngle, calcCenter from prody.measure.contacts import findNeighbors @@ -3789,7 +3789,10 @@ def showCumulativeInteractionTypes(self, **kwargs): :arg DiBs: score per disulfide bond :type DiBs: int, float - + + :arg selstr: selection string for focusing the plot + :type selection: str + :arg energy: sum of the energy between residues default is False :type energy: bool @@ -3849,6 +3852,10 @@ def showCumulativeInteractionTypes(self, **kwargs): vmin = kwargs.pop('vmin', vmin) vmax = kwargs.pop('vmax', vmax) + selstr = kwargs.pop('selstr', None) + if selstr is not None: + atoms = atoms.select(selstr) + ResNumb = atoms.select('protein and name CA').getResnums() ResName = atoms.select('protein and name CA').getResnames() ResChid = atoms.select('protein and name CA').getChids() @@ -3872,6 +3879,10 @@ def showCumulativeInteractionTypes(self, **kwargs): fig, ax = plt.subplots(num=None, figsize=(20,6), facecolor='w') matplotlib.rcParams['font.size'] = '24' + if selstr is not None: + matrix_en_sum = sliceAtomicData(matrix_en_sum, + self._atoms.ca, selstr) + zeros_row = np.zeros(matrix_en_sum.shape) pplot(zeros_row, atoms=atoms.ca) @@ -3921,6 +3932,23 @@ def showCumulativeInteractionTypes(self, **kwargs): matrix_hph_sum = np.sum(matrix_hph, axis=0) matrix_dibs_sum = np.sum(matrix_dibs, axis=0) + all_ca = self._atoms.ca + if selstr is not None: + matrix_hbs_sum = sliceAtomicData(matrix_hbs_sum, + all_ca, selstr) + matrix_sbs_sum = sliceAtomicData(matrix_sbs_sum, + all_ca, selstr) + matrix_rib_sum = sliceAtomicData(matrix_rib_sum, + all_ca, selstr) + matrix_pistack_sum = sliceAtomicData(matrix_pistack_sum, + all_ca, selstr) + matrix_picat_sum = sliceAtomicData(matrix_picat_sum, + all_ca, selstr) + matrix_hph_sum = sliceAtomicData(matrix_hph_sum, + all_ca, selstr) + matrix_dibs_sum = sliceAtomicData(matrix_dibs_sum, + all_ca, selstr) + width = 0.8 fig, ax = plt.subplots(num=None, figsize=(20,6), facecolor='w') matplotlib.rcParams['font.size'] = '24'