//**********************************************************************************************************************
UnifracWeightedCommand::UnifracWeightedCommand(){
try {
+ abort = true;
//initialize outputTypes
vector<string> tempOutNames;
outputTypes["weighted"] = tempOutNames;
}
if (random) {
- vector<double> sums = weighted->getBranchLengthSums(T[i]);
//calculate number of comparisons i.e. with groups A,B,C = AB, AC, BC = 3;
vector< vector<string> > namesOfGroupCombos;
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
if(processors == 1){
- driver(T[i], namesOfGroupCombos, 0, namesOfGroupCombos.size(), sums, rScores);
+ driver(T[i], namesOfGroupCombos, 0, namesOfGroupCombos.size(), rScores);
}else{
- createProcesses(T[i], namesOfGroupCombos, sums, rScores);
+ createProcesses(T[i], namesOfGroupCombos, rScores);
}
#else
- driver(T[i], namesOfGroupCombos, 0, namesOfGroupCombos.size(), sums, rScores);
+ driver(T[i], namesOfGroupCombos, 0, namesOfGroupCombos.size(), rScores);
#endif
if (m->control_pressed) { delete output; outSum.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
}
/**************************************************************************************************/
-int UnifracWeightedCommand::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos, vector<double>& sums, vector< vector<double> >& scores) {
+int UnifracWeightedCommand::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos, vector< vector<double> >& scores) {
try {
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
int process = 1;
processIDS.push_back(pid); //create map from line number to pid so you can append files in correct order later
process++;
}else if (pid == 0){
- driver(t, namesOfGroupCombos, lines[process].start, lines[process].num, sums, scores);
+ driver(t, namesOfGroupCombos, lines[process].start, lines[process].num, scores);
//pass numSeqs to parent
ofstream out;
out.close();
exit(0);
- }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
+ }else {
+ m->mothurOut("[ERROR]: unable to spawn the necessary processes."); m->mothurOutEndLine();
+ for (int i = 0; i < processIDS.size(); i++) { kill (processIDS[i], SIGINT); }
+ exit(0);
+ }
}
- driver(t, namesOfGroupCombos, lines[0].start, lines[0].num, sums, scores);
+ driver(t, namesOfGroupCombos, lines[0].start, lines[0].num, scores);
//force parent to wait until all the processes are done
for (int i=0;i<(processors-1);i++) {
}
/**************************************************************************************************/
-int UnifracWeightedCommand::driver(Tree* t, vector< vector<string> > namesOfGroupCombos, int start, int num, vector<double>& sums, vector< vector<double> >& scores) {
+int UnifracWeightedCommand::driver(Tree* t, vector< vector<string> > namesOfGroupCombos, int start, int num, vector< vector<double> >& scores) {
try {
Tree* randT = new Tree();
if (m->control_pressed) { delete randT; return 0; }
//get wscore of random tree
- EstOutput randomData = weighted->getValues(randT, groupA, groupB, sums);
+ EstOutput randomData = weighted->getValues(randT, groupA, groupB);
if (m->control_pressed) { delete randT; return 0; }