X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=unifracweightedcommand.cpp;h=ad012b542b82a99ad0ac40782688c325360268b0;hb=bd93b1a6f9fe9a6a4a7ac2e9f106e5c83a438856;hp=65b0a5090afb211b78c6abc9737f767af7176bff;hpb=f099fdc1e3a0d7b75d780a164e5bdb93496a7a1d;p=mothur.git diff --git a/unifracweightedcommand.cpp b/unifracweightedcommand.cpp index 65b0a50..ad012b5 100644 --- a/unifracweightedcommand.cpp +++ b/unifracweightedcommand.cpp @@ -275,7 +275,7 @@ int UnifracWeightedCommand::execute() { int UnifracWeightedCommand::createProcesses(Tree* t, Tree* randT, vector< vector > namesOfGroupCombos, vector& sums, vector< vector >& scores) { try { #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) - int process = 0; + int process = 1; int num = 0; vector processIDS; @@ -295,52 +295,32 @@ int UnifracWeightedCommand::createProcesses(Tree* t, Tree* randT, vector< vector //pass numSeqs to parent ofstream out; - string tempFile = outputDir + toString(getpid()) + ".results.temp"; + string tempFile = outputDir + toString(getpid()) + ".weightedcommand.results.temp"; m->openOutputFile(tempFile, out); - out << results.size() << endl; - for (int i = lines[process]->start; i < (lines[process]->start + lines[process]->num); i++) { out << results[i] << '\t'; } out << endl; + for (int i = lines[process]->start; i < (lines[process]->start + lines[process]->num); i++) { out << scores[i][0] << '\t'; } out << endl; out.close(); exit(0); }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); } } + driver(t, randT, namesOfGroupCombos, lines[0]->start, lines[0]->num, sums, scores); + //force parent to wait until all the processes are done - for (int i=0;iopenInputFile(s, in); - vector r; - - //get quantiles - while (!in.eof()) { - int num; - in >> num; - - m->gobble(in); - - double w; - for (int j = 0; j < num; j++) { - in >> w; - r.push_back(w); - } - m->gobble(in); - } + for (int i = lines[process]->start; i < (lines[process]->start + lines[process]->num); i++) { in >> scores[i][0]; } in.close(); remove(s.c_str()); - - //save quan in quantiles - for (int j = 0; j < r.size(); j++) { - //put all values of r into results - results.push_back(r[j]); - } } m->mothurOut("DONE."); m->mothurOutEndLine(); m->mothurOutEndLine(); @@ -358,7 +338,7 @@ int UnifracWeightedCommand::createProcesses(Tree* t, Tree* randT, vector< vector int UnifracWeightedCommand::driver(Tree* t, Tree* randT, vector< vector > namesOfGroupCombos, int start, int num, vector& sums, vector< vector >& scores) { try { int count = 0; - int total = start+num; + int total = num; int twentyPercent = (total * 0.20); for (int h = start; h < (start+num); h++) { @@ -389,7 +369,7 @@ int UnifracWeightedCommand::driver(Tree* t, Tree* randT, vector< vector count++; //report progress - if((h) % twentyPercent == 0){ m->mothurOut("Random comparison percentage complete: " + toString(int((h / (float)total) * 100.0))); m->mothurOutEndLine(); } + if((count) % twentyPercent == 0){ m->mothurOut("Random comparison percentage complete: " + toString(int((count / (float)total) * 100.0))); m->mothurOutEndLine(); } } m->mothurOut("Random comparison percentage complete: 100"); m->mothurOutEndLine();