Esempio n. 1
0
  @Override
  public boolean hasNextChar() {

    if (nvalid) return true;

    while (true) {
      if (protein == null) {
        if (!getProtein()) break;
      }

      // BioJava indexes from 1
      if (position > protein.getLength()) {
        protein = null;
        continue;
      }

      AminoAcidCompound aa = protein.getCompoundAt(position++);

      String base = aa.getUpperedBase();
      int chind = alphabet.indexOf(base);
      if (chind < 0) {
        System.out.println("Bad aa " + base);
        continue;
      }

      nextch = base.charAt(0);
      nvalid = true;
      return true;
    }

    return false;
  }