int rc = readNewickInt(f, n, T);
if (rc == -1) { return -1; } //reports an error in reading
+
if(f.peek()==')'){
readSpecialChar(f,')',"right parenthesis");
//to pass over labels in trees
}
//to account for multifurcating trees generated by fasttree, we are forcing them to be bifurcating
- /* if(f.peek() == ','){
+ while(f.peek() == ','){
//force this node to be left child and read new rc
T->tree[n].setChildren(lc,rc);
T->tree[lc].setParent(n);
T->tree[rc].setParent(n);
+ T->printTree(); cout << endl;
+ lc = n;
n++;
+ readSpecialChar(f,',',"comma");
-
- }*/
-
+ int rc = readNewickInt(f, n, T);
+ cout << n << '\t' << lc << '\t' << rc << endl;
+ if (rc == -1) { return -1; } //reports an error in reading
+
+ if(f.peek()==')'){
+ string k;
+ k = f.peek();
+ cout << "in here " << k << endl;
+ readSpecialChar(f,')',"right parenthesis");
+ //to pass over labels in trees
+ c=filehandle.get();
+ while((c!=',') && (c != -1) && (c!= ':') && (c!=';')){ c=filehandle.get(); }
+ filehandle.putback(c);
+
+ if(f.peek() == ':'){
+ readSpecialChar(f,':',"colon");
+
+ if(n >= numNodes){ m->mothurOut("Error: Too many nodes in input tree\n"); readOk = -1; return -1; }
+
+ T->tree[n].setBranchLength(readBranchLength(f));
+ }else{
+ T->tree[n].setBranchLength(0.0);
+ }
+
+ break;
+ }
+ }
+ cout << n << '\t' << lc << '\t' << rc << endl;
T->tree[n].setChildren(lc,rc);
T->tree[lc].setParent(n);
T->tree[rc].setParent(n);
-
+ T->printTree(); cout << endl;
+
return n++;
}else{
f.putback(c);
name += d;
d=f.get();
}
-
+ cout << name << endl;
int blen = 0;
if(d == ':') { blen = 1; }