Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add hierview numChains etc to general atomic #1922

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions prody/atomic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
atomic.AtomMap = AtomMap
atomic.AtomGroup = AtomGroup
atomic.Selection = Selection
atomic.HierView = HierView

atomgroup.isReserved = isReserved
atomgroup.HierView = HierView
Expand Down
26 changes: 20 additions & 6 deletions prody/atomic/atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,26 @@ def getSequence(self, **kwargs):

return seq

def getHierView(self, **kwargs):
"""Returns a hierarchical view of the atom selection."""

return HierView(self, **kwargs)

def numSegments(self):
"""Returns number of segments."""

return self.getHierView().numSegments()

def numChains(self):
"""Returns number of chains."""

return self.getHierView().numChains()

def numResidues(self):
"""Returns number of residues."""

return self.getHierView().numResidues()

def toTEMPyAtoms(self):
"""Returns a :class:`TEMPy.protein.prot_rep_biopy.Atom` or list of them as appropriate"""
try:
Expand All @@ -277,12 +297,6 @@ def toTEMPyStructure(self):

return BioPy_Structure(self.toTEMPyAtoms())

def numResidues(self):
"""Returns number of residues."""

return len(set(self._getResindices()))


def toBioPythonStructure(self, header=None, **kwargs):
"""Returns a :class:`Bio.PDB.Structure` object

Expand Down
Loading