X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=weighted.cpp;h=85eed5207ff20d586bd999f670d59a4c8e840c67;hb=d71a31a60542608595ce1278cc4a3398479cec7f;hp=70f6ae3eb1d621722ebd11221e88c92cc83b78eb;hpb=19fcbbdba99658f5eca244803280f9ee7f9f6607;p=mothur.git diff --git a/weighted.cpp b/weighted.cpp index 70f6ae3..85eed52 100644 --- a/weighted.cpp +++ b/weighted.cpp @@ -18,8 +18,10 @@ EstOutput Weighted::getValues(Tree* t, int p, string o) { vector D; processors = p; outputDir = o; + + TreeMap* tmap = t->getTreeMap(); - numGroups = m->Groups.size(); + numGroups = m->getNumGroups(); if (m->control_pressed) { return data; } @@ -29,14 +31,14 @@ EstOutput Weighted::getValues(Tree* t, int p, string o) { for (int l = 0; l < i; l++) { //initialize weighted scores //WScore[globaldata->Groups[i]+globaldata->Groups[l]] = 0.0; - vector groups; groups.push_back(m->Groups[i]); groups.push_back(m->Groups[l]); + vector groups; groups.push_back((m->getGroups())[i]); groups.push_back((m->getGroups())[l]); namesOfGroupCombos.push_back(groups); } } - #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) + #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(), tmap); }else{ int numPairs = namesOfGroupCombos.size(); @@ -50,12 +52,12 @@ EstOutput Weighted::getValues(Tree* t, int p, string o) { lines.push_back(linePair(startPos, numPairsPerProcessor)); } - data = createProcesses(t, namesOfGroupCombos); + data = createProcesses(t, namesOfGroupCombos, tmap); lines.clear(); } #else - data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size()); + data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), tmap); #endif return data; @@ -67,9 +69,9 @@ EstOutput Weighted::getValues(Tree* t, int p, string o) { } /**************************************************************************************************/ -EstOutput Weighted::createProcesses(Tree* t, vector< vector > namesOfGroupCombos) { +EstOutput Weighted::createProcesses(Tree* t, vector< vector > namesOfGroupCombos, TreeMap* tmap) { try { -#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) int process = 1; vector processIDS; @@ -85,9 +87,9 @@ EstOutput Weighted::createProcesses(Tree* t, vector< vector > namesOfGro }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, tmap); - m->mothurOut("Merging results."); m->mothurOutEndLine(); + //m->mothurOut("Merging results."); m->mothurOutEndLine(); //pass numSeqs to parent ofstream out; @@ -108,7 +110,7 @@ EstOutput Weighted::createProcesses(Tree* t, vector< vector > namesOfGro } } - results = driver(t, namesOfGroupCombos, lines[0].start, lines[0].num); + results = driver(t, namesOfGroupCombos, lines[0].start, lines[0].num, tmap); //force parent to wait until all the processes are done for (int i=0;i<(processors-1);i++) { @@ -142,7 +144,7 @@ EstOutput Weighted::createProcesses(Tree* t, vector< vector > namesOfGro m->mothurRemove(s); } - m->mothurOut("DONE."); m->mothurOutEndLine(); m->mothurOutEndLine(); + //m->mothurOut("DONE."); m->mothurOutEndLine(); m->mothurOutEndLine(); return results; #endif @@ -153,7 +155,7 @@ EstOutput Weighted::createProcesses(Tree* t, vector< vector > namesOfGro } } /**************************************************************************************************/ -EstOutput Weighted::driver(Tree* t, vector< vector > namesOfGroupCombos, int start, int num) { +EstOutput Weighted::driver(Tree* t, vector< vector > namesOfGroupCombos, int start, int num, TreeMap* tmap) { try { EstOutput results; vector D; @@ -267,6 +269,8 @@ EstOutput Weighted::getValues(Tree* t, string groupA, string groupB) { try { data.clear(); //clear out old values + + TreeMap* tmap = t->getTreeMap(); if (m->control_pressed) { return data; }