public List<DoubleList<Split, Integer>> findConflictingSplitCounts( int threshold, boolean thresholdIsLength) { findGreedySplits(); List<DoubleList<Split, Integer>> results = new Vector<DoubleList<Split, Integer>>(greedySplits.size()); // could be more efficient by storing where the greedy splits appear in the sorted list. for (int i : greedySplitIndex) { String splitStr = sortedSplits.elementAt(i); Split split = splits.get(splitStr); if (!thresholdIsLength && counts.get(splitStr) < threshold) break; // ignore splits with frequency below threshold DoubleList<Split, Integer> splitList = new DoubleList<Split, Integer>(); splitList.add(split, counts.get(splitStr)); // Only check splits after this one in sorted list: ones before this one are guaranteed to be // compatible, else this split would not be in the greedy list. for (int j = i + 1; j < sortedSplits.size(); j++) { String otherSplitString = sortedSplits.elementAt(j); if (!thresholdIsLength && counts.get(otherSplitString) < threshold) break; // ignore conflicting splits with frequency below threshold Split otherSplit = splits.get(otherSplitString); if (!split.compatible(otherSplit)) { splitList.add(otherSplit, counts.get(otherSplitString)); } // if !compatible if (thresholdIsLength && splitList.size() == threshold) break; // have enough secondary splits now } // for otherSplit (j) results.add(splitList); } // for i over sortedSplits return results; }
/* * Return a twin list of the greedy consensus tree splits and their internode certainties */ public DoubleList<Split, Double> getICs() { DoubleList<Split, Double> ic = new DoubleList<Split, Double>(); List<DoubleList<Split, Integer>> greedyTreeConflicts = findConflictingSplitCounts(2, true); for (DoubleList<Split, Integer> splitList : greedyTreeConflicts) { ic.add(splitList.getA(0), internodeCertainty(splitList)); } return ic; }
/* * Return a twin list of the greedy consensus tree splits and their ICA (internode certainty all) * scores, with a threshold for which incompatible splits are included in the ICA calculation */ public DoubleList<Split, Double> getICAs(int threshold) { DoubleList<Split, Double> ica = new DoubleList<Split, Double>(); List<DoubleList<Split, Integer>> greedyTreeConflicts = findConflictingSplitCounts(threshold, false); for (DoubleList<Split, Integer> splitList : greedyTreeConflicts) { ica.add(splitList.getA(0), internodeCertainty(splitList)); } return ica; }