Exemplo n.º 1
0
def calculate_chi(residue, j):
  res_chi_topology = get_res_chi_topology(residue.type)
  if j < len(res_chi_topology):
    p = [residue.atom(atom_type).pos for atom_type in res_chi_topology[j]]
    angle = vector3d.pos_dihedral(p[0], p[1], p[2], p[3])
    return vector3d.normalize_angle(angle)
  raise ValueError, "No Chi%d angle for res %d" % (j, i)
Exemplo n.º 2
0
def calculate_chi(residue, j):
  res_chi_topology = get_res_chi_topology(residue.type)
  if j < len(res_chi_topology):
    p = [residue.atom(atom_type).pos for atom_type in res_chi_topology[j]]
    angle = vector3d.pos_dihedral(p[0], p[1], p[2], p[3])
    return vector3d.normalize_angle(angle)
  raise ValueError, "No Chi%d angle for res %d" % (j, i)
Exemplo n.º 3
0
 def chi(self, i, j):
   res = self.residue(i)
   if _chi_topology.has_key(res.type):
     if j < len(_chi_topology[res.type]):
       p = [res.atom(atom_type).pos
           for atom_type in _chi_topology[res.type][j]]
       angle = vector3d.pos_dihedral(p[0], p[1], p[2], p[3])
       return vector3d.normalize_angle(angle)
   raise ValueError, "No Chi%d angle for res %s-%d" % (j, res.type, i)
Exemplo n.º 4
0
 def chi(self, i, j):
   res = self.residue(i)
   if _chi_topology.has_key(res.type):
     if j < len(_chi_topology[res.type]):
       p = [res.atom(atom_type).pos
           for atom_type in _chi_topology[res.type][j]]
       angle = vector3d.pos_dihedral(p[0], p[1], p[2], p[3])
       return vector3d.normalize_angle(angle)
   raise ValueError, "No Chi%d angle for res %s-%d" % (j, res.type, i)
Exemplo n.º 5
0
  def psi(self, i):
    if "NME" in self.residue(i).type:
      raise ValueError, "Can't calculate psi of NME"

    if i < self.n_residue() - 1:
      p1 = self.residue(i).atom("N").pos
      p2 = self.residue(i).atom("CA").pos
      p3 = self.residue(i).atom("C").pos
      p4 = self.residue(i+1).atom("N").pos
      angle = vector3d.pos_dihedral(p1, p2, p3, p4)
    else:
      p1 = self.residue(i).atom("N").pos
      p2 = self.residue(i).atom("CA").pos
      p3 = self.residue(i).atom("C").pos
      p4 = self.residue(i).atom("O").pos
      angle = math.pi + vector3d.pos_dihedral(p1, p2, p3, p4)

    return vector3d.normalize_angle(angle)
Exemplo n.º 6
0
  def psi(self, i):
    if "NME" in self.residue(i).type:
      raise ValueError, "Can't calculate psi of NME"

    if i < self.n_residue() - 1:
      p1 = self.residue(i).atom("N").pos
      p2 = self.residue(i).atom("CA").pos
      p3 = self.residue(i).atom("C").pos
      p4 = self.residue(i+1).atom("N").pos
      angle = vector3d.pos_dihedral(p1, p2, p3, p4)
    else:
      p1 = self.residue(i).atom("N").pos
      p2 = self.residue(i).atom("CA").pos
      p3 = self.residue(i).atom("C").pos
      p4 = self.residue(i).atom("O").pos
      angle = math.pi + vector3d.pos_dihedral(p1, p2, p3, p4)

    return vector3d.normalize_angle(angle)
Exemplo n.º 7
0
  def phi(self, i):
    if "ACE" in self.residue(i).type:
      raise ValueError, "Can't calculate phi of ACE"

    if i == 0:
      if "PRO" in self.residue(i).type:
        atoms = [(i, "CD1"), (i, "N"), (i, "CA"), (i, "C")]
      elif self.residue(i).has_atom("H"):
        atoms = [(i, "H"), (i, "N"), (i, "CA"), (i, "C")]
      elif self.residue(i).has_atom("H1"):
        atoms = [(i, "H1"), (i, "N"), (i, "CA"), (i, "C")]
      else:
        raise ValueError, "Can't find atoms to calculate phi"
    else:
      if "ACE" in self.residue(i-1).type:
        atoms = [(i-1, "CH3"), (i, "N"), (i, "CA"), (i, "C")]
      else:
        atoms = [(i-1, "C"), (i, "N"), (i, "CA"), (i, "C")]

    p = [self.residue(j).atom(a_type).pos for j, a_type in atoms]
    return vector3d.normalize_angle(vector3d.pos_dihedral(p[0], p[1], p[2], p[3]))
Exemplo n.º 8
0
  def phi(self, i):
    if "ACE" in self.residue(i).type:
      raise ValueError, "Can't calculate phi of ACE"

    if i == 0:
      if "PRO" in self.residue(i).type:
        atoms = [(i, "CD1"), (i, "N"), (i, "CA"), (i, "C")]
      elif self.residue(i).has_atom("H"):
        atoms = [(i, "H"), (i, "N"), (i, "CA"), (i, "C")]
      elif self.residue(i).has_atom("H1"):
        atoms = [(i, "H1"), (i, "N"), (i, "CA"), (i, "C")]
      else:
        raise ValueError, "Can't find atoms to calculate phi"
    else:
      if "ACE" in self.residue(i-1).type:
        atoms = [(i-1, "CH3"), (i, "N"), (i, "CA"), (i, "C")]
      else:
        atoms = [(i-1, "C"), (i, "N"), (i, "CA"), (i, "C")]

    p = [self.residue(j).atom(a_type).pos for j, a_type in atoms]
    return vector3d.normalize_angle(vector3d.pos_dihedral(p[0], p[1], p[2], p[3]))