{
Graphics g = treeView.getGraphics();
int panelHeight = treeView.getHeight();
- int viewWidth = treeView.getWidth();
g.drawLine(x, 0, x, panelHeight);
// double relativeTreeWidth = treeDepth / viewWidth;
- //
- // System.out.println(relativeTreeWidth);
float rootX = tree.getRoot().getXcoord();
double threshold = ((double) x - rootX) / longestBranch;
List<PhylogenyNode> foundNodes = getNodesAboveThreshold(threshold,
longestBranch, tree.getRoot());
- for (PhylogenyNode foundNode : foundNodes)
- {
- Color randomColor = new Color((int) (Math.random() * 255),
- (int) (Math.random() * 255), (int) (Math.random() * 255));
- TreePanelUtil.colorizeSubtree(foundNode,
- new BranchColor(randomColor));
- }
- // groupNodes(threshold, tree.getRoot(), longestBranch);
+
List<PhylogenyNode> nodesAboveThreshold = new ArrayList<>();
- iterateNodesAboveThreshold(nodesAboveThreshold, threshold, treeLength,
+ // could also use PhylogenyMethods.getAllDescendants
+ colourNodesAboveThreshold(nodesAboveThreshold, threshold, treeLength,
node);
return nodesAboveThreshold;
}
- private List<PhylogenyNode> iterateNodesAboveThreshold(
+ private List<PhylogenyNode> colourNodesAboveThreshold(
List<PhylogenyNode> nodeList, double threshold,
double treeLength, PhylogenyNode node)
{
if (nodeCutoff > threshold)
{
nodeList.add(childNode);
+
+ Color randomColor = new Color((int) (Math.random() * 255),
+ (int) (Math.random() * 255), (int) (Math.random() * 255));
+ TreePanelUtil.colorizeSubtree(childNode,
+ new BranchColor(randomColor));
+ List<PhylogenyNode> descendantNodes = childNode
+ .getAllExternalDescendants();
+ List<SequenceI> descendantSeqs = new ArrayList<>();
+ for (PhylogenyNode descNode : descendantNodes)
+ {
+ descendantSeqs.add(nodesBoundToSequences.get(descNode));
+ }
+
+ SequenceGroup sg = new SequenceGroup(descendantSeqs, null, null,
+ true, true, false, 0,
+ parentAvport.getAlignment().getWidth() - 1);
+ sg.setIdColour(randomColor);
+
}
else
{
- iterateNodesAboveThreshold(nodeList, threshold, treeLength,
+ colourNodesAboveThreshold(nodeList, threshold, treeLength,
childNode);
}
+
// public List<PhylogenyNode> groupNodes(float threshold, PhylogenyNode root,
// double treeHeight)
// {