]> git.donarmstrong.com Git - mothur.git/blobdiff - chimeracheckcommand.cpp
rewrote metastats command in c++, added mothurRemove function to handle ~ error....
[mothur.git] / chimeracheckcommand.cpp
index 584e9874fd4cea4136d45c184a4c0662973c3b25..2b88eb5736bfd37364461facb043b0db76aa3cfc 100644 (file)
@@ -370,7 +370,7 @@ int ChimeraCheckCommand::execute(){
                                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);
                                
-                               if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);  for (int j = 0; j < outputNames.size(); j++) {    remove(outputNames[j].c_str()); } outputTypes.clear(); delete chimera; return 0;  }
+                               if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);  for (int j = 0; j < outputNames.size(); j++) {    m->mothurRemove(outputNames[j]);        } outputTypes.clear(); delete chimera; return 0;  }
                                
                                if (pid == 0) { //you are the root process 
                                        MPIPos = m->setFilePosFasta(fastaFileNames[i], numSeqs); //fills MPIPos, returns numSeqs
@@ -390,7 +390,7 @@ int ChimeraCheckCommand::execute(){
                                        //align your part
                                        driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, MPIPos);
                                        
-                                       if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);  for (int j = 0; j < outputNames.size(); j++) {    remove(outputNames[j].c_str()); }   outputTypes.clear(); delete chimera; return 0;  }
+                                       if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);  for (int j = 0; j < outputNames.size(); j++) {    m->mothurRemove(outputNames[j]);        }   outputTypes.clear(); delete chimera; return 0;  }
                                        
                                        //wait on chidren
                                        for(int j = 1; j < processors; j++) { 
@@ -410,7 +410,7 @@ int ChimeraCheckCommand::execute(){
                                        //align your part
                                        driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, MPIPos);
                                        
-                                       if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);   for (int j = 0; j < outputNames.size(); j++) {   remove(outputNames[j].c_str()); }  outputTypes.clear(); delete chimera; return 0;  }
+                                       if (m->control_pressed) {  MPI_File_close(&inMPI);  MPI_File_close(&outMPI);   for (int j = 0; j < outputNames.size(); j++) {   m->mothurRemove(outputNames[j]);        }  outputTypes.clear(); delete chimera; return 0;  }
                                        
                                        //tell parent you are done.
                                        char buf[5];
@@ -435,7 +435,7 @@ int ChimeraCheckCommand::execute(){
                                if(processors == 1){
                                        numSeqs = driver(lines[0], outputFileName, fastaFileNames[i]);
                                        
-                                       if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) {        remove(outputNames[j].c_str()); } for (int j = 0; j < lines.size(); j++) {  delete lines[j];  } outputTypes.clear();  lines.clear(); delete chimera; return 0; }
+                                       if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) {        m->mothurRemove(outputNames[j]);        } for (int j = 0; j < lines.size(); j++) {  delete lines[j];  } outputTypes.clear();  lines.clear(); delete chimera; return 0; }
                                                                        
                                }else{
                                        processIDS.resize(0);
@@ -447,11 +447,11 @@ int ChimeraCheckCommand::execute(){
                                        //append output files
                                        for(int j=1;j<processors;j++){
                                                m->appendFiles((outputFileName + toString(processIDS[j]) + ".temp"), outputFileName);
-                                               remove((outputFileName + toString(processIDS[j]) + ".temp").c_str());
+                                               m->mothurRemove((outputFileName + toString(processIDS[j]) + ".temp"));
                                        }
                                        
                                        if (m->control_pressed) { 
-                                               for (int j = 0; j < outputNames.size(); j++) {  remove(outputNames[j].c_str()); } outputTypes.clear();
+                                               for (int j = 0; j < outputNames.size(); j++) {  m->mothurRemove(outputNames[j]);        } outputTypes.clear();
                                                for (int j = 0; j < lines.size(); j++) {  delete lines[j];  }  lines.clear();
                                                delete chimera;
                                                return 0;
@@ -461,7 +461,7 @@ int ChimeraCheckCommand::execute(){
                        #else
                                numSeqs = driver(lines[0], outputFileName, fastaFileNames[i]);
                                
-                               if (m->control_pressed) { for (int j = 0; j < lines.size(); j++) {  delete lines[j];  }  lines.clear(); for (int j = 0; j < outputNames.size(); j++) {  remove(outputNames[j].c_str()); } outputTypes.clear(); delete chimera; return 0; }
+                               if (m->control_pressed) { for (int j = 0; j < lines.size(); j++) {  delete lines[j];  }  lines.clear(); for (int j = 0; j < outputNames.size(); j++) {  m->mothurRemove(outputNames[j]);        } outputTypes.clear(); delete chimera; return 0; }
                        #endif
                #endif          
                        delete chimera;
@@ -636,7 +636,7 @@ int ChimeraCheckCommand::createProcesses(string outputFileName, string filename)
                        string tempFile =  outputFileName + toString(processIDS[i]) + ".num.temp";
                        m->openInputFile(tempFile, in);
                        if (!in.eof()) { int tempNum = 0; in >> tempNum; num += tempNum; }
-                       in.close(); remove(tempFile.c_str());
+                       in.close(); m->mothurRemove(tempFile);
                }
                
                return num;