// $Id: fastStartTree.cpp 962 2006-11-07 15:13:34Z privmane $ #include "definitions.h" #include "tree.h" #include "treeUtil.h" #include "fastStartTree.h" #include "bblEM.h" #include "likeDist.h" #include "likelihoodComputation.h" #include "getRandomWeights.h" #include "distanceTable.h" #include "nj.h" #include "logFile.h" #include using namespace std; using namespace likelihoodComputation; vector eliminateHalf(vector& tVec, sequenceContainer& orginal, stochasticProcess& sp, ostream& out, const int maxIterEM){ vector likeScore(tVec.size(),0.0); int i; for (i=0; i < tVec.size(); ++i) { bblEM bblEM1(tVec[i],orginal,sp,NULL,maxIterEM,0.01); likeScore[i] = bblEM1.getTreeLikelihood(); LOG(5,<<"~"); } vector sortedL = likeScore; sort(sortedL.begin(),sortedL.end()); MDOUBLE median = sortedL[sortedL.size()/2]; // printing the top ten with their scores; // int toPrint = sortedL.size()>10? 10 : sortedL.size(); // MDOUBLE treshToPrint = sortedL[sortedL.size()-toPrint]; // out<<"current best 10 (or less) trees: "<treshToPrint) { // out<<"likelihood of tree: "< vNames; giveDistanceTable(&pd1, allTogether, disTab, vNames, &startingTreeWeights); NJalg nj1; tree et = nj1.computeTree(disTab,vNames); bool treeAlreadyThere = false; for (int z=0; z< tVec.size();++z) { if (sameTreeTolopogy(tVec[z],et)) treeAlreadyThere=true; } if (treeAlreadyThere == false) { tVec.push_back(et); } } LOG(5,<<"from number of tree tried: "< 1) { LOG(5,<<" current size = "<