Пример #1
0
  public static double getGenChi1(Residue res) {
    // Get the generalized chi1 of a residue

    if (res.template.name.equalsIgnoreCase("GLY")) return 0;
    else {
      String lastAtom = getGenChi1LastAtom(res.template.name);

      double lastCoords[] = res.getCoordsByAtomName(lastAtom);

      double[][] keyCoords = HardCodedResidueInfo.getKeyCoords(res);
      double[] NCoords = keyCoords[0];
      double[] CACoords = keyCoords[1];
      double[] CBCoords = keyCoords[2];

      if (lastCoords == null || NCoords == null || CACoords == null | CBCoords == null) {
        // not a protein residue. Doesn't have gen chi1
        return Double.NaN;
      }

      if (lastCoords == null || NCoords == null || CACoords == null | CBCoords == null) {
        // not a protein residue.  Doesn't have gen chi1
        return Double.NaN;
      }

      // coordinates defining dihedral
      double dihCoords[][] = new double[][] {NCoords, CACoords, CBCoords, lastCoords};

      return Protractor.measureDihedral(dihCoords);
    }
  }
Пример #2
0
  public static void setGenChi1(Residue res, double ang) {
    // set the residue to have the specified gen chi1 (in degrees)

    if ((!HardCodedResidueInfo.hasAminoAcidBB(res))
        || !(HardCodedResidueInfo.hasNucleicAcidBB(res)) // DZ: NA BBs are fine now
        || res.template.name.equalsIgnoreCase("GLY")
        || res.template.name.equalsIgnoreCase("PRO")) {
      // Glycine doesn't have a generalized chi1,
      // and we cannot freely change proline's (sidechain idealization sets
      // a chi1 for proline that should remain in place)
      return;
    }

    double curGenChi1 = getGenChi1(res);
    double genChi1Change = ang - curGenChi1;

    double[][] keyCoords = HardCodedResidueInfo.getKeyCoords(res);
    double[] CACoords = keyCoords[1];
    double[] CBCoords = keyCoords[2];
    // pivotAtom will be CB for amino acids, N9 or N1 for nucleic acids.
    String pivotAtom =
        HardCodedResidueInfo.hasNucleicAcidBB(res)
            ? HardCodedResidueInfo.isPyrimidine(res.template.name) ? "N9" : "N1"
            : "CB";

    DihedralRotation dihRot = new DihedralRotation(CACoords, CBCoords, genChi1Change);

    // now carry out the rotation on all the sidechain atoms
    // (expect CB, since it's part of the bond begin rotated around)
    int numAtoms = res.atoms.size();
    for (int atomNum = 0; atomNum < numAtoms; atomNum++) {

      String atomName = res.atoms.get(atomNum).name;

      if (SidechainIdealizer.isSidechainAtom(atomName, res)) {
        if (!(atomName.equalsIgnoreCase(pivotAtom))) {
          dihRot.transform(res.coords, atomNum);
        }
      }
    }
  }