]> git.donarmstrong.com Git - mothur.git/blobdiff - sffinfocommand.cpp
working on sra and get.mimarkspackage commands. added file parameter to cluster...
[mothur.git] / sffinfocommand.cpp
index 03bcebb591e35b19b10224ff6a4512bdecdf2dbb..26d48320e685d28e94e8e5dc417e875484710b13 100755 (executable)
@@ -677,11 +677,13 @@ int SffInfoCommand::extractSffInfo(string input, string accnos, string oligos){
             //append new header to reads\r
             for (int i = 0; i < filehandles.size(); i++) {\r
                 for (int j = 0; j < filehandles[i].size(); j++) {\r
-                    m->appendBinaryFiles(filehandles[i][j], filehandlesHeaders[i][j]);\r
-                    m->renameFile(filehandlesHeaders[i][j], filehandles[i][j]);\r
-                    m->mothurRemove(filehandlesHeaders[i][j]);\r
-                    //cout << i << '\t' << '\t' << j  << '\t' << filehandles[i][j] << " done appending headers and removing " << filehandlesHeaders[i][j] << endl;\r
-                    if (numSplitReads[i][j] == 0) { m->mothurRemove(filehandles[i][j]); }\r
+                    if (filehandles[i][j] != "") {\r
+                        m->appendBinaryFiles(filehandles[i][j], filehandlesHeaders[i][j]);\r
+                        m->renameFile(filehandlesHeaders[i][j], filehandles[i][j]);\r
+                        m->mothurRemove(filehandlesHeaders[i][j]);\r
+                        //cout << i << '\t' << '\t' << j  << '\t' << filehandles[i][j] << " done appending headers and removing " << filehandlesHeaders[i][j] << endl;\r
+                        if (numSplitReads[i][j] == 0) { m->mothurRemove(filehandles[i][j]); }\r
+                    }\r
                 }\r
             }\r
                        //cout << "here3" << endl;\r
@@ -1260,6 +1262,25 @@ int SffInfoCommand::findGroup(Header header, seqRead read, int& barcode, int& pr
             if(!success)                               {       trashCode += 'r';       }\r
         }\r
 \r
+        if (trashCode.length() == 0) { //is this sequence in the ignore group\r
+            string thisGroup = "";\r
+            \r
+            if(barcodes.size() != 0){\r
+                thisGroup = barcodeNameVector[barcode];\r
+                if (numFPrimers != 0) {\r
+                    if (primerNameVector[primer] != "") {\r
+                        if(thisGroup != "") {\r
+                            thisGroup += "." + primerNameVector[primer];\r
+                        }else {\r
+                            thisGroup = primerNameVector[primer];\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+            \r
+            int pos = thisGroup.find("ignore");\r
+            if (pos != string::npos) {  trashCode += "i"; }\r
+        }\r
         \r
         return trashCode.length();\r
     }\r
@@ -1911,36 +1932,39 @@ bool SffInfoCommand::readOligos(string oligoFile){
                                        string primerName = primerNameVector[itPrimer->second];\r
                                        string barcodeName = barcodeNameVector[itBar->second];\r
                                        \r
-                                       string comboGroupName = "";\r
-                                       string fastaFileName = "";\r
-                                       string qualFileName = "";\r
-                                       string nameFileName = "";\r
-                                       \r
-                                       if(primerName == ""){\r
-                                               comboGroupName = barcodeNameVector[itBar->second];\r
-                                       }\r
-                                       else{\r
-                                               if(barcodeName == ""){\r
-                                                       comboGroupName = primerNameVector[itPrimer->second];\r
-                                               }\r
-                                               else{\r
-                                                       comboGroupName = barcodeNameVector[itBar->second] + "." + primerNameVector[itPrimer->second];\r
-                                               }\r
-                                       }\r
-                                       \r
-                                       ofstream temp;\r
-                    map<string, string> variables;\r
-                    variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(currentFileName));\r
-                    variables["[group]"] = comboGroupName;\r
-                                       string thisFilename = getOutputFileName("sff",variables);\r
-                                       if (uniqueNames.count(thisFilename) == 0) {\r
-                                               outputNames.push_back(thisFilename);\r
-                                               outputTypes["sff"].push_back(thisFilename);\r
-                                               uniqueNames.insert(thisFilename);\r
-                                       }\r
-                                       \r
-                                       filehandles[itBar->second][itPrimer->second] = thisFilename;\r
-                                       temp.open(thisFilename.c_str(), ios::binary);           temp.close();\r
+                    if ((primerName == "ignore") || (barcodeName == "ignore")) { } //do nothing\r
+                    else {\r
+                        string comboGroupName = "";\r
+                        string fastaFileName = "";\r
+                        string qualFileName = "";\r
+                        string nameFileName = "";\r
+                        \r
+                        if(primerName == ""){\r
+                            comboGroupName = barcodeNameVector[itBar->second];\r
+                        }\r
+                        else{\r
+                            if(barcodeName == ""){\r
+                                comboGroupName = primerNameVector[itPrimer->second];\r
+                            }\r
+                            else{\r
+                                comboGroupName = barcodeNameVector[itBar->second] + "." + primerNameVector[itPrimer->second];\r
+                            }\r
+                        }\r
+                        \r
+                        ofstream temp;\r
+                        map<string, string> variables;\r
+                        variables["[filename]"] = outputDir + m->getRootName(m->getSimpleName(currentFileName));\r
+                        variables["[group]"] = comboGroupName;\r
+                        string thisFilename = getOutputFileName("sff",variables);\r
+                        if (uniqueNames.count(thisFilename) == 0) {\r
+                            outputNames.push_back(thisFilename);\r
+                            outputTypes["sff"].push_back(thisFilename);\r
+                            uniqueNames.insert(thisFilename);\r
+                        }\r
+                        \r
+                        filehandles[itBar->second][itPrimer->second] = thisFilename;\r
+                        temp.open(thisFilename.c_str(), ios::binary);          temp.close();\r
+                    }\r
                                }\r
                        }\r
                }\r