]> git.donarmstrong.com Git - mothur.git/blobdiff - makecontigscommand.cpp
have make contigs use \r instead of \n
[mothur.git] / makecontigscommand.cpp
index 8796ab2113f455b12c8eace90df64d4bbe2c318e..d2ddc06e8af6b9ffa9ac783ca8e2b6f61a612f83 100644 (file)
@@ -690,7 +690,7 @@ int MakeContigsCommand::createProcesses(vector< vector<string> > files, string o
                
                //loop through and create all the processes you want
                while (process != processors-1) {
-                       int pid = fork();
+                       pid_t pid = fork();
                        
                        if (pid > 0) {
                                processIDS.push_back(pid);  //create map from line number to pid so you can append files in correct order later
@@ -704,7 +704,7 @@ int MakeContigsCommand::createProcesses(vector< vector<string> > files, string o
                                        for(int i=0;i<tempFASTAFileNames.size();i++){
                                                for(int j=0;j<tempFASTAFileNames[i].size();j++){
                                                        if (tempFASTAFileNames[i][j] != "") {
-                                                               tempFASTAFileNames[i][j] += toString(getpid()) + ".temp";
+                                                               tempFASTAFileNames[i][j] += m->mothurGetpid(process) + ".temp";
                                                                m->openOutputFile(tempFASTAFileNames[i][j], temp);                      temp.close();
                                                        }
                                                }
@@ -712,14 +712,14 @@ int MakeContigsCommand::createProcesses(vector< vector<string> > files, string o
                                }
                 
                                num = driver(files[process], 
-                             outputFasta + toString(getpid()) + ".temp", 
-                             outputScrapFasta + toString(getpid()) + ".temp", 
-                             outputMisMatches + toString(getpid()) + ".temp",
+                             outputFasta + m->mothurGetpid(process) + ".temp",
+                             outputScrapFasta + m->mothurGetpid(process) + ".temp",
+                             outputMisMatches + m->mothurGetpid(process) + ".temp",
                              tempFASTAFileNames, process, group);
                                
                                //pass groupCounts to parent
                 ofstream out;
-                string tempFile = toString(getpid()) + ".num.temp";
+                string tempFile = m->mothurGetpid(process) + ".num.temp";
                 m->openOutputFile(tempFile, out);
                 out << num << endl;
                                if (createFileGroup || createOligosGroup) {
@@ -1059,7 +1059,8 @@ int MakeContigsCommand::driver(vector<string> files, string outputFasta, string
                     }else { contig += seq1[i]; } //with no quality info, then we keep it?
                 }else if (((seq1[i] != '-') && (seq1[i] != '.')) && ((seq2[i] != '-') && (seq2[i] != '.'))) { //both bases choose one with better quality
                     if (thisfqualfile != "") {
-                        if (abs(scores1[ABaseMap[i]] - scores2[BBaseMap[i]]) >= deltaq) { //is the difference in qual scores >= deltaq, if yes choose base with higher score
+                      if (ABaseMap[i] <= scores1.size() && BBaseMap[i] <= scores2.size() && // this check is dumb; we should determine this earlier
+                          abs(scores1[ABaseMap[i]] - scores2[BBaseMap[i]]) >= deltaq) { //is the difference in qual scores >= deltaq, if yes choose base with higher score
                             char c = seq1[i];
                             if (scores1[ABaseMap[i]] < scores2[BBaseMap[i]]) { c = seq2[i]; }
                             contig += c;
@@ -1143,7 +1144,7 @@ int MakeContigsCommand::driver(vector<string> files, string outputFasta, string
             num++;
             
                        //report progress
-                       if((num) % 1000 == 0){  m->mothurOut(toString(num)); m->mothurOutEndLine();             }
+                       if((num) % 1000 == 0){  m->mothurOutJustToScreen(toString(num)); m->mothurOutEndLine();         }
                }
         
                //report progress
@@ -1289,7 +1290,7 @@ vector< vector<string> > MakeContigsCommand::readFastqFiles(unsigned long int& c
                     count++;
                     
                     //report progress
-                    if((count) % 10000 == 0){  m->mothurOut(toString(count)); m->mothurOutEndLine();           }
+                    if((count) % 10000 == 0){  m->mothurOutJustToScreen(toString(count)); m->mothurOutEndLine();               }
                 //}
             }
                }
@@ -1447,7 +1448,7 @@ vector< vector<string> > MakeContigsCommand::readFastaFiles(unsigned long int& c
             }
                }
                //report progress
-               if((count) % 10000 != 0){       m->mothurOut(toString(count)); m->mothurOutEndLine();           }
+               if((count) % 10000 != 0){       m->mothurOut(toString(count)); m->mothurOut("\r");              }
         
         if (uniques.size() != 0) {
             for (itUniques = uniques.begin(); itUniques != uniques.end(); itUniques++) {