]> git.donarmstrong.com Git - mothur.git/blobdiff - trimflowscommand.cpp
changed int to pid_t type in fork(). roughed in get.mimarkscommand.
[mothur.git] / trimflowscommand.cpp
index aebb16b42a6455693b7c491f83b1740c58acd0e0..5800cde2146f108ae6efc3d1bce50b9bb9913750 100644 (file)
@@ -395,7 +395,7 @@ int TrimFlowsCommand::driverCreateTrim(string flowFileName, string trimFlowFileN
                
                if(line->start == 0){
                        flowFile >> numFlows; m->gobble(flowFile);
-                       scrapFlowFile << maxFlows << endl;
+                       scrapFlowFile << numFlows << endl;
                        trimFlowFile << maxFlows << endl;
                        if(allFiles){
                                for(int i=0;i<thisBarcodePrimerComboFileNames.size();i++){
@@ -435,7 +435,11 @@ int TrimFlowsCommand::driverCreateTrim(string flowFileName, string trimFlowFileN
                                success = 0;
                                trashCode += 'l';
                        }
-                       
+            if(!flowData.hasGoodHomoP()){      //screen to see if sequence meets the maximum homopolymer limit
+                               success = 0;
+                               trashCode += 'h';
+                       }
+
                        int primerIndex = 0;
                        int barcodeIndex = 0;
                        
@@ -595,6 +599,7 @@ void TrimFlowsCommand::getOligos(vector<vector<string> >& outFlowFileNames){
                                else if(type == "REVERSE"){
                                        string oligoRC = reverseOligo(oligo);
                                        revPrimer.push_back(oligoRC);
+                    if (m->debug) { m->mothurOut("[DEBUG]: reverse oligos = " + oligoRC + ".\n"); }
                                }
                                else if(type == "BARCODE"){
                                        oligosFile >> group;
@@ -633,8 +638,7 @@ void TrimFlowsCommand::getOligos(vector<vector<string> >& outFlowFileNames){
                        primers[""] = 0;
                        primerNameVector.push_back("");                 
                }
-               
-               
+
                outFlowFileNames.resize(barcodeNameVector.size());
                for(int i=0;i<outFlowFileNames.size();i++){
                        outFlowFileNames[i].assign(primerNameVector.size(), "");
@@ -821,7 +825,7 @@ int TrimFlowsCommand::createProcessesCreateTrim(string flowFileName, string trim
                
                //loop through and create all the processes you want
                while (process != processors) {
-                       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
@@ -833,7 +837,7 @@ int TrimFlowsCommand::createProcessesCreateTrim(string flowFileName, string trim
                                        for(int i=0;i<tempBarcodePrimerComboFileNames.size();i++){
                                                for(int j=0;j<tempBarcodePrimerComboFileNames[0].size();j++){
                             if (tempBarcodePrimerComboFileNames[i][j] != "") {
-                                tempBarcodePrimerComboFileNames[i][j] += toString(getpid()) + ".temp";
+                                tempBarcodePrimerComboFileNames[i][j] += m->mothurGetpid(process) + ".temp";
                                 ofstream temp;
                                 m->openOutputFile(tempBarcodePrimerComboFileNames[i][j], temp);
                                 temp.close();
@@ -842,9 +846,9 @@ int TrimFlowsCommand::createProcessesCreateTrim(string flowFileName, string trim
                                        }
                                }
                                driverCreateTrim(flowFileName,
-                                                                (trimFlowFileName + toString(getpid()) + ".temp"),
-                                                                (scrapFlowFileName + toString(getpid()) + ".temp"),
-                                                                (fastaFileName + toString(getpid()) + ".temp"),
+                                                                (trimFlowFileName + m->mothurGetpid(process) + ".temp"),
+                                                                (scrapFlowFileName + m->mothurGetpid(process) + ".temp"),
+                                                                (fastaFileName + m->mothurGetpid(process) + ".temp"),
                                                                 tempBarcodePrimerComboFileNames, lines[process]);
 
                                exit(0);