def makeFragment(phiPsiList): c_pos = Vector(0, 0, 0) o_pos = Vector(C_O_distance, 0, 0) ca_pos = makeXYZFromAngle(o_pos, c_pos, CA_C_distance, CA_C_O_angle, -Y) nCap = Residue(1, "GLY") nCap.subFeatures = [Atom("CA", ca_pos), Atom("C", c_pos), Atom("O", o_pos)] (phi, psi) = phiPsiList[0] N_CA_C_O_torsion = invertTorsion(psi) n_pos = makeXYZFromAngle(o_pos, c_pos, C_N_distance, O_C_N_angle, Y) ca_pos = makeXYZ(n_pos, N_CA_distance, c_pos, C_N_CA_angle, o_pos, 0) c_pos = makeXYZ(ca_pos, CA_C_distance, n_pos, N_CA_C_angle, c_pos, phi) o_pos = makeXYZ(c_pos, C_O_distance, ca_pos, CA_C_O_angle, n_pos, N_CA_C_O_torsion) firstResidue = Residue(2, "GLY") firstResidue.subFeatures = [Atom("N", n_pos), Atom("CA", ca_pos), Atom("C", c_pos), Atom("O", o_pos)] chain = Chain("A") chain.add(nCap) chain.add(firstResidue) extendChain(phiPsiList[1:], psi, chain) last = chain.subFeatures[-1] lastPsi = phiPsiList[-1][1] n_pos = last.getAtomPosition("N") ca_pos = last.getAtomPosition("CA") c_pos = last.getAtomPosition("C") o_pos = last.getAtomPosition("O") n_pos = makeXYZ(c_pos, C_N_distance, ca_pos, CA_C_N_angle, n_pos, lastPsi) cCap = Residue(last.number + 1, "GLY") cCap.subFeatures = [Atom("N", n_pos)] chain.add(cCap) return chain
def makeNTerminalResidue(psi): N_CA_C_O_torsion = invertTorsion(psi) nitrogen = Vector(0.0, 0.0, 0.0) cAlpha = Vector(N_CA_distance, 0.0, 0.0) carbonylCarbon = makeXYZFromAngle(nitrogen, cAlpha, CA_C_distance, N_CA_C_angle, Y) oxygen = makeXYZ(carbonylCarbon, C_O_distance, cAlpha, CA_C_O_angle, nitrogen, N_CA_C_O_torsion) r = Residue(1, "GLY") r.subFeatures = [Atom("N", 1, nitrogen), Atom("CA", 2, cAlpha), Atom("C", 3, carbonylCarbon), Atom("O", 4, oxygen)] return r