static void addMultifurcation (FILE *fp, tree *tr, nodeptr _p, analdef *adef, int *nextnode) { nodeptr p, initial_p; int n, ch, fres; if ((ch = treeGetCh(fp)) == '(') { int i = 0; nextNodeOutOfBounds(tr, *nextnode); initial_p = p = tr->nodep[*nextnode]; *nextnode = *nextnode + 1; do { nextNodeOutOfBounds(tr, *nextnode); p->next = tr->nodep[*nextnode]; *nextnode = *nextnode + 1; p = p->next; addMultifurcation(fp, tr, p, adef, nextnode); i++; } while((ch = treeGetCh(fp)) == ','); ungetc(ch, fp); p->next = initial_p; if (! treeNeedCh(fp, ')', "in")) assert(0); treeFlushLabel(fp); } else { ungetc(ch, fp); if ((n = treeFindTipName(fp, tr, FALSE)) <= 0) assert(0); p = tr->nodep[n]; initial_p = p; tr->start = p; (tr->ntips)++; } fres = treeFlushLen(fp, tr); if(!fres) assert(0); hookupDefault(initial_p, _p, tr->numBranches); }
int treeReadLen (FILE *fp, tree *tr, boolean readBranches, boolean readNodeLabels, boolean topologyOnly) { nodeptr p; int i, ch, lcount = 0; for (i = 1; i <= tr->mxtips; i++) { tr->nodep[i]->back = (node *) NULL; /*if(topologyOnly) tr->nodep[i]->support = -1;*/ } for(i = tr->mxtips + 1; i < 2 * tr->mxtips; i++) { tr->nodep[i]->back = (nodeptr)NULL; tr->nodep[i]->next->back = (nodeptr)NULL; tr->nodep[i]->next->next->back = (nodeptr)NULL; tr->nodep[i]->number = i; tr->nodep[i]->next->number = i; tr->nodep[i]->next->next->number = i; /*if(topologyOnly) { tr->nodep[i]->support = -2; tr->nodep[i]->next->support = -2; tr->nodep[i]->next->next->support = -2; }*/ } if(topologyOnly) tr->start = tr->nodep[tr->mxtips]; else tr->start = tr->nodep[1]; tr->ntips = 0; tr->nextnode = tr->mxtips + 1; for(i = 0; i < tr->numBranches; i++) tr->partitionSmoothed[i] = FALSE; tr->rooted = FALSE; p = tr->nodep[(tr->nextnode)++]; while((ch = treeGetCh(fp)) != '('); if(!topologyOnly) assert(readBranches == FALSE && readNodeLabels == FALSE); if (! addElementLen(fp, tr, p, readBranches, readNodeLabels, &lcount)) assert(0); if (! treeNeedCh(fp, ',', "in")) assert(0); if (! addElementLen(fp, tr, p->next, readBranches, readNodeLabels, &lcount)) assert(0); if (! tr->rooted) { if ((ch = treeGetCh(fp)) == ',') { if (! addElementLen(fp, tr, p->next->next, readBranches, readNodeLabels, &lcount)) assert(0); } else { /* A rooted format */ tr->rooted = TRUE; if (ch != EOF) (void) ungetc(ch, fp); } } else { p->next->next->back = (nodeptr) NULL; } if (! treeNeedCh(fp, ')', "in")) assert(0); if(topologyOnly) assert(!(tr->rooted && readNodeLabels)); (void) treeFlushLabel(fp); if (! treeFlushLen(fp)) assert(0); if (! treeNeedCh(fp, ';', "at end of")) assert(0); if (tr->rooted) { assert(!readNodeLabels); p->next->next->back = (nodeptr) NULL; tr->start = uprootTree(tr, p->next->next, FALSE, FALSE); if (! tr->start) { printf("FATAL ERROR UPROOTING TREE\n"); assert(0); } } else tr->start = findAnyTip(p, tr->mxtips); assert(tr->ntips == tr->mxtips); return lcount; }
static boolean addElementLen (FILE *fp, tree *tr, nodeptr p, boolean readBranchLengths, boolean readNodeLabels, int *lcount) { nodeptr q; int n, ch, fres; if ((ch = treeGetCh(fp)) == '(') { n = (tr->nextnode)++; if (n > 2*(tr->mxtips) - 2) { if (tr->rooted || n > 2*(tr->mxtips) - 1) { printf("ERROR: Too many internal nodes. Is tree rooted?\n"); printf(" Deepest splitting should be a trifurcation.\n"); return FALSE; } else { assert(!readNodeLabels); tr->rooted = TRUE; } } q = tr->nodep[n]; if (! addElementLen(fp, tr, q->next, readBranchLengths, readNodeLabels, lcount)) return FALSE; if (! treeNeedCh(fp, ',', "in")) return FALSE; if (! addElementLen(fp, tr, q->next->next, readBranchLengths, readNodeLabels, lcount)) return FALSE; if (! treeNeedCh(fp, ')', "in")) return FALSE; if(readNodeLabels) { char label[64]; int support; if(treeGetLabel (fp, label, 10)) { int val = sscanf(label, "%d", &support); assert(val == 1); /*printf("LABEL %s Number %d\n", label, support);*/ /*p->support = q->support = support;*/ /*printf("%d %d %d %d\n", p->support, q->support, p->number, q->number);*/ assert(p->number > tr->mxtips && q->number > tr->mxtips); *lcount = *lcount + 1; } } else (void) treeFlushLabel(fp); } else { ungetc(ch, fp); if ((n = treeFindTipName(fp, tr)) <= 0) return FALSE; q = tr->nodep[n]; if (tr->start->number > n) tr->start = q; (tr->ntips)++; } if(readBranchLengths) { double branch; if (! treeNeedCh(fp, ':', "in")) return FALSE; if (! treeProcessLength(fp, &branch)) return FALSE; /*printf("Branch %8.20f %d\n", branch, tr->numBranches);*/ hookup(p, q, &branch, tr->numBranches); } else { fres = treeFlushLen(fp); if(!fres) return FALSE; hookupDefault(p, q, tr->numBranches); } return TRUE; }
static boolean addElementLen (FILE *fp, tree *tr, nodeptr p, boolean readBranchLengths, boolean readNodeLabels, int *lcount, analdef *adef, boolean storeBranchLabels) { nodeptr q; int n, ch, fres; if ((ch = treeGetCh(fp)) == '(') { n = (tr->nextnode)++; if (n > 2*(tr->mxtips) - 2) { if (tr->rooted || n > 2*(tr->mxtips) - 1) { printf("ERROR: Too many internal nodes. Is tree rooted?\n"); printf(" Deepest splitting should be a trifurcation.\n"); return FALSE; } else { if(readNodeLabels) { printf("The program will exit with an error in the next source code line\n"); printf("You are probably trying to read in rooted trees with a RAxML option \n"); printf("that for some reason expects unrooted binary trees\n\n"); } assert(!readNodeLabels); tr->rooted = TRUE; } } q = tr->nodep[n]; if (! addElementLen(fp, tr, q->next, readBranchLengths, readNodeLabels, lcount, adef, storeBranchLabels)) return FALSE; if (! treeNeedCh(fp, ',', "in")) return FALSE; if (! addElementLen(fp, tr, q->next->next, readBranchLengths, readNodeLabels, lcount, adef, storeBranchLabels)) return FALSE; if (! treeNeedCh(fp, ')', "in")) return FALSE; if(readNodeLabels) { char label[64]; int support; if(treeGetLabel (fp, label, 10)) { int val = sscanf(label, "%d", &support); assert(val == 1); /*printf("LABEL %s Number %d\n", label, support);*/ p->support = q->support = support; /*printf("%d %d %d %d\n", p->support, q->support, p->number, q->number);*/ assert(p->number > tr->mxtips && q->number > tr->mxtips); *lcount = *lcount + 1; } } else (void) treeFlushLabel(fp); } else { ungetc(ch, fp); if ((n = treeFindTipName(fp, tr, TRUE)) <= 0) return FALSE; q = tr->nodep[n]; if (tr->start->number > n) tr->start = q; (tr->ntips)++; } if(readBranchLengths) { double branch; int startCounter = tr->branchLabelCounter, endCounter, branchLabel = -1; if (! treeNeedCh(fp, ':', "in")) return FALSE; if (! treeProcessLength(fp, &branch, &branchLabel, storeBranchLabels, tr)) return FALSE; endCounter = tr->branchLabelCounter; /*printf("Branch %8.20f %d\n", branch, tr->numBranches);*/ if(adef->mode == CLASSIFY_ML) { double x[NUM_BRANCHES]; assert(tr->NumberOfModels == 1); assert(adef->useBinaryModelFile); assert(tr->numBranches == 1); x[0] = exp(-branch / tr->fracchange); hookup(p, q, x, tr->numBranches); } else hookup(p, q, &branch, tr->numBranches); if(storeBranchLabels && (endCounter > startCounter)) { assert(!isTip(p->number, tr->mxtips) && !isTip(q->number, tr->mxtips)); assert(branchLabel >= 0); p->support = q->support = branchLabel; } } else { fres = treeFlushLen(fp, tr); if(!fres) return FALSE; hookupDefault(p, q, tr->numBranches); } return TRUE; }
int readMultifurcatingTree(FILE *fp, tree *tr, analdef *adef) { nodeptr p, initial_p; int innerNodeNumber, innerBranches = 0, nextnode, i, ch, tips = tr->mxtips, inter = tr->mxtips - 1; //clean up before parsing ! for (i = 1; i < tips + 3 * inter; i++) { tr->nodep[i]->back = (node *) NULL; tr->nodep[i]->next = (node *) NULL; tr->nodep[i]->x = 0; } for(i = tips + 1; i < tips + 3 * inter; i++) tr->nodep[i]->number = i; tr->ntips = 0; nextnode = tr->mxtips + 1; while((ch = treeGetCh(fp)) != '('); i = 0; do { if(i == 0) { nextNodeOutOfBounds(tr, nextnode); initial_p = p = tr->nodep[nextnode]; nextnode++; } else { nextNodeOutOfBounds(tr, nextnode); p->next = tr->nodep[nextnode]; p = p->next; nextnode++; } addMultifurcation(fp, tr, p, adef, &nextnode); i++; } while((ch = treeGetCh(fp)) == ','); if(i < 2) assert(0); else { if(i == 2) { nodeptr q = initial_p->back, r = initial_p->next->back; //printBothOpen("you provided a rooted tree, we need an unrooted one, RAxML will remove the root!\n"); assert(initial_p->next->next == (node *)NULL); assert(tr->start != initial_p); assert(tr->start != initial_p->next); assert(tr->start->back != initial_p); assert(tr->start->back != initial_p->next); hookupDefault(q, r, tr->numBranches); } } /* if(i < 3) { printBothOpen("You need to provide unrooted input trees!\n"); assert(0); } */ ungetc(ch, fp); if(i > 2) p->next = initial_p; if (! treeNeedCh(fp, ')', "in")) assert(0); (void)treeFlushLabel(fp); if (! treeFlushLen(fp, tr)) assert(0); if (! treeNeedCh(fp, ';', "at end of")) assert(0); //printf("%d tips found, %d inner nodes used start %d maxtips %d\n", tr->ntips, nextnode - tr->mxtips, tr->start->number, tr->mxtips); assert(isTip(tr->start->number, tr->mxtips)); innerNodeNumber = tr->mxtips + 1; relabelInnerNodes(tr->start->back, tr, &innerNodeNumber, &innerBranches); //printf("Inner node number: %d\n", innerNodeNumber); //printf("Inner branches %d\n", innerBranches); if(0) { printf("("); printMultiFurc(tr->start, tr); printf(","); printMultiFurc(tr->start->back, tr); printf(");\n"); } return innerBranches; }
boolean treeReadLenMULT (FILE *fp, tree *tr, analdef *adef) { nodeptr p, r, s; int i, ch, n, rn; int partitionCounter = 0; double randomResolution; srand((unsigned int) time(NULL)); for(i = 0; i < 2 * tr->mxtips; i++) tr->constraintVector[i] = -1; for (i = 1; i <= tr->mxtips; i++) tr->nodep[i]->back = (node *) NULL; for(i = tr->mxtips + 1; i < 2 * tr->mxtips; i++) { tr->nodep[i]->back = (nodeptr)NULL; tr->nodep[i]->next->back = (nodeptr)NULL; tr->nodep[i]->next->next->back = (nodeptr)NULL; tr->nodep[i]->number = i; tr->nodep[i]->next->number = i; tr->nodep[i]->next->next->number = i; } tr->start = tr->nodep[tr->mxtips]; tr->ntips = 0; tr->nextnode = tr->mxtips + 1; for(i = 0; i < tr->numBranches; i++) tr->partitionSmoothed[i] = FALSE; tr->rooted = FALSE; p = tr->nodep[(tr->nextnode)++]; while((ch = treeGetCh(fp)) != '('); if (! addElementLenMULT(fp, tr, p, partitionCounter)) return FALSE; if (! treeNeedCh(fp, ',', "in")) return FALSE; if (! addElementLenMULT(fp, tr, p->next, partitionCounter)) return FALSE; if (! tr->rooted) { if ((ch = treeGetCh(fp)) == ',') { if (! addElementLenMULT(fp, tr, p->next->next, partitionCounter)) return FALSE; while((ch = treeGetCh(fp)) == ',') { n = (tr->nextnode)++; assert(n <= 2*(tr->mxtips) - 2); r = tr->nodep[n]; tr->constraintVector[r->number] = partitionCounter; rn = randomInt(10000); if(rn == 0) randomResolution = 0; else randomResolution = ((double)rn)/10000.0; if(randomResolution < 0.5) { s = p->next->next->back; r->back = p->next->next; p->next->next->back = r; r->next->back = s; s->back = r->next; addElementLenMULT(fp, tr, r->next->next, partitionCounter); } else { s = p->next->back; r->back = p->next; p->next->back = r; r->next->back = s; s->back = r->next; addElementLenMULT(fp, tr, r->next->next, partitionCounter); } } if(ch != ')') { printf("Missing /) in treeReadLenMULT\n"); exit(-1); } else ungetc(ch, fp); } else { tr->rooted = TRUE; if (ch != EOF) (void) ungetc(ch, fp); } } else { p->next->next->back = (nodeptr) NULL; } if (! treeNeedCh(fp, ')', "in")) return FALSE; (void) treeFlushLabel(fp); if (! treeFlushLen(fp, tr)) return FALSE; if (! treeNeedCh(fp, ';', "at end of")) return FALSE; if (tr->rooted) { p->next->next->back = (nodeptr) NULL; tr->start = uprootTree(tr, p->next->next, FALSE, TRUE); if (! tr->start) return FALSE; } else { tr->start = findAnyTip(p, tr->rdta->numsp); } if(tr->ntips < tr->mxtips) makeParsimonyTreeIncomplete(tr, adef); if(!adef->rapidBoot) onlyInitrav(tr, tr->start); return TRUE; }
static boolean addElementLenMULT (FILE *fp, tree *tr, nodeptr p, int partitionCounter) { nodeptr q, r, s; int n, ch, fres, rn; double randomResolution; int old; tr->constraintVector[p->number] = partitionCounter; if ((ch = treeGetCh(fp)) == '(') { partCount++; old = partCount; n = (tr->nextnode)++; if (n > 2*(tr->mxtips) - 2) { if (tr->rooted || n > 2*(tr->mxtips) - 1) { printf("ERROR: Too many internal nodes. Is tree rooted?\n"); printf(" Deepest splitting should be a trifurcation.\n"); return FALSE; } else { tr->rooted = TRUE; } } q = tr->nodep[n]; tr->constraintVector[q->number] = partCount; if (! addElementLenMULT(fp, tr, q->next, old)) return FALSE; if (! treeNeedCh(fp, ',', "in")) return FALSE; if (! addElementLenMULT(fp, tr, q->next->next, old)) return FALSE; hookupDefault(p, q, tr->numBranches); while((ch = treeGetCh(fp)) == ',') { n = (tr->nextnode)++; if (n > 2*(tr->mxtips) - 2) { if (tr->rooted || n > 2*(tr->mxtips) - 1) { printf("ERROR: Too many internal nodes. Is tree rooted?\n"); printf(" Deepest splitting should be a trifurcation.\n"); return FALSE; } else { tr->rooted = TRUE; } } r = tr->nodep[n]; tr->constraintVector[r->number] = partCount; rn = randomInt(10000); if(rn == 0) randomResolution = 0; else randomResolution = ((double)rn)/10000.0; if(randomResolution < 0.5) { s = q->next->back; r->back = q->next; q->next->back = r; r->next->back = s; s->back = r->next; addElementLenMULT(fp, tr, r->next->next, old); } else { s = q->next->next->back; r->back = q->next->next; q->next->next->back = r; r->next->back = s; s->back = r->next; addElementLenMULT(fp, tr, r->next->next, old); } } if(ch != ')') { printf("Missing /) in treeReadLenMULT\n"); exit(-1); } (void) treeFlushLabel(fp); } else { ungetc(ch, fp); if ((n = treeFindTipName(fp, tr, TRUE)) <= 0) return FALSE; q = tr->nodep[n]; tr->constraintVector[q->number] = partitionCounter; if (tr->start->number > n) tr->start = q; (tr->ntips)++; hookupDefault(p, q, tr->numBranches); } fres = treeFlushLen(fp, tr); if(!fres) return FALSE; return TRUE; }
int treeReadLen (FILE *fp, tree *tr, boolean readBranches, boolean readNodeLabels, boolean topologyOnly, analdef *adef, boolean completeTree, boolean storeBranchLabels) { nodeptr p; int i, ch, lcount = 0; tr->branchLabelCounter = 0; for (i = 1; i <= tr->mxtips; i++) { tr->nodep[i]->back = (node *) NULL; if(topologyOnly) tr->nodep[i]->support = -1; } for(i = tr->mxtips + 1; i < 2 * tr->mxtips; i++) { tr->nodep[i]->back = (nodeptr)NULL; tr->nodep[i]->next->back = (nodeptr)NULL; tr->nodep[i]->next->next->back = (nodeptr)NULL; tr->nodep[i]->number = i; tr->nodep[i]->next->number = i; tr->nodep[i]->next->next->number = i; if(topologyOnly) { tr->nodep[i]->support = -2; tr->nodep[i]->next->support = -2; tr->nodep[i]->next->next->support = -2; } } if(topologyOnly) tr->start = tr->nodep[tr->mxtips]; else tr->start = tr->nodep[1]; tr->ntips = 0; tr->nextnode = tr->mxtips + 1; for(i = 0; i < tr->numBranches; i++) tr->partitionSmoothed[i] = FALSE; tr->rooted = FALSE; tr->wasRooted = FALSE; p = tr->nodep[(tr->nextnode)++]; while((ch = treeGetCh(fp)) != '('); if(!topologyOnly) { if(adef->mode != CLASSIFY_ML) { if(adef->mode != OPTIMIZE_BR_LEN_SCALER) assert(readBranches == FALSE && readNodeLabels == FALSE); else assert(readBranches == TRUE && readNodeLabels == FALSE); } else { if(adef->useBinaryModelFile) assert(readBranches == TRUE && readNodeLabels == FALSE); else assert(readBranches == FALSE && readNodeLabels == FALSE); } } if (! addElementLen(fp, tr, p, readBranches, readNodeLabels, &lcount, adef, storeBranchLabels)) assert(0); if (! treeNeedCh(fp, ',', "in")) assert(0); if (! addElementLen(fp, tr, p->next, readBranches, readNodeLabels, &lcount, adef, storeBranchLabels)) assert(0); if (! tr->rooted) { if ((ch = treeGetCh(fp)) == ',') { if (! addElementLen(fp, tr, p->next->next, readBranches, readNodeLabels, &lcount, adef, storeBranchLabels)) assert(0); } else { /* A rooted format */ tr->rooted = TRUE; tr->wasRooted = TRUE; if (ch != EOF) (void) ungetc(ch, fp); } } else { p->next->next->back = (nodeptr) NULL; tr->wasRooted = TRUE; } if(!tr->rooted && adef->mode == ANCESTRAL_STATES) { printf("Error: The ancestral state computation mode requires a rooted tree as input, exiting ....\n"); exit(0); } if (! treeNeedCh(fp, ')', "in")) assert(0); if(topologyOnly) assert(!(tr->rooted && readNodeLabels)); (void) treeFlushLabel(fp); if (! treeFlushLen(fp, tr)) assert(0); if (! treeNeedCh(fp, ';', "at end of")) assert(0); if (tr->rooted) { assert(!readNodeLabels); p->next->next->back = (nodeptr) NULL; tr->start = uprootTree(tr, p->next->next, readBranches, FALSE); /*tr->leftRootNode = p->back; tr->rightRootNode = p->next->back; */ if (! tr->start) { printf("FATAL ERROR UPROOTING TREE\n"); assert(0); } } else tr->start = findAnyTip(p, tr->rdta->numsp); if(!topologyOnly || adef->mode == CLASSIFY_MP) { assert(tr->ntips <= tr->mxtips); if(tr->ntips < tr->mxtips) { if(completeTree) { printBothOpen("Hello this is your friendly RAxML tree parsing routine\n"); printBothOpen("The RAxML option you are uisng requires to read in only complete trees\n"); printBothOpen("with %d taxa, there is at least one tree with %d taxa though ... exiting\n", tr->mxtips, tr->ntips); exit(-1); } else { if(adef->computeDistance) { printBothOpen("Error: pairwise distance computation only allows for complete, i.e., containing all taxa\n"); printBothOpen("bifurcating starting trees\n"); exit(-1); } if(adef->mode == CLASSIFY_ML || adef->mode == CLASSIFY_MP) { printBothOpen("RAxML placement algorithm: You provided a reference tree with %d taxa; alignmnet has %d taxa\n", tr->ntips, tr->mxtips); printBothOpen("%d query taxa will be placed using %s\n", tr->mxtips - tr->ntips, (adef->mode == CLASSIFY_ML)?"maximum likelihood":"parsimony"); if(adef->mode == CLASSIFY_ML) classifyML(tr, adef); else { assert(adef->mode == CLASSIFY_MP); classifyMP(tr, adef); } } else { printBothOpen("You provided an incomplete starting tree %d alignmnet has %d taxa\n", tr->ntips, tr->mxtips); makeParsimonyTreeIncomplete(tr, adef); } } } else { if(adef->mode == PARSIMONY_ADDITION) { printBothOpen("Error you want to add sequences to a trees via MP stepwise addition, but \n"); printBothOpen("you have provided an input tree that already contains all taxa\n"); exit(-1); } if(adef->mode == CLASSIFY_ML || adef->mode == CLASSIFY_MP) { printBothOpen("Error you want to place query sequences into a tree using %s, but\n", tr->mxtips - tr->ntips, (adef->mode == CLASSIFY_ML)?"maximum likelihood":"parsimony"); printBothOpen("you have provided an input tree that already contains all taxa\n"); exit(-1); } } onlyInitrav(tr, tr->start); } return lcount; }
int treeReadLen (FILE *fp, tree *tr, boolean readBranches, boolean readNodeLabels, boolean topologyOnly, analdef *adef, boolean completeTree) { nodeptr p; int i, ch, lcount = 0; for (i = 1; i <= tr->mxtips; i++) { tr->nodep[i]->back = (node *) NULL; if(topologyOnly) tr->nodep[i]->support = -1; } for(i = tr->mxtips + 1; i < 2 * tr->mxtips; i++) { tr->nodep[i]->back = (nodeptr)NULL; tr->nodep[i]->next->back = (nodeptr)NULL; tr->nodep[i]->next->next->back = (nodeptr)NULL; tr->nodep[i]->number = i; tr->nodep[i]->next->number = i; tr->nodep[i]->next->next->number = i; if(topologyOnly) { tr->nodep[i]->support = -2; tr->nodep[i]->next->support = -2; tr->nodep[i]->next->next->support = -2; } } if(topologyOnly) tr->start = tr->nodep[tr->mxtips]; else tr->start = tr->nodep[1]; tr->ntips = 0; tr->nextnode = tr->mxtips + 1; for(i = 0; i < tr->numBranches; i++) tr->partitionSmoothed[i] = FALSE; tr->rooted = FALSE; p = tr->nodep[(tr->nextnode)++]; while((ch = treeGetCh(fp)) != '('); if(!topologyOnly) assert(readBranches == FALSE && readNodeLabels == FALSE); if (! addElementLen(fp, tr, p, readBranches, readNodeLabels, &lcount)) assert(0); if (! treeNeedCh(fp, ',', "in")) assert(0); if (! addElementLen(fp, tr, p->next, readBranches, readNodeLabels, &lcount)) assert(0); if (! tr->rooted) { if ((ch = treeGetCh(fp)) == ',') { if (! addElementLen(fp, tr, p->next->next, readBranches, readNodeLabels, &lcount)) assert(0); } else { /* A rooted format */ tr->rooted = TRUE; if (ch != EOF) (void) ungetc(ch, fp); } } else { p->next->next->back = (nodeptr) NULL; } if (! treeNeedCh(fp, ')', "in")) assert(0); if(topologyOnly) assert(!(tr->rooted && readNodeLabels)); (void) treeFlushLabel(fp); if (! treeFlushLen(fp)) assert(0); if (! treeNeedCh(fp, ';', "at end of")) assert(0); if (tr->rooted) { assert(!readNodeLabels); p->next->next->back = (nodeptr) NULL; tr->start = uprootTree(tr, p->next->next, FALSE, FALSE); if (! tr->start) { printf("FATAL ERROR UPROOTING TREE\n"); assert(0); } } else tr->start = findAnyTip(p, tr->rdta->numsp); if(!topologyOnly) { setupPointerMesh(tr); assert(tr->ntips <= tr->mxtips); if(tr->ntips < tr->mxtips) { if(completeTree) { printBothOpen("Hello this is your friendly RAxML tree parsing routine\n"); printBothOpen("The RAxML option you are uisng requires to read in only complete trees\n"); printBothOpen("with %d taxa, there is at least one tree with %d taxa though ... exiting\n", tr->mxtips, tr->ntips); exit(-1); } else { if(adef->computeDistance) { printBothOpen("Error: pairwise distance computation only allows for complete, i.e., containing all taxa\n"); printBothOpen("bifurcating starting trees\n"); exit(-1); } if(adef->mode == CLASSIFY_ML) { printBothOpen("RAxML classifier Algo: You provided a reference tree with %d taxa; alignmnet has %d taxa\n", tr->ntips, tr->mxtips); printBothOpen("%d query taxa will be classifed under ML\n", tr->mxtips - tr->ntips); classifyML(tr, adef); } else { printBothOpen("You provided an incomplete starting tree %d alignmnet has %d taxa\n", tr->ntips, tr->mxtips); makeParsimonyTreeIncomplete(tr, adef); } } } else { if(adef->mode == PARSIMONY_ADDITION) { printBothOpen("Error you want to add sequences to a trees via MP stepwise addition, but \n"); printBothOpen("you have provided an input tree that already contains all taxa\n"); exit(-1); } if(adef->mode == CLASSIFY_ML) { printBothOpen("Error you want to classify query sequences into a tree via ML, but \n"); printBothOpen("you have provided an input tree that already contains all taxa\n"); exit(-1); } } onlyInitrav(tr, tr->start); } return lcount; }