+/**************************************************************************************************/
+int SummarySharedCommand::driver(vector<SharedRAbundVector*> thisLookup, int start, int end, string sumFile, string sumAllFile, vector< vector<seqDist> >& calcDists) {
+ try {
+
+ //loop through calculators and add to file all for all calcs that can do mutiple groups
+ if (mult == true) {
+ ofstream outAll;
+ m->openOutputFile(sumAllFile, outAll);
+
+ //output label
+ outAll << thisLookup[0]->getLabel() << '\t';
+
+ //output groups names
+ string outNames = "";
+ for (int j = 0; j < thisLookup.size(); j++) {
+ outNames += thisLookup[j]->getGroup() + "-";
+ }
+ outNames = outNames.substr(0, outNames.length()-1); //rip off extra '-';
+ outAll << outNames << '\t';
+
+ for(int i=0;i<sumCalculators.size();i++){
+ if (sumCalculators[i]->getMultiple() == true) {
+ sumCalculators[i]->getValues(thisLookup);
+
+ if (m->control_pressed) { outAll.close(); return 1; }
+
+ outAll << '\t';
+ sumCalculators[i]->print(outAll);
+ }
+ }
+ outAll << endl;
+ outAll.close();
+ }
+
+ ofstream outputFileHandle;
+ m->openOutputFile(sumFile, outputFileHandle);
+
+ vector<SharedRAbundVector*> subset;
+ for (int k = start; k < end; k++) { // pass cdd each set of groups to compare
+
+ for (int l = 0; l < k; l++) {
+
+ outputFileHandle << thisLookup[0]->getLabel() << '\t';
+
+ subset.clear(); //clear out old pair of sharedrabunds
+ //add new pair of sharedrabunds
+ subset.push_back(thisLookup[k]); subset.push_back(thisLookup[l]);
+
+ //sort groups to be alphanumeric
+ if (thisLookup[k]->getGroup() > thisLookup[l]->getGroup()) {
+ outputFileHandle << (thisLookup[l]->getGroup() +'\t' + thisLookup[k]->getGroup()) << '\t'; //print out groups
+ }else{
+ outputFileHandle << (thisLookup[k]->getGroup() +'\t' + thisLookup[l]->getGroup()) << '\t'; //print out groups
+ }
+
+ for(int i=0;i<sumCalculators.size();i++) {
+
+ vector<double> tempdata = sumCalculators[i]->getValues(subset); //saves the calculator outputs
+
+ if (m->control_pressed) { outputFileHandle.close(); return 1; }
+
+ outputFileHandle << '\t';
+ sumCalculators[i]->print(outputFileHandle);
+
+ seqDist temp(l, k, tempdata[0]);
+ calcDists[i].push_back(temp);
+ }
+ outputFileHandle << endl;
+ }
+ }
+
+ outputFileHandle.close();
+
+ return 0;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SummarySharedCommand", "driver");
+ exit(1);
+ }
+}
+/**************************************************************************************************/
+