]> git.donarmstrong.com Git - mothur.git/blobdiff - screenseqscommand.cpp
added mothurgetpid function. fixed bug with align.seqs related to g++ 4.8 change...
[mothur.git] / screenseqscommand.cpp
index e7b2c6acedf523f8249c8159ed186a6b8d5b8892..4671b7926df8866ea2d3beee6e6706b448047b6d 100644 (file)
@@ -14,7 +14,7 @@
 vector<string> ScreenSeqsCommand::setParameters(){     
        try {
                CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none","fasta",false,true,true); parameters.push_back(pfasta);
-        CommandParameter pcontigsreport("contigsreport", "InputTypes", "", "", "report", "none", "none","contigsreport",false,true,true); parameters.push_back(pcontigsreport);
+        CommandParameter pcontigsreport("contigsreport", "InputTypes", "", "", "report", "none", "none","contigsreport",false,false,true); parameters.push_back(pcontigsreport);
         CommandParameter palignreport("alignreport", "InputTypes", "", "", "report", "none", "none","alignreport",false,false); parameters.push_back(palignreport);
         CommandParameter psummary("summary", "InputTypes", "", "", "report", "none", "none","summary",false,false); parameters.push_back(psummary);
         CommandParameter pname("name", "InputTypes", "", "", "NameCount", "none", "none","name",false,false,true); parameters.push_back(pname);
@@ -683,7 +683,7 @@ int ScreenSeqsCommand::screenReports(map<string, string>& badSeqNames){
             if (namefile != "") { nameMap = m->readNames(namefile); }
             else if (countfile != "") {
                 CountTable ct;
-                ct.readTable(countfile, true);
+                ct.readTable(countfile, true, false);
                 nameMap = ct.getNameMap();
             }
             getSummary(positions); 
@@ -714,7 +714,7 @@ int ScreenSeqsCommand::screenReports(map<string, string>& badSeqNames){
             if (namefile != "") { nameMap = m->readNames(namefile); }
             else if (countfile != "") {
                 CountTable ct;
-                ct.readTable(countfile, true);
+                ct.readTable(countfile, true, false);
                 nameMap = ct.getNameMap();
             }
             getSummaryReport();
@@ -1019,7 +1019,7 @@ int ScreenSeqsCommand::screenFasta(map<string, string>& badSeqNames){
                        if (namefile != "") { nameMap = m->readNames(namefile); }
             else if (countfile != "") {
                 CountTable ct;
-                ct.readTable(countfile, true);
+                ct.readTable(countfile, true, false);
                 nameMap = ct.getNameMap();
             }
                        getSummary(positions); 
@@ -1443,7 +1443,7 @@ int ScreenSeqsCommand::createProcessesContigsSummary(vector<int>& oLength, vecto
                                
                                //pass numSeqs to parent
                                ofstream out;
-                               string tempFile = contigsreport + toString(getpid()) + ".num.temp";
+                               string tempFile = contigsreport + m->mothurGetpid(process) + ".num.temp";
                                m->openOutputFile(tempFile, out);
                                
                                out << num << endl;
@@ -1713,7 +1713,7 @@ int ScreenSeqsCommand::createProcessesAlignSummary(vector<float>& sims, vector<f
                                
                                //pass numSeqs to parent
                                ofstream out;
-                               string tempFile = alignreport + toString(getpid()) + ".num.temp";
+                               string tempFile = alignreport + m->mothurGetpid(process) + ".num.temp";
                                m->openOutputFile(tempFile, out);
                                
                                out << num << endl;
@@ -1996,7 +1996,7 @@ int ScreenSeqsCommand::createProcessesCreateSummary(vector<int>& startPosition,
                                
                                //pass numSeqs to parent
                                ofstream out;
-                               string tempFile = fastafile + toString(getpid()) + ".num.temp";
+                               string tempFile = fastafile + m->mothurGetpid(process) + ".num.temp";
                                m->openOutputFile(tempFile, out);
                                
                                out << num << endl;
@@ -2119,7 +2119,7 @@ int ScreenSeqsCommand::screenGroupFile(map<string, string> badSeqNames){
                while(!inputGroups.eof()){
                        if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); m->mothurRemove(goodGroupFile); return 0; }
 
-                       inputGroups >> seqName; m->gobble(inputGroups); inputGroups >> group;
+                       inputGroups >> seqName; m->gobble(inputGroups); inputGroups >> group; m->gobble(inputGroups);
                        it = badSeqNames.find(seqName);
                        
                        if(it != badSeqNames.end()){
@@ -2128,7 +2128,6 @@ int ScreenSeqsCommand::screenGroupFile(map<string, string> badSeqNames){
                        else{
                                goodGroupOut << seqName << '\t' << group << endl;
                        }
-                       m->gobble(inputGroups);
                }
                
                if (m->control_pressed) { goodGroupOut.close();  inputGroups.close(); m->mothurRemove(goodGroupFile);  return 0; }
@@ -2177,19 +2176,18 @@ int ScreenSeqsCommand::screenCountFile(map<string, string> badSeqNames){
                        if (m->control_pressed) { goodCountOut.close(); in.close(); m->mothurRemove(goodCountFile); return 0; }
             
                        in >> name; m->gobble(in); 
-            in >> thisTotal; m->gobble(in);
+            in >> thisTotal; 
             rest = m->getline(in); m->gobble(in);
             
                        it = badSeqNames.find(name);
                        
                        if(it != badSeqNames.end()){
-                               badSeqNames.erase(it);
+                               badSeqNames.erase(it); 
                        }
                        else{
                                goodCountOut << name << '\t' << thisTotal << '\t' << rest << endl;
                        }
                }
-               
                if (m->control_pressed) { goodCountOut.close();  in.close(); m->mothurRemove(goodCountFile);  return 0; }
         
                //we were unable to remove some of the bad sequences
@@ -2206,7 +2204,7 @@ int ScreenSeqsCommand::screenCountFile(map<string, string> badSeqNames){
         //check for groups that have been eliminated
         CountTable ct;
         if (ct.testGroups(goodCountFile)) {
-            ct.readTable(goodCountFile, true);
+            ct.readTable(goodCountFile, true, false);
             ct.printTable(goodCountFile);
         }
                
@@ -2534,11 +2532,11 @@ int ScreenSeqsCommand::createProcesses(string goodFileName, string badAccnos, st
                                processIDS.push_back(pid);  //create map from line number to pid so you can append files in correct order later
                                process++;
                        }else if (pid == 0){
-                               num = driver(lines[process], goodFileName + toString(getpid()) + ".temp", badAccnos + toString(getpid()) + ".temp", filename, badSeqNames);
+                               num = driver(lines[process], goodFileName + m->mothurGetpid(process) + ".temp", badAccnos + m->mothurGetpid(process) + ".temp", filename, badSeqNames);
                                
                                //pass numSeqs to parent
                                ofstream out;
-                               string tempFile = filename + toString(getpid()) + ".num.temp";
+                               string tempFile = filename + m->mothurGetpid(process) + ".num.temp";
                                m->openOutputFile(tempFile, out);
                                out << num << endl;
                                out.close();