]> git.donarmstrong.com Git - mothur.git/commitdiff
a few modifications for 1.9
authorwestcott <westcott>
Tue, 20 Apr 2010 12:50:01 +0000 (12:50 +0000)
committerwestcott <westcott>
Tue, 20 Apr 2010 12:50:01 +0000 (12:50 +0000)
15 files changed:
aligncommand.cpp
ccode.cpp
chimera.cpp
chimerabellerophoncommand.cpp
chimeraccodecommand.cpp
chimeracheckcommand.cpp
chimeracheckrdp.cpp
chimerapintailcommand.cpp
chimeraslayercommand.cpp
classify.cpp
classifyseqscommand.cpp
distancecommand.cpp
filterseqscommand.cpp
makefile
pintail.cpp

index 38afa3543a0218bcef7602d61a71d9d8e8332f36..37089b669a31e05af705d8be7a003be602c99185 100644 (file)
@@ -267,28 +267,35 @@ int AlignCommand::execute(){
                                int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY; \r
                                int inMode=MPI_MODE_RDONLY; \r
                                \r
-                               char* outAlignFilename = new char[alignFileName.length()];\r
-                               memcpy(outAlignFilename, alignFileName.c_str(), alignFileName.length());\r
-\r
-                               char* outReportFilename = new char[reportFileName.length()];\r
-                               memcpy(outReportFilename, reportFileName.c_str(), reportFileName.length());\r
+                               //char* outAlignFilename = new char[alignFileName.length()];\r
+                               //memcpy(outAlignFilename, alignFileName.c_str(), alignFileName.length());\r
+                               \r
+                               char outAlignFilename[1024];\r
+                               strcpy(outAlignFilename, alignFileName.c_str());\r
 \r
-                               char* outAccnosFilename = new char[accnosFileName.length()];\r
-                               memcpy(outAccnosFilename, accnosFileName.c_str(), accnosFileName.length());\r
+                               //char* outReportFilename = new char[reportFileName.length()];\r
+                               //memcpy(outReportFilename, reportFileName.c_str(), reportFileName.length());\r
+                               \r
+                               char outReportFilename[1024];\r
+                               strcpy(outReportFilename, reportFileName.c_str());\r
 \r
-                               char* inFileName = new char[candidateFileNames[s].length()];\r
-                               memcpy(inFileName, candidateFileNames[s].c_str(), candidateFileNames[s].length());\r
+                               //char* outAccnosFilename = new char[accnosFileName.length()];\r
+                               //memcpy(outAccnosFilename, accnosFileName.c_str(), accnosFileName.length());\r
+                               \r
+                               char outAccnosFilename[1024];\r
+                               strcpy(outAccnosFilename, accnosFileName.c_str());\r
 \r
+                               //char* inFileName = new char[candidateFileNames[s].length()];\r
+                               //memcpy(inFileName, candidateFileNames[s].c_str(), candidateFileNames[s].length());\r
+                               \r
+                               char inFileName[1024];\r
+                               strcpy(inFileName, candidateFileNames[s].c_str());\r
+                               \r
                                MPI_File_open(MPI_COMM_WORLD, inFileName, inMode, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer\r
                                MPI_File_open(MPI_COMM_WORLD, outAlignFilename, outMode, MPI_INFO_NULL, &outMPIAlign);\r
                                MPI_File_open(MPI_COMM_WORLD, outReportFilename, outMode, MPI_INFO_NULL, &outMPIReport);\r
                                MPI_File_open(MPI_COMM_WORLD, outAccnosFilename, outMode, MPI_INFO_NULL, &outMPIAccnos);\r
                                \r
-                               delete outAlignFilename;\r
-                               delete inFileName;\r
-                               delete outReportFilename;\r
-                               delete outAccnosFilename;\r
-\r
                                if (m->control_pressed) { MPI_File_close(&inMPI);  MPI_File_close(&outMPIAlign);  MPI_File_close(&outMPIReport);  MPI_File_close(&outMPIAccnos); return 0; }\r
                                \r
                                if (pid == 0) { //you are the root process \r
index 5fdf5d140fc731bdd714ed56923901a720fcdac9..c27644866c1f1d52c14a6f86b9f2002e9342d720 100644 (file)
--- a/ccode.cpp
+++ b/ccode.cpp
@@ -29,14 +29,17 @@ Ccode::Ccode(string filename, string temp, bool f, string mask, int win, int num
        
        #ifdef USE_MPI
                
-               char* inFileName = new char[mapInfo.length()];\r
-               memcpy(inFileName, mapInfo.c_str(), mapInfo.length());
+               //char* inFileName = new char[mapInfo.length()];
+               //memcpy(inFileName, mapInfo.c_str(), mapInfo.length());
+               
+               char inFileName[1024];
+               strcpy(inFileName, mapInfo.c_str());
                
                int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY;
 
                MPI_File_open(MPI_COMM_WORLD, inFileName, outMode, MPI_INFO_NULL, &outMap);  //comm, filename, mode, info, filepointer
                
-               delete inFileName;
+               //delete inFileName;
 
                int pid;
                MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
@@ -46,7 +49,7 @@ Ccode::Ccode(string filename, string temp, bool f, string mask, int win, int num
                        
                        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(outMap, buf2, length, MPI_CHAR, &status);
@@ -238,7 +241,7 @@ int Ccode::print(MPI_File& out, MPI_File& outAcc) {
                
                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);
@@ -250,7 +253,7 @@ int Ccode::print(MPI_File& out, MPI_File& outAcc) {
                        
                        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);
@@ -272,7 +275,7 @@ int Ccode::printMapping(string& output) {
        try {
                        MPI_Status status;
                        int length = output.length();
-                       char* buf = new char[length];\r
+                       char* buf = new char[length];
                        memcpy(buf, output.c_str(), length);
                                
                        MPI_File_write_shared(outMap, buf, length, MPI_CHAR, &status);
index 83d40fe8342558eacb598525862364dba0f7e5ca..b513075b4782167ce3f14b74df4f31a6f76b9529 100644 (file)
@@ -109,11 +109,14 @@ vector<Sequence*> Chimera::readSeqs(string file) {
                        MPI_File inMPI;
                        MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
 
-                       char* inFileName = new char[file.length()];
-                       memcpy(inFileName, file.c_str(), file.length());
+                       //char* inFileName = new char[file.length()];
+                       //memcpy(inFileName, file.c_str(), file.length());
+                       
+                       char inFileName[1024];
+                       strcpy(inFileName, file.c_str());
        
                        MPI_File_open(MPI_COMM_WORLD, inFileName, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer
-                       delete inFileName;
+                       //delete inFileName;
 
                        if (pid == 0) {
                                positions = setFilePosFasta(file, numSeqs); //fills MPIPos, returns numSeqs
@@ -199,13 +202,16 @@ void Chimera::setMask(string filename) {
                        MPI_Offset size;
                        MPI_Status status;
                        
-                       char* inFileName = new char[filename.length()];
-                       memcpy(inFileName, filename.c_str(), filename.length());
+                       //char* inFileName = new char[filename.length()];
+                       //memcpy(inFileName, filename.c_str(), filename.length());
+                       
+                       char inFileName[1024];
+                       strcpy(inFileName, filename.c_str());
        
                        MPI_File_open(MPI_COMM_WORLD, inFileName, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer
                        MPI_File_get_size(inMPI, &size);
 
-                       delete inFileName;
+                       //delete inFileName;
                        
                        char* buffer = new char[size];
                        MPI_File_read(inMPI, buffer, size, MPI_CHAR, &status);
index 69eb89533b4988e598c000b8bf5b8a111e07e5e1..67f6b57be1a64f9ae760c86258cea67cdbd62f02 100644 (file)
@@ -136,18 +136,23 @@ int ChimeraBellerophonCommand::execute(){
                
                int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY; 
                                                
-               char* outFilename = new char[accnosFileName.length()];\r
-               memcpy(outFilename, accnosFileName.c_str(), accnosFileName.length());
-
-               char* FileName = new char[outputFileName.length()];\r
-               memcpy(FileName, outputFileName.c_str(), outputFileName.length());
+               //char* outFilename = new char[accnosFileName.length()];
+               //memcpy(outFilename, accnosFileName.c_str(), accnosFileName.length());
+               
+               char outFilename[1024];
+               strcpy(outFilename, accnosFileName.c_str());
 
+               //char* FileName = new char[outputFileName.length()];
+               //memcpy(FileName, outputFileName.c_str(), outputFileName.length());
+               
+               char FileName[1024];
+               strcpy(FileName, outputFileName.c_str());
 
                MPI_File_open(MPI_COMM_WORLD, FileName, outMode, MPI_INFO_NULL, &outMPI);  //comm, filename, mode, info, filepointer
                MPI_File_open(MPI_COMM_WORLD, outFilename, outMode, MPI_INFO_NULL, &outMPIAccnos);
                
-               delete FileName;
-               delete outFilename;
+               //delete FileName;
+               //delete outFilename;
 
                numSeqs = chimera->print(outMPI, outMPIAccnos);
                
index 6958c00187ba5a41bec3db7ceb9b3fe25deb5005..0b96f2172359efc9b7ed5ab5c9dcc15e7223dbbc 100644 (file)
@@ -191,22 +191,31 @@ int ChimeraCcodeCommand::execute(){
                        int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY; 
                        int inMode=MPI_MODE_RDONLY; 
 
-                       char* outFilename = new char[outputFileName.length()];\r
-                       memcpy(outFilename, outputFileName.c_str(), outputFileName.length());
+                       //char* outFilename = new char[outputFileName.length()];
+                       //memcpy(outFilename, outputFileName.c_str(), outputFileName.length());
                        
-                       char* outAccnosFilename = new char[accnosFileName.length()];\r
-                       memcpy(outAccnosFilename, accnosFileName.c_str(), accnosFileName.length());
+                       char outFilename[1024];
+                       strcpy(outFilename, outputFileName.c_str());
+                       
+                       //char* outAccnosFilename = new char[accnosFileName.length()];
+                       //memcpy(outAccnosFilename, accnosFileName.c_str(), accnosFileName.length());
+                       
+                       char outAccnosFilename[1024];
+                       strcpy(outAccnosFilename, accnosFileName.c_str());
 
-                       char* inFileName = new char[fastafile.length()];\r
-                       memcpy(inFileName, fastafile.c_str(), fastafile.length());
+                       //char* inFileName = new char[fastafile.length()];
+                       //memcpy(inFileName, fastafile.c_str(), fastafile.length());
+                       
+                       char inFileName[1024];
+                       strcpy(inFileName, fastafile.c_str());
 
                        MPI_File_open(MPI_COMM_WORLD, inFileName, inMode, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer
                        MPI_File_open(MPI_COMM_WORLD, outFilename, outMode, MPI_INFO_NULL, &outMPI);
                        MPI_File_open(MPI_COMM_WORLD, outAccnosFilename, outMode, MPI_INFO_NULL, &outMPIAccnos);
                        
-                       delete inFileName;
-                       delete outFilename;
-                       delete outAccnosFilename;
+                       //delete inFileName;
+                       //delete outFilename;
+                       //delete outAccnosFilename;
 
                        if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);   MPI_File_close(&outMPIAccnos);  delete chimera; return 0;  }
                
@@ -215,7 +224,7 @@ int ChimeraCcodeCommand::execute(){
                                
                                //print header
                                int length = outTemp.length();
-                               char* buf2 = new char[length];\r
+                               char* buf2 = new char[length];
                                memcpy(buf2, outTemp.c_str(), length);
 
                                MPI_File_write_shared(outMPI, buf2, length, MPI_CHAR, &status);
@@ -499,7 +508,7 @@ int ChimeraCcodeCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File
                        //read next sequence
                        int length = MPIPos[start+i+1] - MPIPos[start+i];
        
-                       char* buf4 = new char[length];\r
+                       char* buf4 = new char[length];
                                
                        MPI_File_read_at(inMPI, MPIPos[start+i], buf4, length, MPI_CHAR, &status);
                        
index fe919dea41de925a5d27227f3805de3e156f9128..625314a8f6a622618b5af87d8bc5889ee3fe8a3e 100644 (file)
@@ -167,17 +167,23 @@ int ChimeraCheckCommand::execute(){
                        int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY; 
                        int inMode=MPI_MODE_RDONLY; 
                        
-                       char* outFilename = new char[outputFileName.length()];\r
-                       memcpy(outFilename, outputFileName.c_str(), outputFileName.length());
+                       //char* outFilename = new char[outputFileName.length()];
+                       //memcpy(outFilename, outputFileName.c_str(), outputFileName.length());
+                       
+                       char outFilename[1024];
+                       strcpy(outFilename, outputFileName.c_str());
 
-                       char* inFileName = new char[fastafile.length()];\r
-                       memcpy(inFileName, fastafile.c_str(), fastafile.length());
+                       //char* inFileName = new char[fastafile.length()];
+                       //memcpy(inFileName, fastafile.c_str(), fastafile.length());
+                       
+                       char inFileName[1024];
+                       strcpy(inFileName, fastafile.c_str());
 
                        MPI_File_open(MPI_COMM_WORLD, inFileName, inMode, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer
                        MPI_File_open(MPI_COMM_WORLD, outFilename, outMode, MPI_INFO_NULL, &outMPI);
                        
-                       delete outFilename;
-                       delete inFileName;
+                       //delete outFilename;
+                       //delete inFileName;
 
                        if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);  delete chimera; return 0;  }
                        
index cb101b6af9dd8d0c412a69067597d9a022f2e623..4c93c1b97c5c7edd2a583cb449cf34440be2a324 100644 (file)
@@ -97,7 +97,7 @@ int ChimeraCheckRDP::print(MPI_File& out, MPI_File& outAcc) {
                
                MPI_Status status;
                int length = outString.length();
-               char* buf = new char[length];\r
+               char* buf = new char[length];
                memcpy(buf, outString.c_str(), length);
                                
                MPI_File_write_shared(out, buf, length, MPI_CHAR, &status);
@@ -263,13 +263,16 @@ void ChimeraCheckRDP::readName(string namefile) {
                MPI_Offset size;
                MPI_Status status;
 
-               char* inFileName = new char[namefile.length()];\r
-               memcpy(inFileName, namefile.c_str(), namefile.length());
+               //char* inFileName = new char[namefile.length()];
+               //memcpy(inFileName, namefile.c_str(), namefile.length());
+               
+               char inFileName[1024];
+               strcpy(inFileName, namefile.c_str());
 
                MPI_File_open(MPI_COMM_WORLD, inFileName, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);  
                MPI_File_get_size(inMPI, &size);
 
-               delete inFileName;
+               //delete inFileName;
 
                char* buffer = new char[size];
                MPI_File_read(inMPI, buffer, size, MPI_CHAR, &status);
@@ -352,12 +355,15 @@ void ChimeraCheckRDP::makeSVGpic(vector<sim> info) {
                MPI_File outSVG;
                int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY;
 
-               char* FileName = new char[file.length()];\r
-               memcpy(FileName, file.c_str(), file.length());
+               //char* FileName = new char[file.length()];
+               //memcpy(FileName, file.c_str(), file.length());
                
+               char FileName[1024];
+               strcpy(FileName, file.c_str());
+
                MPI_File_open(MPI_COMM_SELF, FileName, outMode, MPI_INFO_NULL, &outSVG);  //comm, filename, mode, info, filepointer
                
-               delete FileName;
+               //delete FileName;
 
                int width = (info.size()*5) + 150;
                
@@ -404,7 +410,7 @@ void ChimeraCheckRDP::makeSVGpic(vector<sim> info) {
                
                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(outSVG, buf2, length, MPI_CHAR, &status);
index 40a161036de19d7cbff03bbeb5a631a90d1caa02..384c88513f06f9bdf8a738a62cb2a11cf6596661 100644 (file)
@@ -217,22 +217,31 @@ int ChimeraPintailCommand::execute(){
                        int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY; 
                        int inMode=MPI_MODE_RDONLY; 
                        
-                       char* outFilename = new char[outputFileName.length()];\r
-                       memcpy(outFilename, outputFileName.c_str(), outputFileName.length());
+                       //char* outFilename = new char[outputFileName.length()];
+                       //memcpy(outFilename, outputFileName.c_str(), outputFileName.length());
                        
-                       char* outAccnosFilename = new char[accnosFileName.length()];\r
-                       memcpy(outAccnosFilename, accnosFileName.c_str(), accnosFileName.length());
+                       char outFilename[1024];
+                       strcpy(outFilename, outputFileName.c_str());
+                       
+                       //char* outAccnosFilename = new char[accnosFileName.length()];
+                       //memcpy(outAccnosFilename, accnosFileName.c_str(), accnosFileName.length());
+                       
+                       char outAccnosFilename[1024];
+                       strcpy(outAccnosFilename, accnosFileName.c_str());
 
-                       char* inFileName = new char[fastafile.length()];\r
-                       memcpy(inFileName, fastafile.c_str(), fastafile.length());
+                       //char* inFileName = new char[fastafile.length()];
+                       //memcpy(inFileName, fastafile.c_str(), fastafile.length());
+                       
+                       char inFileName[1024];
+                       strcpy(inFileName, fastafile.c_str());
 
                        MPI_File_open(MPI_COMM_WORLD, inFileName, inMode, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer
                        MPI_File_open(MPI_COMM_WORLD, outFilename, outMode, MPI_INFO_NULL, &outMPI);
                        MPI_File_open(MPI_COMM_WORLD, outAccnosFilename, outMode, MPI_INFO_NULL, &outMPIAccnos);
                        
-                       delete inFileName;
-                       delete outFilename;
-                       delete outAccnosFilename;
+                       //delete inFileName;
+                       //delete outFilename;
+                       //delete outAccnosFilename;
 
                        if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);   MPI_File_close(&outMPIAccnos);  delete chimera; return 0;  }
 
index 4b309c0124a2038cb49db3980345e10e535ce84d..8bb8c2c5e53a860939e092f23ebb5853e5186b44 100644 (file)
@@ -217,22 +217,31 @@ int ChimeraSlayerCommand::execute(){
                        int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY; 
                        int inMode=MPI_MODE_RDONLY; 
                        
-                       char* outFilename = new char[outputFileName.length()];
-                       memcpy(outFilename, outputFileName.c_str(), outputFileName.length());
+                       //char* outFilename = new char[outputFileName.length()];
+                       //memcpy(outFilename, outputFileName.c_str(), outputFileName.length());
                        
-                       char* outAccnosFilename = new char[accnosFileName.length()];
-                       memcpy(outAccnosFilename, accnosFileName.c_str(), accnosFileName.length());
+                       char outFilename[1024];
+                       strcpy(outFilename, outputFileName.c_str());
+                       
+                       //char* outAccnosFilename = new char[accnosFileName.length()];
+                       //memcpy(outAccnosFilename, accnosFileName.c_str(), accnosFileName.length());
+                       
+                       char outAccnosFilename[1024];
+                       strcpy(outAccnosFilename, accnosFileName.c_str());
 
-                       char* inFileName = new char[fastafile.length()];
-                       memcpy(inFileName, fastafile.c_str(), fastafile.length());
+                       //char* inFileName = new char[fastafile.length()];
+                       //memcpy(inFileName, fastafile.c_str(), fastafile.length());
+                       
+                       char inFileName[1024];
+                       strcpy(inFileName, fastafile.c_str());
 
                        MPI_File_open(MPI_COMM_WORLD, inFileName, inMode, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer
                        MPI_File_open(MPI_COMM_WORLD, outFilename, outMode, MPI_INFO_NULL, &outMPI);
                        MPI_File_open(MPI_COMM_WORLD, outAccnosFilename, outMode, MPI_INFO_NULL, &outMPIAccnos);
                        
-                       delete inFileName;
-                       delete outFilename;
-                       delete outAccnosFilename;
+                       //delete inFileName;
+                       //delete outFilename;
+                       //delete outAccnosFilename;
 
                        if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);   MPI_File_close(&outMPIAccnos);  delete chimera; return 0;  }
                
index f09cbf5da8a59b9446e91542c7b48a5a1fd22bc3..c3e52abc5bcd9347853945346ee12cf641a268e3 100644 (file)
@@ -32,11 +32,14 @@ Classify::Classify(string tfile, string tempFile, string method, int kmerSize, f
                        MPI_File inMPI;\r
                        MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are\r
 \r
-                       char* inFileName = new char[tempFile.length()];\r
-                       memcpy(inFileName, tempFile.c_str(), tempFile.length());\r
-       \r
+                       //char* inFileName = new char[tempFile.length()];\r
+                       //memcpy(inFileName, tempFile.c_str(), tempFile.length());\r
+                       \r
+                       char inFileName[1024];\r
+                       strcpy(inFileName, tempFile.c_str());\r
+\r
                        MPI_File_open(MPI_COMM_WORLD, inFileName, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer\r
-                       delete inFileName;\r
+                       //delete inFileName;\r
 \r
                        if (pid == 0) { //only one process needs to scan file\r
                                positions = setFilePosFasta(tempFile, numSeqs); //fills MPIPos, returns numSeqs\r
@@ -171,11 +174,14 @@ void Classify::readTaxonomy(string file) {
                MPI_File inMPI;\r
                MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are\r
 \r
-               char* inFileName = new char[file.length()];\r
-               memcpy(inFileName, file.c_str(), file.length());\r
+               //char* inFileName = new char[file.length()];\r
+               //memcpy(inFileName, file.c_str(), file.length());\r
                \r
+               char inFileName[1024];\r
+               strcpy(inFileName, file.c_str());\r
+\r
                MPI_File_open(MPI_COMM_WORLD, inFileName, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer\r
-               delete inFileName;\r
+               //delete inFileName;\r
 \r
                if (pid == 0) {\r
                        positions = setFilePosEachLine(file, num);\r
index e4fcb2b9b61c926dfe996d5c643934cc9a926739..bed65806ca72aecc1c26536e1dcbbe6d74b8b67b 100644 (file)
@@ -328,22 +328,31 @@ int ClassifySeqsCommand::execute(){
                                int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY; 
                                int inMode=MPI_MODE_RDONLY; 
                                
-                               char* outNewTax = new char[newTaxonomyFile.length()];\r
-                               memcpy(outNewTax, newTaxonomyFile.c_str(), newTaxonomyFile.length());
-                       
-                               char* outTempTax = new char[tempTaxonomyFile.length()];\r
-                               memcpy(outTempTax, tempTaxonomyFile.c_str(), tempTaxonomyFile.length());
+                               //char* outNewTax = new char[newTaxonomyFile.length()];
+                               //memcpy(outNewTax, newTaxonomyFile.c_str(), newTaxonomyFile.length());
+                               
+                               char outNewTax[1024];
+                               strcpy(outNewTax, newTaxonomyFile.c_str());
+
+                               //char* outTempTax = new char[tempTaxonomyFile.length()];
+                               //memcpy(outTempTax, tempTaxonomyFile.c_str(), tempTaxonomyFile.length());
+                               
+                               char outTempTax[1024];
+                               strcpy(outTempTax, tempTaxonomyFile.c_str());
 
-                               char* inFileName = new char[fastaFileNames[s].length()];\r
-                               memcpy(inFileName, fastaFileNames[s].c_str(), fastaFileNames[s].length());
+                               //char* inFileName = new char[fastaFileNames[s].length()];
+                               //memcpy(inFileName, fastaFileNames[s].c_str(), fastaFileNames[s].length());
+                               
+                               char inFileName[1024];
+                               strcpy(inFileName, fastaFileNames[s].c_str());
 
                                MPI_File_open(MPI_COMM_WORLD, inFileName, inMode, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer
                                MPI_File_open(MPI_COMM_WORLD, outNewTax, outMode, MPI_INFO_NULL, &outMPINewTax);
                                MPI_File_open(MPI_COMM_WORLD, outTempTax, outMode, MPI_INFO_NULL, &outMPITempTax);
                                
-                               delete outNewTax;
-                               delete outTempTax;
-                               delete inFileName;
+                               //delete outNewTax;
+                               //delete outTempTax;
+                               //delete inFileName;
 
                                if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPINewTax);   MPI_File_close(&outMPITempTax);  delete classify; return 0;  }
 
@@ -758,7 +767,7 @@ int ClassifySeqsCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File
                                        }
                                        
                                        int length = outputString.length();
-                                       char* buf2 = new char[length];\r
+                                       char* buf2 = new char[length];
                                        memcpy(buf2, outputString.c_str(), length);
                                
                                        MPI_File_write_shared(newFile, buf2, length, MPI_CHAR, &statusNew);
@@ -766,7 +775,7 @@ int ClassifySeqsCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_File
 
                                        outputString =  candidateSeq->getName() + "\t" + classify->getSimpleTax() + "\n";
                                        length = outputString.length();
-                                       char* buf = new char[length];\r
+                                       char* buf = new char[length];
                                        memcpy(buf, outputString.c_str(), length);
                                
                                        MPI_File_write_shared(tempFile, buf, length, MPI_CHAR, &statusTemp);
@@ -799,12 +808,15 @@ int ClassifySeqsCommand::MPIReadNamesFile(string nameFilename){
                MPI_Offset size;
                MPI_Status status;
 
-               char* inFileName = new char[nameFilename.length()];\r
-               memcpy(inFileName, nameFilename.c_str(), nameFilename.length());
+               //char* inFileName = new char[nameFilename.length()];
+               //memcpy(inFileName, nameFilename.c_str(), nameFilename.length());
+               
+               char inFileName[1024];
+               strcpy(inFileName, nameFilename.c_str());
 
                MPI_File_open(MPI_COMM_WORLD, inFileName, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);  
                MPI_File_get_size(inMPI, &size);
-               delete inFileName;
+               //delete inFileName;
 
                char* buffer = new char[size];
                MPI_File_read(inMPI, buffer, size, MPI_CHAR, &status);
index 58302ddfbbc9e07de80747544217e79937c387ba..10a99dd240ee862884d59b8570581ebbe129ef32 100644 (file)
@@ -200,11 +200,14 @@ int DistanceCommand::execute(){
                        MPI_File outMPI;
                        int amode=MPI_MODE_CREATE|MPI_MODE_WRONLY; 
 
-                       char* filename = new char[outputFile.length()];\r
-                       memcpy(filename, outputFile.c_str(), outputFile.length());
+                       //char* filename = new char[outputFile.length()];
+                       //memcpy(filename, outputFile.c_str(), outputFile.length());
+                       
+                       char filename[1024];
+                       strcpy(filename, outputFile.c_str());
                        
                        MPI_File_open(MPI_COMM_WORLD, filename, amode, MPI_INFO_NULL, &outMPI);
-                       delete filename;
+                       //delete filename;
 
                        if (pid == 0) { //you are the root process 
                        
@@ -249,11 +252,14 @@ int DistanceCommand::execute(){
                                MPI_File outMPI;
                                MPI_File inMPI;
 
-                               char* filename = new char[outputFile.length()];\r
-                               memcpy(filename, outputFile.c_str(), outputFile.length());
-                       
+                               //char* filename = new char[outputFile.length()];
+                               //memcpy(filename, outputFile.c_str(), outputFile.length());
+                               
+                               char filename[1024];
+                               strcpy(filename, outputFile.c_str());
+
                                MPI_File_open(MPI_COMM_SELF, filename, amode, MPI_INFO_NULL, &outMPI);
-                               delete filename;
+                               //delete filename;
 
                                //wait on chidren
                                for(int b = 1; b < processors; b++) { 
@@ -265,7 +271,7 @@ int DistanceCommand::execute(){
                                        
                                        string outTemp = outputFile + toString(b) + ".temp";
 
-                                       char* buf = new char[outTemp.length()];\r
+                                       char* buf = new char[outTemp.length()];
                                        memcpy(buf, outTemp.c_str(), outTemp.length());
                                        
                                        MPI_File_open(MPI_COMM_SELF, buf, MPI_MODE_DELETE_ON_CLOSE|MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);
@@ -488,7 +494,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, MPI_File& outMPI, flo
                        //send results to parent
                        int length = outputString.length();
 
-                       char* buf = new char[length];\r
+                       char* buf = new char[length];
                        memcpy(buf, outputString.c_str(), length);
                        
                        MPI_File_write_shared(outMPI, buf, length, MPI_CHAR, &status);
@@ -515,11 +521,14 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, long& si
                MPI_File outMPI;
                int amode=MPI_MODE_CREATE|MPI_MODE_WRONLY; 
 
-               char* filename = new char[file.length()];\r
-               memcpy(filename, file.c_str(), file.length());
+               //char* filename = new char[file.length()];
+               //memcpy(filename, file.c_str(), file.length());
                
+               char filename[1024];
+               strcpy(filename, file.c_str());
+
                MPI_File_open(MPI_COMM_SELF, filename, amode, MPI_INFO_NULL, &outMPI);
-               delete filename;
+               //delete filename;
 
                int startTime = time(NULL);
                
@@ -557,7 +566,7 @@ int DistanceCommand::driverMPI(int startLine, int endLine, string file, long& si
                        
                        //send results to parent
                        int length = outputString.length();
-                       char* buf = new char[length];\r
+                       char* buf = new char[length];
                        memcpy(buf, outputString.c_str(), length);
                        
                        MPI_File_write(outMPI, buf, length, MPI_CHAR, &status);
index c94bf65f9e586eab7e99fc4bad2b0197cae54140..b64e2f530ff91af78cc69dea71b9d2f53f3f981b 100644 (file)
@@ -256,17 +256,23 @@ int FilterSeqsCommand::filterSequences() {
                                int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY; 
                                int inMode=MPI_MODE_RDONLY; 
                                
-                               char* outFilename = new char[filteredFasta.length()];\r
-                               memcpy(outFilename, filteredFasta.c_str(), filteredFasta.length());
+                               //char* outFilename = new char[filteredFasta.length()];
+                               //memcpy(outFilename, filteredFasta.c_str(), filteredFasta.length());
+                               
+                               char outFilename[1024];
+                               strcpy(outFilename, filteredFasta.c_str());
 
-                               char* inFileName = new char[fastafileNames[s].length()];\r
-                               memcpy(inFileName, fastafileNames[s].c_str(), fastafileNames[s].length());
+                               //char* inFileName = new char[fastafileNames[s].length()];
+                               //memcpy(inFileName, fastafileNames[s].c_str(), fastafileNames[s].length());
+                               
+                               char inFileName[1024];
+                               strcpy(inFileName, fastafileNames[s].c_str());
                                
                                MPI_File_open(MPI_COMM_WORLD, inFileName, inMode, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer
                                MPI_File_open(MPI_COMM_WORLD, outFilename, outMode, MPI_INFO_NULL, &outMPI);
                                
-                               delete inFileName;
-                               delete outFilename;
+                               //delete inFileName;
+                               //delete outFilename;
 
                                if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);  return 0;  }
 
@@ -409,7 +415,7 @@ int FilterSeqsCommand::driverMPIRun(int start, int num, MPI_File& inMPI, MPI_Fil
                                if(count % 10 == 0){ //output to file 
                                        //send results to parent
                                        int length = outputString.length();
-                                       char* buf = new char[length];\r
+                                       char* buf = new char[length];
                                        memcpy(buf, outputString.c_str(), length);
                                
                                        MPI_File_write_shared(outMPI, buf, length, MPI_CHAR, &status);
@@ -425,7 +431,7 @@ int FilterSeqsCommand::driverMPIRun(int start, int num, MPI_File& inMPI, MPI_Fil
                if(outputString != ""){ //output to file 
                        //send results to parent
                        int length = outputString.length();
-                       char* buf = new char[length];\r
+                       char* buf = new char[length];
                        memcpy(buf, outputString.c_str(), length);
                        
                        MPI_File_write_shared(outMPI, buf, length, MPI_CHAR, &status);
@@ -554,8 +560,11 @@ string FilterSeqsCommand::createFilter() {
                                MPI_Comm_size(MPI_COMM_WORLD, &processors);
                                MPI_Comm_rank(MPI_COMM_WORLD, &pid); 
                                                        
-                               char* tempFileName = new char(fastafileNames[s].length());
-                               tempFileName = &(fastafileNames[s][0]);
+                               //char* tempFileName = new char(fastafileNames[s].length());
+                               //tempFileName = &(fastafileNames[s][0]);
+                               
+                               char tempFileName[1024];
+                               strcpy(tempFileName, fastafileNames[s].c_str());
                
                                MPI_File_open(MPI_COMM_WORLD, tempFileName, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer
                                
index d95b5ef31c04f2e119136d2cc0d146bb2343397b..d62f0290e5c9dce0b4d8100a6e92940ccca2e1df 100644 (file)
--- a/makefile
+++ b/makefile
@@ -10,7 +10,7 @@
 # Macros\r
 #\r
 \r
-CC = g++\r
+CC = mpic++\r
 CC_OPTIONS = -O3\r
 \r
 # if you do not want to use the readline library set to no, default yes.\r
@@ -26,7 +26,7 @@ ifeq  ($(strip $(USEREADLINE)),yes)
       -L../readline-6.0\r
 endif\r
 \r
-USEMPI ?= no\r
+USEMPI ?= yes\r
 \r
 ifeq  ($(strip $(USEMPI)),yes)\r
     CC_OPTIONS += -DUSE_MPI\r
index 1122c242d35e4a5891e87ac3aeaaaced048a9a56..0050a43f0d926094b0d9f969a21e6c2c306ab1f6 100644 (file)
@@ -310,7 +310,7 @@ int Pintail::print(MPI_File& out, MPI_File& outAcc) {
                        
                        MPI_Status statusAcc;
                        int 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);
@@ -330,7 +330,7 @@ int Pintail::print(MPI_File& out, MPI_File& outAcc) {
                
                MPI_Status status;
                int length = outputString.length();
-               char* buf2 = new char[length];\r
+               char* buf2 = new char[length];
                memcpy(buf2, outputString.c_str(), length);
                                
                MPI_File_write_shared(out, buf2, length, MPI_CHAR, &status);
@@ -427,12 +427,15 @@ vector<float> Pintail::readFreq() {
                MPI_Offset size;
                MPI_Status status;
 
-               char* inFileName = new char[consfile.length()];\r
-               memcpy(inFileName, consfile.c_str(), consfile.length());
+               //char* inFileName = new char[consfile.length()];
+               //memcpy(inFileName, consfile.c_str(), consfile.length());
+               
+               char inFileName[1024];
+               strcpy(inFileName, consfile.c_str());
 
                MPI_File_open(MPI_COMM_WORLD, inFileName, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);  
                MPI_File_get_size(inMPI, &size);
-               delete inFileName;
+               //delete inFileName;
 
                char* buffer = new char[size];
                MPI_File_read(inMPI, buffer, size, MPI_CHAR, &status);
@@ -625,12 +628,15 @@ vector< vector<float> > Pintail::readQuantiles() {
                MPI_Offset size;
                MPI_Status status;
                
-               char* inFileName = new char[quanfile.length()];\r
-               memcpy(inFileName, quanfile.c_str(), quanfile.length());
+               //char* inFileName = new char[quanfile.length()];
+               //memcpy(inFileName, quanfile.c_str(), quanfile.length());
+               
+               char inFileName[1024];
+               strcpy(inFileName, quanfile.c_str());
 
                MPI_File_open(MPI_COMM_WORLD, inFileName, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);  
                MPI_File_get_size(inMPI, &size);
-               delete inFileName;
+               //delete inFileName;
 
 
                char* buffer = new char[size];
@@ -708,14 +714,17 @@ void Pintail::printQuanFile(string file, string outputString) {
 
                        int outMode=MPI_MODE_CREATE|MPI_MODE_WRONLY;
 
-                       char* FileName = new char[file.length()];\r
-                       memcpy(FileName, file.c_str(), file.length());
+                       //char* FileName = new char[file.length()];
+                       //memcpy(FileName, file.c_str(), file.length());
+                       
+                       char FileName[1024];
+                       strcpy(FileName, file.c_str());
                        
                        if (pid == 0) {
                                MPI_File_open(MPI_COMM_SELF, FileName, outMode, MPI_INFO_NULL, &outQuan);  //comm, filename, mode, info, filepointer
                                
                                int length = outputString.length();
-                               char* buf = new char[length];\r
+                               char* buf = new char[length];
                                memcpy(buf, outputString.c_str(), length);
                                        
                                MPI_File_write(outQuan, buf, length, MPI_CHAR, &status);
@@ -724,7 +733,7 @@ void Pintail::printQuanFile(string file, string outputString) {
                                MPI_File_close(&outQuan);
                        }
 
-                       delete FileName;
+                       //delete FileName;
                #else
                        ofstream outQuan;
                        openOutputFile(file, outQuan);