root = new SequenceNode();
SequenceNode realroot = null;
SequenceNode c = root;
+
int d = -1;
int cp = 0;
int flen = nf.length();
+
String Error = null;
String nodename = null;
- float distance=-99999;
- int bootstrap=-99999;
+
+ float DefDistance = (float) 0.00001; // @param Default distance for a node - very very small
+ int DefBootstrap = 0; // @param Default bootstrap for a node
+
+ float distance=DefDistance;
+ int bootstrap=DefBootstrap;
+
boolean ascending = false; // flag indicating that we are leaving the current node
+
com.stevesoft.pat.Regex majorsyms = new com.stevesoft.pat.Regex("[(\\['),;]");
+
while (majorsyms.searchFrom(nf, cp) && Error==null) {
int fcp = majorsyms.matchedFrom();
switch (nf.charAt(fcp)) {
d++;
if (c.right() == null)
{
- c.setRight(new SequenceNode(null, c, 0, null));
+ c.setRight(new SequenceNode(null, c, null, DefDistance, DefBootstrap, false));
c = (SequenceNode) c.right();
}
else
tmpn.SetChildren(c.left(), c.right());
c.setRight(tmpn);
}
- c.setLeft(new SequenceNode(null, c, 0, null));
+ c.setLeft(new SequenceNode(null, c, null, DefDistance, DefBootstrap, false));
c = (SequenceNode) c.left();
}
if (realroot==null) {
realroot = c;
}
nodename = null;
- distance = -99999;
- bootstrap = -99999;
+ distance = DefDistance;
+ bootstrap = DefBootstrap;
cp = fcp + 1;
break;
else
{
// Find a place to put the leaf
- SequenceNode newnode = new SequenceNode(null, c,
- (HasDistances) ? distance : 0,
- nodename);
-
- newnode.setBootstrap(HasBootstrap ? bootstrap : 0);
+ SequenceNode newnode =
+ new SequenceNode(null, c,
+ nodename,
+ (HasDistances) ? distance : DefDistance,
+ (HasBootstrap) ? bootstrap : DefBootstrap,
+ false);
if (c.right() == null)
{
}
// Reset new node properties to obvious fakes
nodename = null;
- distance = -99999;
- bootstrap = -99999;
+ distance = DefDistance;
+ bootstrap = DefBootstrap;
cp=fcp+1;
}
if (!RootHasDistance) {
root.dist = 0;
}
+
}
public NewickFile(SequenceNode newtree) {