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

Hotfix: ResidueGroup of an AtomGroup now updated on resname or resnum set #422

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 10 additions & 2 deletions package/MDAnalysis/core/AtomGroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1697,6 +1697,11 @@ def set_resnums(self, resnum):
"""
self.set("resnum", resnum)

# set the resnum for each of the residues in this AtomGroup's
# ResidueGroup
for residue in self.residues:
residue.resnum = residue[0].resnum

set_resnum = deprecate(set_resnums, old_name='set_resnum', new_name='set_resnums')

def set_resnames(self, resname):
Expand All @@ -1716,10 +1721,13 @@ def set_resnames(self, resname):
.. versionchanged:: 0.11.0
Made plural to make consistent with corresponding property
"""
from MDAnalysis.topology.core import build_residues

self.set("resname", resname, conversion=str)

# set the resname for each of the residues in this AtomGroup's
# ResidueGroup
for residue in self.residues:
residue.resname = residue[0].resname

set_resname = deprecate(set_resnames, old_name='set_resname', new_name='set_resnames')

def set_segids(self, segid):
Expand Down