]> git.donarmstrong.com Git - mothur.git/blobdiff - parsimony.cpp
fixed bug in read.tree updates help and validparameters strings, added ability for...
[mothur.git] / parsimony.cpp
index 0dea64e99a5f7bbe3adfe3dbd648ab8fb5365acf..9a8706e82499fb80f9c2a55d61bc92c7b2399839 100644 (file)
@@ -75,7 +75,9 @@ EstOutput Parsimony::getValues(Tree* t) {
                        if (numGroups == 0) {
                                //get score for all users groups
                                for (int i = 0; i < tmap->namesOfGroups.size(); i++) {
-                                       groups.push_back(tmap->namesOfGroups[i]);
+                                       if (tmap->namesOfGroups[i] != "xxx") {
+                                               groups.push_back(tmap->namesOfGroups[i]);
+                                       }
                                }
                        }else {
                                for (int i = 0; i < globaldata->Groups.size(); i++) {
@@ -89,9 +91,12 @@ EstOutput Parsimony::getValues(Tree* t) {
                
                        //create pgroups that reflect the groups the user want to use
                        for(int i=copyTree->getNumLeaves();i<copyTree->getNumNodes();i++){
+//                             cout << i << "..." << endl;
                                copyTree->tree[i].pGroups = (copyTree->mergeUserGroups(i, groups));
                        }
                
+//                     map<string,int>::iterator it;
+                       
                        for(int i=copyTree->getNumLeaves();i<copyTree->getNumNodes();i++){
                                int lc = copyTree->tree[i].getLChild();
                                int rc = copyTree->tree[i].getRChild();
@@ -99,7 +104,15 @@ EstOutput Parsimony::getValues(Tree* t) {
                                int iSize = copyTree->tree[i].pGroups.size();
                                int rcSize = copyTree->tree[rc].pGroups.size();
                                int lcSize = copyTree->tree[lc].pGroups.size();
-               
+                               
+//                             cout << i+1 << '\t' << lc+1 << '\t' << rc+1 << ":\t";
+                               
+//                             for(it=copyTree->tree[i].pGroups.begin();it!=copyTree->tree[i].pGroups.end();it++){
+//                                     cout << it->first << '\t';
+//                             }
+                               
+//                             cout << " : " << iSize << '\t' << rcSize << '\t' << lcSize << '\t';
+                                       
                                //if isize are 0 then that branch is to be ignored
                                if (iSize == 0) { }
                                else if ((rcSize == 0) || (lcSize == 0)) { }
@@ -107,11 +120,16 @@ EstOutput Parsimony::getValues(Tree* t) {
                                else if(iSize > rcSize || iSize > lcSize){
                                        score++;
                                }
+//                             cout << score << endl;
                        } 
                
                        data[count] = score;
+                       string hold;
+//                     cin >> hold;
                }
                
+               delete copyTree;
+               
                return data;
        }
        catch(exception& e) {