X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=unweighted.cpp;h=56694e32e3a977b08df087dfc8deeabb2524564c;hb=1a968f34ae2d2680eaf189a197d1a21b8dfd6c03;hp=864a9f8bab16f5d1ea52480c37c141ddc934e199;hpb=d2390ede25cc211f95f99e377d5654bad7e6950e;p=mothur.git diff --git a/unweighted.cpp b/unweighted.cpp index 864a9f8..56694e3 100644 --- a/unweighted.cpp +++ b/unweighted.cpp @@ -16,7 +16,7 @@ EstOutput Unweighted::getValues(Tree* t, int p, string o) { processors = p; outputDir = o; - TreeMap* tmap = t->getTreeMap(); + CountTable* ct = t->getCountTable(); //if the users enters no groups then give them the score of all groups int numGroups = m->getNumGroups(); @@ -36,9 +36,9 @@ EstOutput Unweighted::getValues(Tree* t, int p, string o) { vector groups; if (numGroups == 0) { //get score for all users groups - for (int i = 0; i < (tmap->getNamesOfGroups()).size(); i++) { - if ((tmap->getNamesOfGroups())[i] != "xxx") { - groups.push_back((tmap->getNamesOfGroups())[i]); + for (int i = 0; i < (ct->getNamesOfGroups()).size(); i++) { + if ((ct->getNamesOfGroups())[i] != "xxx") { + groups.push_back((ct->getNamesOfGroups())[i]); } } namesOfGroupCombos.push_back(groups); @@ -52,7 +52,7 @@ EstOutput Unweighted::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(), tmap); + data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), ct); }else{ int numPairs = namesOfGroupCombos.size(); @@ -67,11 +67,11 @@ EstOutput Unweighted::getValues(Tree* t, int p, string o) { lines.push_back(linePair(startPos, numPairsPerProcessor)); } - data = createProcesses(t, namesOfGroupCombos, tmap); + data = createProcesses(t, namesOfGroupCombos, ct); lines.clear(); } #else - data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), tmap); + data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), ct); #endif return data; @@ -83,7 +83,7 @@ EstOutput Unweighted::getValues(Tree* t, int p, string o) { } /**************************************************************************************************/ -EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfGroupCombos, TreeMap* tmap) { +EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfGroupCombos, CountTable* ct) { try { #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) int process = 1; @@ -100,11 +100,11 @@ EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfG process++; }else if (pid == 0){ EstOutput myresults; - myresults = driver(t, namesOfGroupCombos, lines[process].start, lines[process].num, tmap); + myresults = driver(t, namesOfGroupCombos, lines[process].start, lines[process].num, ct); if (m->control_pressed) { exit(0); } - m->mothurOut("Merging results."); m->mothurOutEndLine(); + //m->mothurOut("Merging results."); m->mothurOutEndLine(); //pass numSeqs to parent ofstream out; @@ -122,7 +122,7 @@ EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfG } } - results = driver(t, namesOfGroupCombos, lines[0].start, lines[0].num, tmap); + 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<(processors-1);i++) { @@ -156,7 +156,7 @@ EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfG m->mothurRemove(s); } - m->mothurOut("DONE."); m->mothurOutEndLine(); m->mothurOutEndLine(); + //m->mothurOut("DONE."); m->mothurOutEndLine(); m->mothurOutEndLine(); return results; #endif @@ -167,7 +167,7 @@ EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfG } } /**************************************************************************************************/ -EstOutput Unweighted::driver(Tree* t, vector< vector > namesOfGroupCombos, int start, int num, TreeMap* tmap) { +EstOutput Unweighted::driver(Tree* t, vector< vector > namesOfGroupCombos, int start, int num, CountTable* ct) { try { @@ -261,7 +261,7 @@ EstOutput Unweighted::getValues(Tree* t, string groupA, string groupB, int p, st processors = p; outputDir = o; - TreeMap* tmap = t->getTreeMap(); + CountTable* ct = t->getCountTable(); //if the users enters no groups then give them the score of all groups int numGroups = m->getNumGroups(); @@ -281,9 +281,9 @@ EstOutput Unweighted::getValues(Tree* t, string groupA, string groupB, int p, st vector groups; if (numGroups == 0) { //get score for all users groups - for (int i = 0; i < (tmap->getNamesOfGroups()).size(); i++) { - if ((tmap->getNamesOfGroups())[i] != "xxx") { - groups.push_back((tmap->getNamesOfGroups())[i]); + for (int i = 0; i < (ct->getNamesOfGroups()).size(); i++) { + if ((ct->getNamesOfGroups())[i] != "xxx") { + groups.push_back((ct->getNamesOfGroups())[i]); } } namesOfGroupCombos.push_back(groups); @@ -297,7 +297,7 @@ EstOutput Unweighted::getValues(Tree* t, string groupA, string groupB, int p, st #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) if(processors == 1){ - data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), true, tmap); + data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), true, ct); }else{ int numPairs = namesOfGroupCombos.size(); @@ -311,12 +311,12 @@ EstOutput Unweighted::getValues(Tree* t, string groupA, string groupB, int p, st lines.push_back(linePair(startPos, numPairsPerProcessor)); } - data = createProcesses(t, namesOfGroupCombos, true, tmap); + data = createProcesses(t, namesOfGroupCombos, true, ct); lines.clear(); } #else - data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), true, tmap); + data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), true, ct); #endif return data; @@ -328,7 +328,7 @@ EstOutput Unweighted::getValues(Tree* t, string groupA, string groupB, int p, st } /**************************************************************************************************/ -EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfGroupCombos, bool usingGroups, TreeMap* tmap) { +EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfGroupCombos, bool usingGroups, CountTable* ct) { try { #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) int process = 1; @@ -345,7 +345,7 @@ EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfG process++; }else if (pid == 0){ EstOutput myresults; - myresults = driver(t, namesOfGroupCombos, lines[process].start, lines[process].num, usingGroups, tmap); + myresults = driver(t, namesOfGroupCombos, lines[process].start, lines[process].num, usingGroups, ct); if (m->control_pressed) { exit(0); } @@ -365,7 +365,7 @@ EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfG } } - results = driver(t, namesOfGroupCombos, lines[0].start, lines[0].num, usingGroups, tmap); + results = driver(t, namesOfGroupCombos, lines[0].start, lines[0].num, usingGroups, ct); //force parent to wait until all the processes are done for (int i=0;i<(processors-1);i++) { @@ -409,14 +409,14 @@ EstOutput Unweighted::createProcesses(Tree* t, vector< vector > namesOfG } } /**************************************************************************************************/ -EstOutput Unweighted::driver(Tree* t, vector< vector > namesOfGroupCombos, int start, int num, bool usingGroups, TreeMap* tmap) { +EstOutput Unweighted::driver(Tree* t, vector< vector > namesOfGroupCombos, int start, int num, bool usingGroups, CountTable* ct) { try { EstOutput results; results.resize(num); int count = 0; - Tree* copyTree = new Tree(tmap); + Tree* copyTree = new Tree(ct); for (int h = start; h < (start+num); h++) {