X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FNJTree.java;h=40dfc9b105c39ee234b6e1a54cd5edb796bc782f;hb=6fc9aca27f606f6e3a0121597896e1a5dae35c36;hp=97b8519e561ce14412ee5a02cd1e645d8e1f271a;hpb=f24dacb1da56fccf05d684e2f4899facec2aecf7;p=jalview.git diff --git a/src/jalview/analysis/NJTree.java b/src/jalview/analysis/NJTree.java index 97b8519..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); @@ -251,14 +260,14 @@ public class NJTree { while (noClus > 2) { - /* if (type.equals("NJ")) + if (type.equals("NJ")) { - float mind = findMinNJDistance(); + findMinNJDistance(); } else { - float mind = findMinDistance(); - }*/ + findMinDistance(); + } Cluster c = joinClusters(mini, minj); @@ -273,7 +282,7 @@ public class NJTree boolean onefound = false; int one = -1; - //int two = -1; + int two = -1; for (int i = 0; i < noseqs; i++) { @@ -281,7 +290,7 @@ public class NJTree { if (onefound == false) { - //two = i; + two = i; onefound = true; } else @@ -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]) @@ -1141,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; + } + } @@ -1164,3 +1187,4 @@ class Cluster this.value = value; } } +