Example #1
0
  /*
   *
   * (non-Javadoc)
   * @see java.lang.Object#toString()
   */
  public String toString() {
    StringBuffer buf = new StringBuffer();
    String nl = System.getProperty("line.separator");
    buf.append(
        "  #  RESIDUE AA STRUCTURE BP1 BP2  ACC     N-H-->O    O-->H-N    N-H-->O    O-->H-N    TCO  KAPPA ALPHA  PHI   PSI    X-CA   Y-CA   Z-CA ");
    buf.append(nl);

    for (int i = 0; i < groups.length; i++) {
      Group g = groups[i];
      SecStrucState state = (SecStrucState) g.getProperty("secstruc");
      //	System.out.println("XX"+i+" "+g.getPDBCode() + " " + g.getPDBName() +
      // iter.getCurrentChain().getName() + " " + state);
      buf.append((i + 1) + "\t");
      buf.append(g.getPDBName() + " ");
      buf.append(g.getPDBCode() + "\t");

      boolean[] turns = state.getTurn();
      for (int t = 0; t < 3; t++) {
        if (turns[t]) {
          buf.append('>');
        } else {
          buf.append(' ');
        }
      }

      // tmp filler
      buf.append("                    ");

      int p1 = state.getAccept1().getPartner();
      if (p1 != 0) p1 -= i;
      double e1 = (state.getAccept1().getEnergy() / 1000.0);
      buf.append(String.format("%6d,%4.1f\t", p1, e1));

      int p2 = state.getDonor1().getPartner();
      if (p2 != 0) p2 -= i;
      double e2 = (state.getDonor1().getEnergy() / 1000.0);
      buf.append(String.format("%6d,%4.1f\t", p2, e2));

      int p3 = state.getAccept1().getPartner();
      if (p3 != 0) p3 -= i;
      double e3 = (state.getAccept2().getEnergy() / 1000.0);
      buf.append(String.format("%6d,%4.1f\t", p3, e3));

      int p4 = state.getDonor2().getPartner();
      if (p4 != 0) p4 -= i;
      double e4 = (state.getDonor2().getEnergy() / 1000.0);
      buf.append(String.format("%6d,%4.1f\t", p4, e4));

      buf.append(nl);
    }

    return buf.toString();
  }
Example #2
0
  /** detect helical turn patterns */
  private void calculateTurns() {

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

      for (int turn = 3; turn <= 5; turn++) {
        if (i + turn >= l) continue;

        if (isBonded(i + turn, i)) {
          // System.out.println("is bondend " + (i+turn) + i );
          for (int j = i; j < i + turn + 1; j++) {
            // System.out.println("turn at i:" + i + " j:" + j + " turn" + turn);
            SecStrucGroup group = groups[j];
            SecStrucState state = (SecStrucState) group.getProperty("secstruc");
            boolean[] turns = state.getTurn();
            turns[turn - 3] = true;
          }
        }
      }
    }
  }
Example #3
0
  /**
   * test if two groups are forming an H-Bond DSSP defines H-Bonds if the energy < -500 cal /mol
   *
   * @param one group one
   * @param two group two
   * @return flag if the two are forming an Hbond
   */
  private boolean isBonded(int i, int j) {

    Group one = groups[i];
    // Group two = groups[j];

    SecStrucState stateOne = (SecStrucState) one.getProperty("secstruc");
    // SecStrucState stateTwo = (SecStrucState)two.getProperty("secstruc");

    System.out.println("*** bonded? " + i + " " + j + " " + stateOne);
    double acc1e = stateOne.getAccept1().getEnergy();
    double acc2e = stateOne.getAccept2().getEnergy();

    int partnerAcc1 = stateOne.getAccept1().getPartner();
    int partnerAcc2 = stateOne.getAccept2().getPartner();

    if (((partnerAcc1 == j) && (acc1e < HBONDHIGHENERGY))
        || ((partnerAcc2 == j) && (acc2e < HBONDHIGHENERGY))) {
      System.out.println("*** yes is bonded " + i + " " + j);
      return true;
    }
    return false;
  }
Example #4
0
  /**
   * store Hbonds inamino acids DSSP allows two HBonds / aminoacids to allow bifurcated bonds ...
   */
  private void trackHBondEnergy(int i, int j, double energy) {

    Group one = groups[i];
    Group two = groups[j];

    SecStrucState stateOne = (SecStrucState) one.getProperty("secstruc");
    SecStrucState stateTwo = (SecStrucState) two.getProperty("secstruc");

    double acc1e = stateOne.getAccept1().getEnergy();
    double acc2e = stateOne.getAccept2().getEnergy();

    double don1e = stateTwo.getDonor1().getEnergy();
    double don2e = stateTwo.getDonor2().getEnergy();

    // if ( energy < 0)
    //   System.out.println("--- tracking Hbond " + i + " " + j + " " + energy + " (accept: " +
    // acc1e + " " + acc2e +") (donor: "+don1e + " " + don2e+")");

    if (energy < acc1e) {
      // System.out.println(energy +"<"+acc1e) ;
      stateOne.setAccept2(stateOne.getAccept1());

      HBond bond = new HBond();
      bond.setEnergy(energy);
      bond.setPartner(j);

      stateOne.setAccept1(bond);

    } else if (energy < acc2e) {
      // System.out.println(energy +"<"+acc2e) ;
      HBond bond = new HBond();
      bond.setEnergy(energy);
      bond.setPartner(j);

      stateOne.setAccept2(bond);
    }

    // and now the other side of the bond ..

    if (energy < don1e) {
      stateTwo.setDonor2(stateTwo.getDonor1());

      HBond bond = new HBond();
      bond.setEnergy(energy);
      bond.setPartner(i);

      stateTwo.setDonor1(bond);

    } else if (energy < don2e) {

      // System.out.println(energy +"<"+don2e) ;

      HBond bond = new HBond();
      bond.setEnergy(energy);
      bond.setPartner(i);

      stateTwo.setDonor2(bond);
    }

    // System.out.println(stateOne);
    // one.setProperty("secstruc", stateOne);
    // two.setProperty("secstruc", stateTwo);
    /*groups[i] = one;
    groups[j] = two;
     */
  }