예제 #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))
        || 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;

    DihedralRotation dihRot =
        new DihedralRotation(
            res.getCoordsByAtomName("CA"), res.getCoordsByAtomName("CB"), 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("CB"))) dihRot.transform(res.coords, atomNum);
      }
    }
  }
예제 #3
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);
        }
      }
    }
  }
예제 #4
0
  public static String getGenChi1LastAtom(String resName) {
    // Get atom name X where generalized chi1 is N-CA-CB-X

    if (resName.equalsIgnoreCase("val") || resName.equalsIgnoreCase("ile")) {
      return "CG1";
    } else if (resName.equalsIgnoreCase("ser")) {
      return "OG";
    } else if (resName.equalsIgnoreCase("thr")) {
      return "OG1";
    } else if (resName.equalsIgnoreCase("cys") || resName.equalsIgnoreCase("cyx")) {
      return "SG";
    } else if (resName.equalsIgnoreCase("ala")) {
      return "HB1";
    } else if (HardCodedResidueInfo.isPyrimidine(resName)) {
      return "C2";
    } else if (HardCodedResidueInfo.isPurine(resName)) {
      return "C4";
    } else {
      return "CG";
    }
  }