Esempio n. 1
0
  /** Find node names that are within the thresholds */
  public List<String> findNodeNames(
      double thresholdEntropy, double thresholdP, int thresholdCount) {
    ArrayList<String> names = new ArrayList<String>();
    if (getTotalCount() == 0) return names;

    double p[] = p();
    for (int idx = 0; idx < 4; idx++) {
      AcgtTree n = nodes[idx];
      if (n != null) {
        if (((parent == null)
                || (parent.entropy() <= thresholdEntropy)) // Parent's entropy is low enough?
            && (p[idx] >= thresholdP) // Probability is high enough?
            && (counts[idx] >= thresholdCount) // Do we have enough counts?
        ) {
          names.add(n.name);
        }

        names.addAll(n.findNodeNames(thresholdEntropy, thresholdP, thresholdCount));
      }
    }

    return names;
  }