X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FTreeBuilder.java;h=0cd340e88b57dde048bb634f1e244fbce244e131;hb=24003ce252e653972ece110e077acd16ed47fe15;hp=b290428de2fb630c8322f9fc75925cf5f5d7a03a;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git
diff --git a/src/jalview/analysis/TreeBuilder.java b/src/jalview/analysis/TreeBuilder.java
index b290428..0cd340e 100644
--- a/src/jalview/analysis/TreeBuilder.java
+++ b/src/jalview/analysis/TreeBuilder.java
@@ -1,3 +1,23 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.analysis;
import jalview.api.analysis.ScoreModelI;
@@ -47,13 +67,17 @@ public abstract class TreeBuilder
double maxDistValue;
- double maxheight;
+ double maxHeight;
int ycount;
Vector node;
- private AlignmentView seqStrings;
+ protected ScoreModelI scoreModel;
+
+ protected SimilarityParamsI scoreParams;
+
+ private AlignmentView seqStrings; // redundant? (see seqData)
/**
* Constructor
@@ -105,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
@@ -129,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;
}
/**
@@ -275,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();
@@ -344,7 +372,7 @@ public abstract class TreeBuilder
protected void init(AlignmentView seqView, int start, int end)
{
- this.node = new Vector();
+ this.node = new Vector<>();
if (seqView != null)
{
this.seqData = seqView;
@@ -438,7 +466,7 @@ public abstract class TreeBuilder
*/
void makeLeaves()
{
- clusters = new Vector();
+ clusters = new Vector<>();
for (int i = 0; i < noseqs; i++)
{
@@ -447,6 +475,7 @@ public abstract class TreeBuilder
sn.setElement(sequences[i]);
sn.setName(sequences[i].getName());
node.addElement(sn);
+
BitSet bs = new BitSet();
bs.set(i);
clusters.addElement(bs);
@@ -458,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;
+ }
+
}