示例#1
0
  /**
   * Separates interaction maps and associates them with a chain name then calls
   * DBManager.writeComplexContactToDB()
   *
   * @param pdbid PDB Identifier
   * @return true if DBManager is succesfull
   */
  public boolean writeChainComplexContactInfoToDB(String pdbid) {

    String chainA;
    String chainB;

    Integer numHelixHelixInteractions;
    Integer numHelixStrandInteractions;
    Integer numHelixLoopInteractions;
    Integer numStrandStrandInteractions;
    Integer numStrandLoopInteractions;
    Integer numLoopLoopInteractions;
    Integer numAllInteractions;
    Integer numDisulfides;

    for (Map.Entry pair : this.chainNamesInEdge.entrySet()) {

      Edge curEdge = (Edge) pair.getKey();
      String[] chainPair = (String[]) pair.getValue();

      chainA = chainPair[0];
      chainB = chainPair[1];

      // interactions with ligands are NOT yet written to the database!
      numHelixHelixInteractions = this.numHelixHelixInteractionsMap.get(curEdge);
      numHelixStrandInteractions = this.numHelixStrandInteractionsMap.get(curEdge);
      numHelixLoopInteractions = this.numHelixCoilInteractionsMap.get(curEdge);
      numStrandStrandInteractions = this.numStrandStrandInteractionsMap.get(curEdge);
      numStrandLoopInteractions = this.numStrandCoilInteractionsMap.get(curEdge);
      numLoopLoopInteractions = this.numCoilCoilInteractionsMap.get(curEdge);
      numDisulfides = this.numDisulfidesMap.get(curEdge);
      numAllInteractions = this.numAllInteractionsMap.get(curEdge);

      Integer[] interactionNums = {
        numHelixHelixInteractions,
        numHelixStrandInteractions,
        numHelixLoopInteractions,
        numStrandStrandInteractions,
        numStrandLoopInteractions,
        numLoopLoopInteractions,
        numDisulfides,
        numAllInteractions
      };

      // make sure no entry is null or something shitty
      for (int i = 0; i < interactionNums.length; i++) {
        if (interactionNums[i] == null) {
          interactionNums[i] = 0;
        }
      }

      try {
        DBManager.writeChainComplexContactToDB(pdbid, chainA, chainB, interactionNums);
        // it.remove(); // avoids a ConcurrentModificationException
      } catch (SQLException ex) {
        Logger.getLogger(ComplexGraph.class.getName()).log(Level.SEVERE, null, ex);
        return false;
      }
    }
    return true;
  }
示例#2
0
  public void writeSSEComplexContactInfoToDB(String pdbid) {

    // DBManager.writeSSEComplexContactToDB()
    String chainA;
    String chainB;

    Integer numHelixHelixInteractions;
    Integer numHelixStrandInteractions;
    Integer numHelixLoopInteractions;
    Integer numSSInteractions;
    Integer numStrandLoopInteractions;
    Integer numLoopLoopInteractions;
    Integer numAllInteractions;
    Integer numDisulfides;

    int countInsert = 0;
    int countFail = 0;
    Boolean retVal = false;
    for (Map.Entry<List<Integer>, Integer> pair : this.numSSEContacts.entrySet()) {

      List<Integer> curSSEs = (List<Integer>) pair.getKey();
      chainA = this.numSSEContactChainNames.get(curSSEs).get(0);
      chainB = this.numSSEContactChainNames.get(curSSEs).get(1);

      Integer sse1_dssp_start = (Integer) curSSEs.get(0);
      Integer sse2_dssp_start = (Integer) curSSEs.get(1);
      Integer contactCount = (Integer) pair.getValue();

      Boolean res = false;

      // this action could result in an error due to the definition of a PTGL SSE
      // e.g. the SSE is too short and is merged to another SSE or not defined in the DB
      try {
        res =
            DBManager.writeSSEComplexContactToDB(
                pdbid, chainA, chainB, sse1_dssp_start, sse2_dssp_start, contactCount);
        // it.remove(); // avoids a ConcurrentModificationException
        if (res) {
          countInsert++;
          retVal = true;
        } else {
          countFail++;
          retVal = false;
        }
      } catch (SQLException ex) {
        DP.getInstance()
            .e(
                "ComplexGraph",
                "writeSSEComplexContactInfoToDB: SQL exception: '" + ex.getMessage() + "'.");
        Logger.getLogger(ComplexGraph.class.getName()).log(Level.SEVERE, null, ex);
      }
    }
    if (!Settings.getBoolean("plcc_B_silent")) {
      System.out.println(
          "    SSE Contacts written to DB: "
              + countInsert
              + " inserted, "
              + countFail
              + " skipped (contact involved coils).");
    }
  }