-
- int n = 1;
- vector<SharedRAbundVector*> subset;
- for (int k = 0; k < (thisLookup.size() - 1); k++) { // pass cdd each set of groups to commpare
- for (int l = n; l < thisLookup.size(); 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++) {
+ #else
+ driver(thisLookup, 0, numGroups, (sumFileName + ".temp"), (sumAllFileName + ".temp"));
+ m->appendFiles((sumFileName + ".temp"), sumFileName);
+ remove((sumFileName + ".temp").c_str());
+ if (mult) {
+ m->appendFiles((sumAllFileName + ".temp"), sumAllFileName);
+ remove((sumAllFileName + ".temp").c_str());
+ }
+ #endif
+ }
+ catch(exception& e) {
+ m->errorOut(e, "SummarySharedCommand", "process");
+ exit(1);
+ }
+}
+/**************************************************************************************************/
+int SummarySharedCommand::driver(vector<SharedRAbundVector*> thisLookup, int start, int end, string sumFile, string sumAllFile) {
+ 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