Keywords: manual

Next: model.write() write Up: The model class: handling Previous: model.read() read Contents Index

## model.build_sequence() -- build model from a sequence of one-letter codes

`build_sequence(sequence, special_patches=None, patch_default=True)`

> This builds a new model (overwriting any existing one) of the given sequence, specified as one-letter codes. The sequence can also contain '/' characters to build multi-chain models. The coordinates of the model are automatically constructed using model.build().

> special_patches and patch_default can be used to adjust the topology; see complete_pdb() for more details.

> See also alignment.append_sequence().

Example: examples/commands/build_sequence.py

      # This demonstrates the use of alignment.append_sequence() and
      # model.build_sequence() to build residue sequences from one-letter codes

      from modeller import *
      env = environ()

      # Read parameters (needed to build models from internal coordinates)
      env.libs.topology.read('${LIB}/top_heav.lib')
      env.libs.parameters.read('${LIB}/par.lib')

      # Create a new empty alignment and model:
      aln = alignment(env)
      mdl = model(env)

      # Build a model from one-letter codes, and write to a PDB file:
      mdl.build_sequence("AFVVTDNCIK/CKYTDCVEVC")
      mdl.write(file='sequence.pdb')

      # Build an alignment from one-letter codes
      aln.append_sequence("AF---VVTDN---CIKCK------")
      aln.append_sequence("-------AFVVTDN--CI--K-CK")
      # Set alignment information, and write to file:
      aln[0].code = 'seq1'
      aln[1].code = 'seq2'
      aln.write(file='sequence.ali')