]> git.donarmstrong.com Git - mothur.git/blobdiff - formatcolumn.cpp
added otu.association command. added calcSpearman, calcKendall and calcPearson functi...
[mothur.git] / formatcolumn.cpp
index 2bbcf518b864aa5a5656a271f2922c531e74af11..d43f85d16907d92583ba95069002661253569a6c 100644 (file)
@@ -39,14 +39,14 @@ int FormatColumnMatrix::read(NameAssignment* nameMap){
        
                while(fileHandle && lt == 1){  //let's assume it's a triangular matrix...
                
-                       if (m->control_pressed) { out.close(); remove(tempOutFile.c_str()); fileHandle.close();  delete reading; return 0; }
+                       if (m->control_pressed) { out.close();  m->mothurRemove(tempOutFile); fileHandle.close();  delete reading; return 0; }
                
                        fileHandle >> firstName >> secondName >> distance;      // get the row and column names and distance
        
                        map<string,int>::iterator itA = nameMap->find(firstName);
                        map<string,int>::iterator itB = nameMap->find(secondName);
-                       if(itA == nameMap->end()){      cerr << "AAError: Sequence '" << firstName << "' was not found in the names file, please correct\n"; exit(1);   }
-                       if(itB == nameMap->end()){      cerr << "ABError: Sequence '" << secondName << "' was not found in the names file, please correct\n"; exit(1);  }
+                       if(itA == nameMap->end()){  m->mothurOut("AAError: Sequence '" + firstName + "' was not found in the names file, please correct\n"); exit(1);  }
+                       if(itB == nameMap->end()){  m->mothurOut("ABError: Sequence '" + secondName + "' was not found in the names file, please correct\n"); exit(1);  }
 
                        if (distance == -1) { distance = 1000000; }
                
@@ -90,7 +90,7 @@ int FormatColumnMatrix::read(NameAssignment* nameMap){
                        system(command.c_str());
                #endif
                
-               if (m->control_pressed) { remove(tempOutFile.c_str()); remove(outfile.c_str()); delete reading; return 0; }
+               if (m->control_pressed) { m->mothurRemove(tempOutFile); m->mothurRemove(outfile); delete reading; return 0; }
 
                //output to new file distance for each row and save positions in file where new row begins
                ifstream in;
@@ -115,7 +115,7 @@ int FormatColumnMatrix::read(NameAssignment* nameMap){
                
                while(!in.eof()) {
                        
-                       if (m->control_pressed) { in.close(); out.close(); remove(distFile.c_str()); remove(tempOutFile.c_str()); remove(outfile.c_str()); delete reading; return 0; }
+                       if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(distFile); m->mothurRemove(tempOutFile); m->mothurRemove(outfile); delete reading; return 0; }
                        
                        in >> first >> second >> dist; m->gobble(in);
                        
@@ -159,17 +159,17 @@ int FormatColumnMatrix::read(NameAssignment* nameMap){
                in.close();
                out.close();
                
-               if (m->control_pressed) {  remove(distFile.c_str()); remove(tempOutFile.c_str()); remove(outfile.c_str());  delete reading; return 0; }
+               if (m->control_pressed) {  m->mothurRemove(distFile); m->mothurRemove(tempOutFile); m->mothurRemove(outfile);  delete reading; return 0; }
                
-               remove(tempOutFile.c_str());
-               remove(outfile.c_str());
+               m->mothurRemove(tempOutFile);
+               m->mothurRemove(outfile);
                
                reading->finish();
                
                delete reading;
                list->setLabel("0");
                
-               if (m->control_pressed) {  remove(distFile.c_str());  return 0; }
+               if (m->control_pressed) {  m->mothurRemove(distFile);  return 0; }
 
                return 1;