]> git.donarmstrong.com Git - mothur.git/blobdiff - bellerophon.cpp
made classifier faster
[mothur.git] / bellerophon.cpp
index e33230ed8b9949550bf716cb82e4c7bf6a6353ae..54025eb9285c87be35039a3051454cfd763a3c4d 100644 (file)
@@ -132,7 +132,7 @@ int Bellerophon::print(ostream& out, ostream& outAcc) {
 //***************************************************************************************************************
 int Bellerophon::print(MPI_File& out, MPI_File& outAcc) {
        try {
-               
+       
                int pid;
                MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
                
@@ -148,17 +148,26 @@ int Bellerophon::print(MPI_File& out, MPI_File& outAcc) {
 
                        if (m->control_pressed) { return numSeqs; }
                        
-                       outString += "Name\tScore\tLeft\tRight\n";
+                       outString = "Name\tScore\tLeft\tRight\n";
+                       MPI_Status status;
+                       int olength = outString.length();
+                       char* buf5 = new char[olength];
+                       memcpy(buf5, outString.c_str(), olength);
+                                       
+                       MPI_File_write_shared(out, buf5, olength, MPI_CHAR, &status);
+                       
+                       delete buf5;
+
                        //output prefenence structure to .chimeras file
                        for (int i = 0; i < best.size(); i++) {
                                
                                if (m->control_pressed) {  return numSeqs; }
                                
-                               outString += best[i].name + "\t" +  toString(best[i].score) + "\t" + best[i].leftParent + "\t" + best[i].rightParent + "\n";
-                               
+                               outString = best[i].name + "\t" +  toString(best[i].score) + "\t" + best[i].leftParent + "\t" + best[i].rightParent + "\n";
+                       
                                MPI_Status status;
                                int length = outString.length();
-                               char* buf2 = new char[length];\r
+                               char* buf2 = new char[length];
                                memcpy(buf2, outString.c_str(), length);
                                        
                                MPI_File_write_shared(out, buf2, length, MPI_CHAR, &status);
@@ -168,12 +177,12 @@ int Bellerophon::print(MPI_File& out, MPI_File& outAcc) {
                                //calc # of seqs with preference above 95%tile
                                if (best[i].score >= cutoffScore) { 
                                        above1++; 
-                                       string outAccString;
+                                       string outAccString = "";
                                         outAccString += best[i].name + "\n";
                                        
                                        MPI_Status statusAcc;
                                        length = outAccString.length();
-                                       char* buf = new char[length];\r
+                                       char* buf = new char[length];
                                        memcpy(buf, outAccString.c_str(), length);
                                        
                                        MPI_File_write_shared(outAcc, buf, length, MPI_CHAR, &statusAcc);
@@ -291,7 +300,7 @@ int Bellerophon::getChimeras() {
                                if (m->control_pressed) { return 0; }
                                
                                int bestLength = MPIBestSend[i].length();
-                               char* buf = new char[bestLength];\r
+                               char* buf = new char[bestLength];
                                memcpy(buf, MPIBestSend[i].c_str(), bestLength);
                                
                                MPI_Send(&bestLength, 1, MPI_INT, 0, 2001, MPI_COMM_WORLD);