Пример #1
0
 def phiPsi(self, conf = None):
     """
     :returns: a list of the (phi, psi) backbone angles for each residue
     :rtype: list of tuple of float
     """
     universe = self.universe()
     if universe is None:
         universe = Universe.InfiniteUniverse()
     angles = []
     for i in range(len(self)):
         r = self[i]
         if i == 0:
             phi = None
         else:
             phi = universe.dihedral(r.peptide.C, r.peptide.C_alpha,
                                     r.peptide.N,
                                     self[i-1].peptide.C, conf)
         if i == len(self)-1:
             psi = None
         else:
             psi = universe.dihedral(self[i+1].peptide.N,
                                     r.peptide.C, r.peptide.C_alpha,
                                     r.peptide.N, conf)
         angles.append((phi, psi))
     return angles
Пример #2
0
 def phiPsi(self, conf = None):
     """
     :returns: the values of the backbone dihedral angles phi and psi.
     :rtype: tuple (float, float)
     """
     universe = self.universe()
     if universe is None:
         universe = Universe.InfiniteUniverse()
     C = None
     for a in self.peptide.N.bondedTo():
         if a.parent.parent != self:
             C = a
             break
     if C is None:
         phi = None
     else:
         phi = universe.dihedral(self.peptide.C, self.peptide.C_alpha,
                                 self.peptide.N, C, conf)
     N = None
     for a in self.peptide.C.bondedTo():
         if a.parent.parent != self:
             N = a
             break
     if N is None:
         psi = None
     else:
         psi = universe.dihedral(N, self.peptide.C, self.peptide.C_alpha,
                                 self.peptide.N, conf)
     return phi, psi
Пример #3
0
 def createUnitCellUniverse(self):
     """
     Constructs an empty universe (OrthrhombicPeriodicUniverse or
     ParallelepipedicPeriodicUniverse) representing the
     unit cell of the crystal. If the PDB file does not define
     a unit cell at all, an InfiniteUniverse is returned.
     
     :returns: a universe
     :rtype: :class:~MMTK.Universe.Universe
     """
     if self.from_fractional is None:
         return Universe.InfiniteUniverse()
     e1 = self.from_fractional(Vector(1., 0., 0.))
     e2 = self.from_fractional(Vector(0., 1., 0.))
     e3 = self.from_fractional(Vector(0., 0., 1.))
     if abs(e1.normal()*Vector(1., 0., 0.)-1.) < 1.e-15 \
            and abs(e2.normal()*Vector(0., 1., 0.)-1.) < 1.e-15 \
            and abs(e3.normal()*Vector(0., 0., 1.)-1.) < 1.e-15:
         return \
            Universe.OrthorhombicPeriodicUniverse((e1.length(),
                                                   e2.length(),
                                                   e3.length()))
     return Universe.ParallelepipedicPeriodicUniverse((e1, e2, e3))
Пример #4
0
 def graphicsObjects(self, **options):
     """
     :keyword configuration: the configuration in which the objects
                             are drawn (default: the current configuration)
     :type configuration: :class:`~MMTK.ParticleProperties.Configuration`
     :keyword model: the graphical representation to be used (one of
                     "wireframe", "tube", "ball_and_stick", "vdw" and
                     "vdw_and_stick").  The vdw models use balls
                     with the radii taken from the atom objects.
                     Default is "wireframe".
     :type model: str
     :keyword ball_radius: the radius of the balls representing the atoms
                           in a ball_and_stick model, default: 0.03
                           This is also used in vdw and vdw_and_stick when
                           an atom does not supply a radius.
     :type ball_radius: float
     :keyword stick_radius: the radius of the sticks representing the bonds
                            in a ball_and_stick, vdw_and_stick or tube model.
                            Default: 0.02 for the tube model, 0.01 for the
                            ball_and_stick and vdw_and_stick models
     :type stick_radius: float
     :keyword graphics_module: the module in which the elementary graphics
                               objects are defined
                               (default: Scientific.Visualization.VRML)
     :type graphics_module: module
     :keyword color_values:  a color value for each atom which defines
                             the color via the color scale object specified
                             by the option color_scale. If no value is
                             given, the atoms' colors are taken from the
                             attribute 'color' of each atom object (default
                             values for each chemical element are provided
                             in the chemical database).
     :type  color_values: :class:`~MMTK.ParticleProperties.ParticleScalar`
     :keyword color_scale: an object that returns a color object (as defined
                           in the module Scientific.Visualization.Color)
                           when called with a number argument. Suitable
                           objects are defined by
                           Scientific.Visualization.Color.ColorScale and
                           Scientific.Visualization.Color.SymmetricColorScale.
                           The object is used only when the option
                           color_values is specified as well. The default
                           is a blue-to-red color scale that covers the
                           range of the values given in color_values.
     :type color_scale: callable
     :keyword color: a color name predefined in the module
                     Scientific.Visualization.Color. The corresponding
                     color is applied to all graphics objects that are
                     returned.
     :returns: a list of graphics objects that represent
               the object for which the method is called.
     :rtype: list
     """
     conf = options.get('configuration', None)
     model = options.get('model', 'wireframe')
     if model == 'tube':
         model = 'ball_and_stick'
         radius = options.get('stick_radius', 0.02)
         options['stick_radius'] = radius
         options['ball_radius'] = radius
     try:
         module = options['graphics_module']
     except KeyError:
         from Scientific.Visualization import VRML
         module = VRML
     color = options.get('color', None)
     if color is None:
         color_values = options.get('color_values', None)
         if color_values is not None:
             lower = N.minimum.reduce(color_values.array)
             upper = N.maximum.reduce(color_values.array)
             options['color_scale'] = module.ColorScale((lower, upper))
     try:
         distance_fn = self.universe().distanceVector
     except AttributeError:
         from MMTK import Universe
         distance_fn = Universe.InfiniteUniverse().distanceVector
     return self._graphics(conf, distance_fn, model, module, options)