Skip to content

Commit

Permalink
add selstr to cum ints
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Nov 22, 2024
1 parent b811e3c commit 3724094
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions prody/proteins/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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)

Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 3724094

Please sign in to comment.