next up previous contents index
Next: model.to_iupac() standardize Up: The model class: handling Previous: model.res_num_from() residue   Contents   Index

model.rename_segments() -- rename MODEL segments

rename_segments(segment_ids, renumber_residues=[])
This command re-labels residue numbers in each chain (i.e., segment) so that they start with renumber_residues[iseg]. In addition, the single character PDB chain id's are also assigned: They are obtained from the corresponding elements of segment_ids. Thus, there should be as many elements in segment_ids and renumber_residues as there are chains in the current MODEL.

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 (here there are two 'chains': protein and the HETATM
# water molecules).

from modeller import *

# Read the MODEL with all HETATM and water records (so there are two 'chains'):
env = environ()
env.io.atom_files_directory = '../atom_files'
env.io.hetatm = True
env.io.water = True

mdl = model(env, file='1fas')
# Assign new segment names and write out the new model:
mdl.rename_segments(segment_ids=('X', 'Y'))
mdl.write(file='1fas.ini')



Ben Webb 2008-02-01