Ejemplo n.º 1
0
def readKinemageSuites(lines, dimension):
  """Read a list of kinemage data lines to yield a suite."""
  suites = []
  for line in lines:
    if len(line.strip()) == 0 or line[0] == "#":  # blank or comment line
      continue
    # A meaningful line begins with an id string enclosed in braces
    if line[0] == "{":
      mark = line.find("}")
      if mark > 0:
        idString = line[1:mark]
        ids = idString.split(":")

        # there may be some miscellaneous markers after the id string
        k = mark + 1
        while k < len(line) and not line[k].isdigit():
          k = k + 1
        mark2 = k

        # once we see a number, everything else is angles
        angleText = line[mark2:]
        angleStrings = angleText.split(" ")
        angleStrings2 = angleText.split(",")
        if len(angleStrings2) > len(angleStrings):
          angleStrings = angleStrings2
        angleList = [stringToFloat(s) for s in angleStrings]
        if len(angleList) != dimension:
          continue  # wrong number of dimensions means probably not a data point
        if dimension == 9:
          angles = np.array(angleList)
        else:  # given only 7 angles,skipping the chi angles on the ends
          angles = np.array([180.0] + angleList + [180.0])
        for i in range(len(angles)):
          if angles[i] < 0:
            angles[i] += 360.0

        suite = Suite(ids, ids[9][2], angles)
        suites.append(suite)
  return suites
Ejemplo n.º 2
0
def buildSuiteLast(r1):
  suite = Suite((), "")
  if len(r1.angle) > 6:
    suite.chiMinus = r1.chi
  suite.deltaMinus = r1.delta
  suite.epsilon = r1.epsilon
  suite.zeta = r1.zeta
  suite.alpha = 999
  suite.beta = 999
  suite.gamma = 999
  suite.delta = 999
  suite.chi = 999
  return suite
Ejemplo n.º 3
0
def buildSuiteFirst(r2):
  suite = Suite(r2.pointIDs, r2.base)
  suite.alpha = r2.alpha
  suite.beta = r2.beta
  suite.gamma = r2.gamma
  suite.delta = r2.delta
  if len(r2.angle) > 6:
    suite.chi = r2.chi
  suite.epsilon = 999
  suite.zeta = 999
  suite.chiMinus = 999
  suite.deltaMinus = 999
  return suite
Ejemplo n.º 4
0
def buildSuiteBetweenResidues(r1, r2):
  suite = Suite(r2.pointIDs, r2.base)
  if len(r1.angle) > 6:
    suite.chiMinus = r1.chi
  suite.deltaMinus = r1.delta
  suite.epsilon = r1.epsilon
  suite.zeta = r1.zeta
  suite.alpha = r2.alpha
  suite.beta = r2.beta
  suite.gamma = r2.gamma
  suite.delta = r2.delta
  if len(r2.angle) > 6:
    suite.chi = r2.chi
  return suite