Esempio n. 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;
  }