Пример #1
0
  /**
   * Returns true if ligand specified by either 3-letter ligand id (i.e. HEM) or chain/residue
   * number (i.e. A156) matches the passed in residue.
   *
   * @param residue
   * @param initialLigand Specification of ligand to be highlighted in Ligand Explorer upon startup
   * @return
   */
  private boolean isInitialLigandResidue(Residue residue, String initialLigand) {
    if (residue.getCompoundCode().equalsIgnoreCase(initialLigand)) {
      return true;
    }

    String chainId = initialLigand.substring(0, 1);
    int residueNumber;

    try {
      residueNumber = Integer.parseInt(initialLigand.substring(1));
    } catch (NumberFormatException e) {
      return false;
    }
    if (residue.getAuthorChainId().equalsIgnoreCase(chainId)
        && residue.getAuthorResidueId() == residueNumber) {
      return true;
    }
    return false;
  }
Пример #2
0
 /**
  * Returns true if the initialLigand matches a PRD ID (i.e., PRD_000223)
  *
  * @param residue
  * @param initialLigand Specification of PRD molecule to be highlighted in Ligand Explorer upon
  *     startup
  * @return
  */
 private boolean isInitialBirdChain(Chain chain, String initialLigand) {
   if (chain.getClassification() == Classification.BIRD) {
     Residue r = chain.getResidue(0);
     if (r != null) {
       Bird bird = r.getBird();
       if (bird == null) {
         return false;
       }
       if (initialLigand.toUpperCase().startsWith("PRD_")) {
         return bird.getPrdId().equalsIgnoreCase(initialLigand);
       } else {
         String chainId = initialLigand.substring(0, 1);
         String prdId = initialLigand.substring(2, initialLigand.length());
         return chain.getAuthorChainId().equalsIgnoreCase(chainId)
             && bird.getPrdId().equalsIgnoreCase(prdId);
       }
     }
   }
   return false;
 }