]> git.donarmstrong.com Git - mothur.git/blobdiff - parsimony.cpp
sffinfo bug with flow grams right index when clipQualRight=0
[mothur.git] / parsimony.cpp
index d26bc270efcdd7fff7cb1292ddc2bfb786a48665..6a0485c133b2868670e49e5873186e5d10df474d 100644 (file)
@@ -15,6 +15,7 @@ EstOutput Parsimony::getValues(Tree* t, int p, string o) {
        try {
                processors = p;
                outputDir = o;
+        CountTable* ct = t->getCountTable();
                
                //if the users enters no groups then give them the score of all groups
                vector<string> mGroups = m->getGroups();
@@ -37,7 +38,7 @@ EstOutput Parsimony::getValues(Tree* t, int p, string o) {
                        vector<string> groups;
                        if (numGroups == 0) {
                                //get score for all users groups
-                               vector<string> tGroups = tmap->getNamesOfGroups();
+                               vector<string> tGroups = ct->getNamesOfGroups();
                                for (int i = 0; i < tGroups.size(); i++) {
                                        if (tGroups[i] != "xxx") {
                                                groups.push_back(tGroups[i]);
@@ -56,7 +57,7 @@ EstOutput Parsimony::getValues(Tree* t, int p, string o) {
                
        #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                if(processors == 1){
-                       data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size());
+                       data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), ct);
                }else{
                        lines.clear();
                        int numPairs = namesOfGroupCombos.size();
@@ -73,10 +74,10 @@ EstOutput Parsimony::getValues(Tree* t, int p, string o) {
                                lines.push_back(linePair(startPos, numPairsPerProcessor));
                        }
                        
-                       data = createProcesses(t, namesOfGroupCombos);
+                       data = createProcesses(t, namesOfGroupCombos, ct);
                }
        #else
-               data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size());
+               data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), ct);
        #endif
                
                return data;
@@ -89,7 +90,7 @@ EstOutput Parsimony::getValues(Tree* t, int p, string o) {
 }
 /**************************************************************************************************/
 
-EstOutput Parsimony::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos) {
+EstOutput Parsimony::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos, CountTable* ct) {
        try {
 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
                int process = 1;
@@ -106,7 +107,7 @@ EstOutput Parsimony::createProcesses(Tree* t, vector< vector<string> > namesOfGr
                                process++;
                        }else if (pid == 0){
                                EstOutput myresults;
-                               myresults = driver(t, namesOfGroupCombos, lines[process].start, lines[process].num);
+                               myresults = driver(t, namesOfGroupCombos, lines[process].start, lines[process].num, ct);
                                
                                if (m->control_pressed) { exit(0); }
                                
@@ -126,7 +127,7 @@ EstOutput Parsimony::createProcesses(Tree* t, vector< vector<string> > namesOfGr
                        }
                }
                
-               results = driver(t, namesOfGroupCombos, lines[0].start, lines[0].num);
+               results = driver(t, namesOfGroupCombos, lines[0].start, lines[0].num, ct);
                
                //force parent to wait until all the processes are done
                for (int i=0;i<processIDS.size();i++) { 
@@ -169,12 +170,12 @@ EstOutput Parsimony::createProcesses(Tree* t, vector< vector<string> > namesOfGr
        }
 }
 /**************************************************************************************************/
-EstOutput Parsimony::driver(Tree* t, vector< vector<string> > namesOfGroupCombos, int start, int num) { 
+EstOutput Parsimony::driver(Tree* t, vector< vector<string> > namesOfGroupCombos, int start, int num, CountTable* ct) { 
        try {
                
                EstOutput results; results.resize(num);
                
-               Tree* copyTree = new Tree(tmap);
+               Tree* copyTree = new Tree(ct);
                int count = 0;
                
                for (int h = start; h < (start+num); h++) {