- for (int k = 0; k < thisLookup.size(); k++) {
- for (int l = k; l < thisLookup.size(); l++) {
- if (k != l) { //we dont need to similiarity of a groups to itself
- //get estimated similarity between 2 groups
-
- if (m->control_pressed) { return 0; }
-
- subset.clear(); //clear out old pair of sharedrabunds
- //add new pair of sharedrabunds
- subset.push_back(thisLookup[k]); subset.push_back(thisLookup[l]);
-
- //if this calc needs all groups to calculate the pair load all groups
- if (matrixCalculators[i]->getNeedsAll()) {
- //load subset with rest of lookup for those calcs that need everyone to calc for a pair
- for (int w = 0; w < thisLookup.size(); w++) {
- if ((w != k) && (w != l)) { subset.push_back(thisLookup[w]); }
- }
- }
-
- data = matrixCalculators[i]->getValues(subset); //saves the calculator outputs
- //save values in similarity matrix
- simMatrix[k][l] = 1.0 - data[0]; //convert similiarity to distance
- simMatrix[l][k] = 1.0 - data[0]; //convert similiarity to distance
+ for (int j = 0; j < calcDists[i].size(); j++) {
+ int row = calcDists[i][j].seq1;
+ int column = calcDists[i][j].seq2;
+ float dist = calcDists[i][j].dist;
+
+ matrix[row][column] = dist;
+ matrix[column][row] = dist;
+ }
+
+ string distFileName = outputDir + m->getRootName(m->getSimpleName(sharedfile)) + matrixCalculators[i]->getName() + "." + thisLookup[0]->getLabel() + "." + output + ".dist";
+ outputNames.push_back(distFileName); outputTypes["phylip"].push_back(distFileName);
+ ofstream outDist;
+ m->openOutputFile(distFileName, outDist);
+ outDist.setf(ios::fixed, ios::floatfield); outDist.setf(ios::showpoint);
+
+ printSims(outDist, matrix);
+
+ outDist.close();
+ }
+
+ return 0;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "MatrixOutputCommand", "process");
+ exit(1);
+ }
+}
+/**************************************************************************************************/
+int MatrixOutputCommand::driver(vector<SharedRAbundVector*> thisLookup, int start, int end, vector< vector<seqDist> >& calcDists) {
+ try {
+
+ 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++) {
+
+ if (k != l) { //we dont need to similiarity of a groups to itself
+ subset.clear(); //clear out old pair of sharedrabunds
+ //add new pair of sharedrabunds
+ subset.push_back(thisLookup[k]); subset.push_back(thisLookup[l]);
+
+ for(int i=0;i<matrixCalculators.size();i++) {
+
+ //if this calc needs all groups to calculate the pair load all groups
+ if (matrixCalculators[i]->getNeedsAll()) {
+ //load subset with rest of lookup for those calcs that need everyone to calc for a pair
+ for (int w = 0; w < thisLookup.size(); w++) {
+ if ((w != k) && (w != l)) { subset.push_back(thisLookup[w]); }