next up previous contents index
Next: model.unbuild() undefine Up: The model class: handling Previous: model.mutate() mutate   Contents   Index

model.build() -- build MODEL coordinates from topology

initialize_xyz = <bool:1> True whether to use IC entries to calculate all coordinates
build_method = <str:1> 'INTERNAL_COORDINATES' method for building coordinates: 'INTERNAL_COORDINATES' | 'ONE_STICK' | 'TWO_STICKS' | '3D_INTERPOLATION'

Requirements:
topology file & parameters file & MODEL topology

Description:
This command builds Cartesian coordinates of the MODEL.

If initialize_xyz is True, all coordinates are built. Otherwise only the undefined coordinates are built. The latter is useful because some coordinates may be undefined after the model.read() or model.transfer_xyz() command. The undefined coordinates have a value of $-999.$ when written to a PDB file.

If build_method is 'INTERNAL_COORDINATES', the Cartesian coordinates are built from the ideal values of the internal coordinates as obtained from the IC entries in the residue topology library. If an appropriate IC entry does not exist, the ideal value of the internal coordinate is calculated from the corresponding energy term in the parameter library. If some coordinates still cannot be built, they are set to values close to those of the neighboring atoms. If even this fails, they are set randomly.

If build_method is '3D_INTERPOLATION', the Cartesian coordinates are built by linearly interpolating between the two defined atoms that span the contiguous undefined segment of atoms. In this mode, both the mainchain and sidechain conformations of all inserted residues are random and distorted. This build-up mode is useful because it may eliminate a knot and minimize the extended nature of the insertion obtained by build_method = 'INTERNAL_COORDINATES'. In the end, the coordinates of each of the interpolated atoms are slightly randomized ( $\pm 0.2\mbox{\AA}$) to prevent numerical problems with colinear angles and colinear dihedral angles. If one or both of the spanning atoms are undefined, the 'ONE_STICK' option (below) is used.

If build_method is 'ONE_STICK', the Cartesian coordinates are built by ``growing'' them linearly out of the N-terminal spanning atom (C-terminal atom for the undefined N-terminal), away from the gravity center of all the defined atoms. If there are no spanning atoms, the spanning atom is defined randomly.

If build_method is 'TWO_STICK', the loop is broken into two equal pieces and the 'ONE_STICK' algorithm is applied to both halves of the loop separately.

Example: examples/commands/build_model.py


# Example for: model.build()
# This will build a model for a given sequence in an extended conformation.

env = environ()
env.libs.topology.read(file='$(LIB)/top_heav.lib')
env.libs.parameters.read(file='$(LIB)/par.lib')

# Read the sequence from a file (does not have to be part of an alignment):
aln = alignment(env, file='toxin.ali', align_codes='1fas')
# Calculate its molecular topology:
mdl = model(env)
mdl.generate_topology(aln, sequence='1fas')
# Calculate its Cartesian coordinates using internal coordinates and
# parameters if necessary:
mdl.build(initialize_xyz=True, build_method='INTERNAL_COORDINATES')

# Write the coordinates to a PDB file:
mdl.write(file='1fas.ini')

Example: examples/commands/all_hydrogen.py


# Example for: model.generate_topology(), model.build()

# This will read a specified atom file, generate all hydrogen atoms,
# add atomic radii and charges, and write the model to a PDB file in
# the GRASP format. This can be used with GRASP to display electrostatic
# properties without assigning charges and radii in GRASP.

log.verbose()
env = environ()

env.libs.topology.read(file='$(LIB)/top_allh.lib')
env.libs.parameters.read(file='$(LIB)/par.lib')

code = '1fas'
mdl = model(env, file=code)

aln = alignment(env)
aln.append_model(mdl, align_codes=code, atom_files=code)
aln.append_model(mdl, align_codes=code+"-ini", atom_files=code+".ini")

mdl.generate_topology(aln, sequence=code)

# Have to patch the topology here to remove sulfhydril hydrogens:
mdl.patch(residue_type='DISU', residue_ids=('17', '39'))
mdl.patch(residue_type='DISU', residue_ids=( '3', '22'))
mdl.patch(residue_type='DISU', residue_ids=('53', '59'))
mdl.patch(residue_type='DISU', residue_ids=('41', '52'))

mdl.transfer_xyz(aln)
mdl.build(initialize_xyz=False, build_method='INTERNAL_COORDINATES')

mdl.write(file='1fas.ini1', model_format='GRASP')
mdl.write(file='1fas.ini2', model_format='PDB')


next up previous contents index
Next: model.unbuild() undefine Up: The model class: handling Previous: model.mutate() mutate   Contents   Index
Ben Webb 2005-06-20