/* * Salichos Stamatakis and Rokas, MBE v31 p1261 (2014) * If only two splits are listed, returns IC, the Internode Certainty. * If more splits are listed, returns ICA, (IC All). */ private double internodeCertainty(DoubleList<Split, Integer> splits) { int sum = 0; int n = splits.size(); // number of splits under consideration for (int i = 0; i < n; i++) sum += splits.getB(i); double ic = 1; if (n > 1) { ic = Math.log(n); for (int i = 0; i < n; i++) { double p = ((double) splits.getB(i)) / sum; ic += p * Math.log(p); } ic /= Math.log(n); // convert from natural log to log base n } return ic; }
/** * Returns the sum of Internode Certainties over a greedy consensus tree. * * @return */ public double treeCertainty() { double tc = 0; DoubleList<Split, Double> ic = getICs(); for (int i = 0; i < ic.size(); i++) { tc += ic.getB(i); } return tc; }
/** * Returns the sum of Internode Certainty All over a greedy consensus tree. * * @return */ public double treeCertaintyAll(int threshold) { double tca = 0; DoubleList<Split, Double> ic = getICAs(threshold); for (int i = 0; i < ic.size(); i++) { tca += ic.getB(i); } return tca; }
public void printInternodeCertainties(PrintWriter out) { DoubleList<Split, Double> ic = getICs(); for (int i = 0; i < ic.size(); i++) { out.printf("IC = %f for split %s\n", ic.getB(i), ic.getA(i).toString()); } }