X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FNJTree.java;h=40dfc9b105c39ee234b6e1a54cd5edb796bc782f;hb=6fc9aca27f606f6e3a0121597896e1a5dae35c36;hp=71d67379aa5203d6928b5103441e87672c5e704f;hpb=efc31b4a8d5cee63555586804a2b79c06bdb5a14;p=jalview.git diff --git a/src/jalview/analysis/NJTree.java b/src/jalview/analysis/NJTree.java index 71d6737..40dfc9b 100755 --- a/src/jalview/analysis/NJTree.java +++ b/src/jalview/analysis/NJTree.java @@ -60,6 +60,10 @@ public class NJTree Object leaves = null; int start; int end; + boolean hasDistances = true; // normal case for jalview trees + boolean hasBootstrap = false; // normal case for jalview trees + + private boolean hasRootDistance = true; /** * Creates a new NJTree object. @@ -81,6 +85,11 @@ public class NJTree public NJTree(SequenceI[] seqs, NewickFile treefile) { top = treefile.getTree(); + + hasDistances = treefile.HasDistances(); + hasBootstrap = treefile.HasBootstrap(); + hasRootDistance = treefile.HasRootDistance(); + maxheight = findHeight(top); SequenceIdMatcher algnIds = new SequenceIdMatcher(seqs); @@ -253,11 +262,11 @@ public class NJTree { if (type.equals("NJ")) { - float mind = findMinNJDistance(); + findMinNJDistance(); } else { - float mind = findMinDistance(); + findMinDistance(); } Cluster c = joinClusters(mini, minj); @@ -291,7 +300,7 @@ public class NJTree } } - Cluster c = joinClusters(one, two); + joinClusters(one, two); top = (SequenceNode) (node.elementAt(one)); reCount(top); @@ -375,11 +384,6 @@ public class NJTree public void findNewNJDistances(SequenceNode tmpi, SequenceNode tmpj, float dist) { - float ih = 0; - float jh = 0; - - SequenceNode sni = tmpi; - SequenceNode snj = tmpj; tmpi.dist = ((dist + ri) - rj) / 2; tmpj.dist = (dist - tmpi.dist); @@ -469,8 +473,6 @@ public class NJTree */ public void findClusterNJDistance(int i, int j) { - int noi = ((Cluster) cluster.elementAt(i)).value.length; - int noj = ((Cluster) cluster.elementAt(j)).value.length; // New distances from cluster to others float[] newdist = new float[noseqs]; @@ -665,7 +667,7 @@ public class NJTree AlignSeq as = new AlignSeq(sequence[i], sequence[j], "pep"); as.calcScoreMatrix(); as.traceAlignment(); - as.printAlignment(); + as.printAlignment(System.out); distance[i][j] = (float) as.maxscore; if (max < distance[i][j]) @@ -1121,15 +1123,6 @@ public class NJTree } } - /** - * DOCUMENT ME! - * - * @param node DOCUMENT ME! - */ - public void setMaxDist(SequenceNode node) - { - this.maxdist = maxdist; - } /** * DOCUMENT ME! @@ -1150,6 +1143,27 @@ public class NJTree { return top; } + /** + * + * @return true if tree has real distances + */ + public boolean isHasDistances() { + return hasDistances; + } + + /** + * + * @return true if tree has real bootstrap values + */ + public boolean isHasBootstrap() { + return hasBootstrap; + } + + public boolean isHasRootDistance() + { + return hasRootDistance; + } + } @@ -1173,3 +1187,4 @@ class Cluster this.value = value; } } +