コード例 #1
0
ファイル: SecStruc.java プロジェクト: panyao/jsMapReduce
  private void checkAddHBond(int i, int j) {
    SecStrucGroup one = groups[i];
    SecStrucGroup two = groups[j];
    if (!two.hasAtom("H")) {
      System.err.println("two has no H " + j);
      return;
    }

    if (one.getPDBName().equals("PRO")) {
      if (debug) System.out.println("     ignore: PRO " + one.getPDBCode());

      return;
    }

    double energy = 0;
    try {
      energy = calculateHBondEnergy(one, two);
    } catch (Exception e) {
      e.printStackTrace();
      return;
    }
    // System.out.println(" " + energy);

    trackHBondEnergy(i, j, energy);
  }
コード例 #2
0
ファイル: SecStruc.java プロジェクト: panyao/jsMapReduce
  /**
   * calculate the coordinates for the H atoms. They are usually missing in the PDB files as only
   * few experimental methods allow to resolve their location
   */
  private void calculateHAtoms() throws StructureException {

    for (int i = 0; i < groups.length - 1; i++) {

      SecStrucGroup a = groups[i];
      SecStrucGroup b = groups[i + 1];

      if (!b.hasAtom("H")) {

        // System.out.println(cur);
        // calculate the coordinate for the H atom
        // Atom H = calc_H(a.getC(), b.getN(), b.getCA());

        // alternative:
        Atom H = calcSimple_H(a.getC(), a.getO(), b.getN());

        b.setH(H);

        /*System.out.println("added H for " + i + " " + H);
        for ( int aa = 0 ; aa < b.size() ; aa++){
           Atom at = b.getAtom(aa);
           System.out.println(aa + " " + at.getFullName() + " "+ Calc.getDistance(at,H));
        }*/

      }
    }
  }
コード例 #3
0
ファイル: SecStruc.java プロジェクト: panyao/jsMapReduce
  /** calculate the HBonds between different groups ... see Creighton page 147 f */
  private void calculateHBonds() throws StructureException {
    System.out.println("groups length: " + groups.length);

    // skip the first residue , unable to calc H for it ...
    for (int i = 1; i < groups.length; i++) {

      SecStrucGroup one = groups[i];

      if (!one.hasAtom("H")) {
        System.out.println(" no H at " + i);
        continue;
      }

      for (int j = i + 1; j < groups.length; j++) {

        SecStrucGroup two = groups[j];

        // check if distance is  too large.
        // if too big - for sure no HBonds ...
        double dist = Calc.getDistance(one.getCA(), two.getCA());

        // speed up...
        if (dist >= CA_MIN_DIST) continue;
        // System.out.println("calc " + i + " " + j + " "+  dist);

        checkAddHBond(i, j);

        // "backwards" hbonds are not allowed
        if (j != (i + 1)) {

          checkAddHBond(j, i);
        }
        // System.out.println(" ");
      }
    }
  }