+void UnifracUnweightedCommand::createPhylipFile(int i) {
+ try {
+ string phylipFileName = globaldata->getTreeFile() + toString(i+1) + ".unweighted.dist";
+ ofstream out;
+ openOutputFile(phylipFileName, out);
+
+ //output numSeqs
+ out << globaldata->Groups.size() << endl;
+
+ //make matrix with scores in it
+ vector< vector<float> > dists; dists.resize(globaldata->Groups.size());
+ for (int i = 0; i < globaldata->Groups.size(); i++) {
+ dists[i].resize(globaldata->Groups.size(), 0.0);
+ }
+
+ //flip it so you can print it
+ int count = 0;
+ for (int r=0; r<globaldata->Groups.size(); r++) {
+ for (int l = r+1; l < globaldata->Groups.size(); l++) {
+ dists[r][l] = (1.0 - utreeScores[count][0]);
+ dists[l][r] = (1.0 - utreeScores[count][0]);
+ count++;
+ }
+ }
+
+ //output to file
+ for (int r=0; r<globaldata->Groups.size(); r++) {
+ //output name
+ out << globaldata->Groups[r] << '\t';
+
+ //output distances
+ for (int l = 0; l < r; l++) { out << dists[r][l] << '\t'; }
+ out << endl;
+ }
+ out.close();
+ }
+ catch(exception& e) {
+ errorOut(e, "UnifracUnweightedCommand", "createPhylipFile");
+ exit(1);
+ }
+}
+/***********************************************************/
+