next up previous contents index
Next: chain Up: MODELLER command reference Previous: Structure.reread() reread   Contents   Index

The Chain class: a single chain in a model or alignment

The Chain class holds information about a single chain, in a model (see Sequence.chains), an alignment sequence, or an alignment template structure.

Example: examples/python/

# Example for 'chain' objects

from modeller import *
from modeller.scripts import complete_pdb

env = environ() = ['../atom_files']'$(LIB)/top_heav.lib')'$(LIB)/par.lib')

mdl = complete_pdb(env, "1b3q")

# Print existing chain IDs and lengths:
print "Chain IDs and lengths: ", [(, len(c.residues)) for c in mdl.chains]

# Set new chain IDs:
mdl.chains['A'].name = 'X'
mdl.chains['B'].name = 'Y'

# Write out chain sequences:
for c in mdl.chains:
    c.write(file='1b3q%s.chn' %, atom_file='1b3q',
            align_code='1b3q%s' %


Automatic builds 2011-03-29