JAL-2795 added error catching for invalid identifier
[jalview.git] / src / jalview / analysis / TreeBuilder.java
index b794368..0cd340e 100644 (file)
@@ -67,13 +67,17 @@ public abstract class TreeBuilder
 
   double maxDistValue;
 
-  double maxheight;
+  double maxHeight;
 
   int ycount;
 
   Vector<SequenceNode> node;
 
-  private AlignmentView seqStrings;
+  protected ScoreModelI scoreModel;
+
+  protected SimilarityParamsI scoreParams;
+
+  private AlignmentView seqStrings; // redundant? (see seqData)
 
   /**
    * Constructor
@@ -125,20 +129,20 @@ public abstract class TreeBuilder
   {
     if (nd == null)
     {
-      return maxheight;
+      return maxHeight;
     }
 
     if ((nd.left() == null) && (nd.right() == null))
     {
       nd.height = ((SequenceNode) nd.parent()).height + nd.dist;
 
-      if (nd.height > maxheight)
+      if (nd.height > maxHeight)
       {
         return nd.height;
       }
       else
       {
-        return maxheight;
+        return maxHeight;
       }
     }
     else
@@ -149,15 +153,15 @@ public abstract class TreeBuilder
       }
       else
       {
-        maxheight = 0;
+        maxHeight = 0;
         nd.height = (float) 0.0;
       }
 
-      maxheight = findHeight((SequenceNode) (nd.left()));
-      maxheight = findHeight((SequenceNode) (nd.right()));
+      maxHeight = findHeight((SequenceNode) (nd.left()));
+      maxHeight = findHeight((SequenceNode) (nd.right()));
     }
 
-    return maxheight;
+    return maxHeight;
   }
 
   /**
@@ -295,7 +299,11 @@ public abstract class TreeBuilder
    */
   protected void computeTree(ScoreModelI sm, SimilarityParamsI scoreOptions)
   {
-    distances = sm.findDistances(seqData, scoreOptions);
+
+    this.scoreModel = sm;
+    this.scoreParams = scoreOptions;
+
+    distances = scoreModel.findDistances(seqData, scoreParams);
 
     makeLeaves();
 
@@ -479,4 +487,24 @@ public abstract class TreeBuilder
     return seqStrings;
   }
 
+  public MatrixI getDistances()
+  {
+    return distances;
+  }
+
+  public AlignmentView getSeqData()
+  {
+    return seqData;
+  }
+
+  public ScoreModelI getScoreModel()
+  {
+    return scoreModel;
+  }
+
+  public SimilarityParamsI getScoreParams()
+  {
+    return scoreParams;
+  }
+
 }