コード例 #1
0
ファイル: SecStruc.java プロジェクト: panyao/jsMapReduce
  /**
   * Use unit vectors NC and NCalpha Add them. Calc unit vector and substract it from N. C
   * coordinates are from amino acid i-1 N, CA atoms from amino acid i
   *
   * <p>see also:
   *
   * @link
   *     {http://openbioinformatics.blogspot.com/2009/08/how-to-calculate-h-atoms-for-nitrogens.html}
   */
  private static Atom calc_H(Atom C, Atom N, Atom CA) throws StructureException {

    Atom nc = Calc.substract(N, C);
    Atom nca = Calc.substract(N, CA);

    Atom u_nc = Calc.unitVector(nc);
    Atom u_nca = Calc.unitVector(nca);

    Atom added = Calc.add(u_nc, u_nca);

    Atom U = Calc.unitVector(added);

    // according to Creighton distance N-H is 1.03 +/- 0.02A
    Atom H = Calc.add(N, U);

    H.setName("H");
    H.setFullName(" H  ");
    // this atom does not have a pdbserial number ...
    return H;
  }
コード例 #2
0
ファイル: SecStruc.java プロジェクト: panyao/jsMapReduce
  /**
   * calculate distance between two atoms.
   *
   * @param a an Atom object
   * @param b an Atom object
   * @return a double
   * @throws StructureException ...
   */
  public static BigDecimal getPreciseDistance(Atom a, Atom b) throws StructureException {
    double x = a.getX() - b.getX();
    double y = a.getY() - b.getY();
    double z = a.getZ() - b.getZ();

    double s = x * x + y * y + z * z;
    BigSqrt sqrt = new BigSqrt();
    BigDecimal d = new BigDecimal(s);
    BigDecimal dist = sqrt.sqrt(d);

    return dist;
  }
コード例 #3
0
ファイル: SecStruc.java プロジェクト: panyao/jsMapReduce
  private static Atom calcSimple_H(Atom c, Atom o, Atom n) throws StructureException {

    Atom h = Calc.substract(c, o);
    double dist = Calc.getDistance(o, c);
    // System.out.println(dist);
    double x = n.getX() + h.getX() / dist;
    double y = n.getY() + h.getY() / dist;
    double z = n.getZ() + h.getZ() / dist;

    h.setX(x);
    h.setY(y);
    h.setZ(z);

    h.setName("H");
    h.setFullName(" H  ");
    return h;
  }
コード例 #4
0
ファイル: SecStruc.java プロジェクト: panyao/jsMapReduce
  /**
   * calculate HBond energy of two groups in cal/mol ... see Creighton page 147 f
   *
   * <p>Jeffrey, George A., An introduction to hydrogen bonding, Oxford University Press, 1997.
   * categorizes hbonds with donor-acceptor distances of 2.2-2.5 &aring; as "strong, mostly
   * covalent", 2.5-3.2 &aring; as "moderate, mostly electrostatic", 3.2-4.0 &aring; as "weak,
   * electrostatic". Energies are given as 40-14, 15-4, and <4 kcal/mol respectively.
   */
  public double calculateHBondEnergy(SecStrucGroup one, SecStrucGroup two)
      throws StructureException {

    // System.out.println("calcHBondEnergy" + one + "|" + two);

    Atom N = one.getN();
    Atom H = one.getH();

    Atom O = two.getO();
    Atom C = two.getC();

    double dno = Calc.getDistance(O, N);
    double dhc = Calc.getDistance(C, H);
    double dho = Calc.getDistance(O, H);
    double dnc = Calc.getDistance(C, N);

    if (debug) {

      System.out.println(
          "     cccc: "
              + one.getPDBCode()
              + " "
              + one.getPDBName()
              + " "
              + two.getPDBCode()
              + " "
              + two.getPDBName()
              + String.format(
                  " O ("
                      + O.getPDBserial()
                      + ")..N ("
                      + N.getPDBserial()
                      + "):%4.1f  |  ho:%4.1f - hc:%4.1f + nc:%4.1f - no:%4.1f ",
                  dno,
                  dho,
                  dhc,
                  dnc,
                  dno));
    }
    // System.out.println( cn > ch && oh < 3.0f);

    double contact = MINDIST;

    //		 there seems to be a contact!
    if ((dno < contact) || (dhc < contact) || (dnc < contact) || (dno < contact)) {
      // System.out.println("!!! contact " + one + " " + two);
      return HBONDLOWENERGY;
    }

    double e1 = Q / dho - Q / dhc;
    double e2 = Q / dnc - Q / dno;

    double energy = e1 + e2;

    if (debug)
      System.out.println(
          String.format(
              "      N (%d) O(%d): %4.1f : %4.2f ",
              N.getPDBserial(), O.getPDBserial(), (float) dno, energy));

    // bond too weak
    if (energy > HBONDHIGHENERGY) return 0;

    // test to avoid bond too strong
    if (energy > HBONDLOWENERGY) return energy;

    return HBONDLOWENERGY;
  }