## model.color() — color MODEL according to alignment

`color(aln)`

> This command ‘colors’ the model according to a given alignment, aln, between the model and a sequence. The model has to be the first protein in the alignment. The second protein can be any sequence, with or without known structure.

> The coloring is done by setting the Biso (isotropic temperature factor) field in the model as follows:

- 0, for those regions that have residues in both MODEL and the sequence (blue in RASMOL; light green in QUANTA);
- 1, for the two residues that span regions occurring in the sequence but not in MODEL (green in RASMOL; pink in QUANTA);
- 2, regions that occur in MODEL but are deleted from the sequence (red in RASMOL; bright green in QUANTA).

> The model can then be written out with model.write() as a PDB file, and colored using your PDB viewer based on the temperature factors. You can then inspect the model for the structural context of deletions and insertions. This is useful in optimizing the alignment for comparative modeling.

Example: examples/commands/color_aln_model.py

      # Example for: model.color()

      # Two demos:
      #
      # 1) Use a given alignment to color a structure according to
      #    insertions and deletions in a pairwise alignment.
      #
      # 2) Superpose two 3D structure and do (1).

      from modeller import *
      env = environ()
      env.io.atom_files_directory = ['../atom_files']

      # Demo 1:
      mdl = model(env)
      aln = alignment(env)
      mdl.read(file='2nbt', model_segment=('FIRST:A', 'LAST:A'))
      aln.append(file='toxin.ali', align_codes=('2nbt', '1fas'), remove_gaps=True)
      mdl.color(aln)
      mdl.write(file='2nbt-1.clr')

      # Demo 2:
      aln = alignment(env)
      segs = {'2nbt':('1:A', '66:A'), '1fas':('1:A', '61:A')}
      for code in ('2nbt', '1fas'):
          mdl.read(file=code, model_segment=segs[code])
          aln.append_model(mdl, align_codes=code, atom_files=code)
      aln.align(gap_penalties_1d=(-600, -400))
      aln.malign3d(gap_penalties_3d=(0, 3.0))
      aln.write(file='color_aln_model.pap', alignment_format='PAP')

      mdl.read(file='2nbt', model_segment=segs['2nbt'])
      mdl.color(aln)
      mdl.write(file='2nbt-2.clr')