-
-//int AmovaCommand::process(vector<SharedRAbundVector*> thisLookup) {
-// try{
-//
-//#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
-// if(processors == 1){
-// driver(0, namesOfGroupCombos.size(), thisLookup, "");
-// }else{
-// int process = 1;
-// vector<int> processIDS;
-//
-// //loop through and create all the processes you want
-// while (process != processors) {
-// int pid = fork();
-//
-// if (pid > 0) {
-// processIDS.push_back(pid);
-// process++;
-// }else if (pid == 0){
-// driver(lines[process].start, lines[process].num, thisLookup, toString(getpid()));
-// 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);
-// }
-// }
-//
-// //do my part
-// driver(lines[0].start, lines[0].num, thisLookup, "");
-//
-// //force parent to wait until all the processes are done
-// for (int i=0;i<(processors-1);i++) {
-// int temp = processIDS[i];
-// wait(&temp);
-// }
-//
-// //append files
-// for(int i = 0 ; i < calculators.size(); i++) {
-// string outputFile = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + calculators[i]->getName() + ".amova";
-//
-// for (int j = 0; j < processIDS.size(); j++) {
-// m->appendFiles((outputFile + toString(processIDS[j])), outputFile);
-// remove((outputFile + toString(processIDS[j])).c_str());
-// }
-// }
-// }
-//#else
-// driver(0, namesOfGroupCombos.size(), thisLookUp, "");
-//#endif
-//
-// return 0;
-// }
-// catch(exception& e) {
-// m->errorOut(e, "AmovaCommand", "process");
-// exit(1);
-// }
-//}
-
-//**********************************************************************************************************************
-
-//int AmovaCommand::driver(int start, int num, vector<SharedRAbundVector*> thisLookup, string pidValue) {
-// try {
-// vector<SharedRAbundVector*> subset;
-// EstOutput data;
-//
-// //for each calculator
-// for(int i = 0 ; i < calculators.size(); i++) {
-//
-// //create a new filename
-// ofstream out;
-// string outputFile = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + calculators[i]->getName() + ".amova" + pidValue;
-// m->openOutputFileAppend(outputFile, out);
-// out.setf(ios::fixed, ios::floatfield); out.setf(ios::showpoint);
-//
-// //for each combo
-// for (int c = start; c < (start+num); c++) {
-//
-// if (m->control_pressed) { out.close(); return 0; }
-//
-// //get set names
-// vector<string> setNames;
-// for (int j = 0; j < namesOfGroupCombos[c].size(); j++) { setNames.push_back(namesOfGroupCombos[c][j]); }
-//
-// vector<SharedRAbundVector*> thisCombosLookup;
-// vector<string> thisCombosLookupSets; //what set each sharedRabund is from to be used when calculating SSWithin
-// for (int k = 0; k < thisLookup.size(); k++) {
-// string thisGroup = thisLookup[k]->getGroup();
-//
-// //is this group for a set we want to compare??
-// if (m->inUsersGroups(designMap->getGroup(thisGroup), setNames)) {
-// thisCombosLookup.push_back(thisLookup[k]);
-// thisCombosLookupSets.push_back(designMap->getGroup(thisGroup));
-// }
-//
-// }
-//
-// int numGroups = thisCombosLookup.size();
-//
-// //calc the distance matrix
-// matrix.clear();
-// matrix.resize(numGroups);
-// for (int k = 0; k < matrix.size(); k++) { for (int j = 0; j < matrix.size(); j++) { matrix[k].push_back(1.0); } }
-//
-// if (thisCombosLookup.size() == 0) {
-// m->mothurOut("[ERROR]: Missing shared info for sets. Skipping comparison."); m->mothurOutEndLine();
-// }else{
-//
-// m->mothurOut(thisLookup[0]->getLabel() + '\t');
-// out << thisLookup[0]->getLabel() << '\t';
-// if (setNames.size() == 2) {
-// m->mothurOut(setNames[0] + '-' + setNames[1] + '\t');
-// out << setNames[0] << "-" << setNames[1] << '\t';
-// }
-// else {
-// out << "all" << '\t';
-// m->mothurOut("all\t");
-// }
-//
-// for (int k = 0; k < thisCombosLookup.size(); k++) {
-// for (int l = k; l < thisCombosLookup.size(); l++) {
-//
-// if (m->control_pressed) { out.close(); return 0; }
-//
-// if (k != l) { //we dont need to similiarity of a groups to itself
-// //get estimated similarity between 2 groups
-// subset.clear(); //clear out old pair of sharedrabunds
-// //add new pair of sharedrabunds
-// subset.push_back(thisCombosLookup[k]); subset.push_back(thisCombosLookup[l]);
-//
-// //if this calc needs all groups to calculate the pair load all groups
-// if (calculators[i]->getNeedsAll()) {
-// //load subset with rest of lookup for those calcs that need everyone to calc for a pair
-// for (int w = 0; w < thisCombosLookup.size(); w++) {
-// if ((w != k) && (w != l)) { subset.push_back(thisCombosLookup[w]); }
-// }
-// }
-//
-// data = calculators[i]->getValues(subset); //saves the calculator outputs
-//
-// //save values in similarity matrix
-// matrix[k][l] = 1.0 - data[0];
-// matrix[l][k] = 1.0 - data[0];
-// }
-// }
-// }
-//
-// //calc amova
-// calcAmova(out, setNames.size(), thisCombosLookupSets);
-// }
-// }
-//
-// out.close();
-// }
-//
-// return 0;
-//
-// }
-// catch(exception& e) {
-// m->errorOut(e, "AmovaCommand", "driver");
-// exit(1);
-// }
-//}
-//
-//**********************************************************************************************************************
-//
-//int AmovaCommand::driver(int start, int num, vector<string> names, string pidValue, vector< vector<double> >& completeMatrix) {
-// try {
-//
-// //create a new filename
-// ofstream out;
-// string outputFile = outputDir + m->getRootName(m->getSimpleName(phylipFile)) + "amova" + pidValue;
-// m->openOutputFileAppend(outputFile, out);
-// out.setf(ios::fixed, ios::floatfield); out.setf(ios::showpoint);
-//
-// //for each combo
-// for (int c = start; c < (start+num); c++) {
-//
-// if (m->control_pressed) { out.close(); return 0; }
-//
-// //get set names
-// vector<string> setNames;
-// for (int j = 0; j < namesOfGroupCombos[c].size(); j++) { setNames.push_back(namesOfGroupCombos[c][j]); }
-//
-// vector<string> thisCombosSets; //what set each line in the distance matrix is from to be used when calculating SSWithin
-// set<int> indexes;
-// for (int k = 0; k < names.size(); k++) {
-// //is this group for a set we want to compare??
-// if (m->inUsersGroups(designMap->getGroup(names[k]), setNames)) {
-// thisCombosSets.push_back(designMap->getGroup(names[k]));
-// indexes.insert(k); //save indexes of valid rows in matrix for submatrix
-// }
-// }
-//
-// int numGroups = thisCombosSets.size();
-//
-// //calc the distance matrix
-// matrix.clear();
-// matrix.resize(numGroups);
-//
-// for (int k = 0; k < matrix.size(); k++) { for (int j = 0; j < matrix.size(); j++) { matrix[k].push_back(1.0); } }
-//
-// if (thisCombosSets.size() == 0) {
-// m->mothurOut("[ERROR]: Missing distance info for sets. Skipping comparison."); m->mothurOutEndLine();
-// }else{
-//
-// if (setNames.size() == 2) {
-// out << setNames[0] << "-" << setNames[1] << '\t';
-// m->mothurOut(setNames[0] + '-' + setNames[1] + '\t');
-// }
-// else {
-// out << "all" << '\t';
-// m->mothurOut("all\t");
-// }
-//
-// //fill submatrix
-// int rowCount = 0;
-// for (int j = 0; j < completeMatrix.size(); j++) {
-//
-// if (indexes.count(j) != 0) { //we want at least part of this row
-// int columnCount = 0;
-// for (int k = 0; k < completeMatrix[j].size(); k++) {
-//
-// if (indexes.count(k) != 0) { //we want this distance
-// matrix[rowCount][columnCount] = completeMatrix[j][k];
-// matrix[columnCount][rowCount] = completeMatrix[j][k];
-// columnCount++;
-// }
-// }
-// rowCount++;
-// }
-// }
-//
-// //calc amova
-// calcAmova(out, setNames.size(), thisCombosSets);
-// }
-// }
-//
-// out.close();
-//
-//
-// return 0;
-//
-// }
-// catch(exception& e) {
-// m->errorOut(e, "AmovaCommand", "driver");
-// exit(1);
-// }
-//}
-//
-//**********************************************************************************************************************
-