model.rename_segments() — rename MODEL segments

rename_segments(segment_ids, renumber_residues=[])
This assigns single character PDB chain IDs (from segment_ids; there should be as many elements in segment_ids as there are chains in the current MODEL). The residues in each chain are also renumbered consecutively, starting with the corresponding element from renumber_residues if provided, or the existing first residue number otherwise.

See also Chain.name for assigning chain IDs individually without also renumbering residues.

Example: examples/commands/rename_segments.py

# Example for: model.rename_segments()

# This will assign new PDB single-character chain id's to all the chains
# in the input PDB file (in this example there are two chains).

from modeller import *

env = environ()
env.io.atom_files_directory = ['../atom_files']
mdl = model(env, file='2abx')

# Assign new segment names and write out the new model:
mdl.rename_segments(segment_ids=('X', 'Y'))
mdl.write(file='2abx-renamed.pdb')



Automatic builds 2017-07-19