- set<string> blanks;
- for(int i=0;i<fastaFileNames.size();i++){
- if (m->isBlank(fastaFileNames[i])) { blanks.insert(fastaFileNames[i]); }
- else if (filesToRemove.count(fastaFileNames[i]) > 0) { remove(fastaFileNames[i].c_str()); }
- else {
- ifstream inFASTA;
- string seqName;
- m->openInputFile(fastaFileNames[i], inFASTA);
- ofstream outGroups;
- string outGroupFilename = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[i])) + "groups";
-
- //if the fastafile is on the blanks list then the groups file should be as well
- if (blanks.count(fastaFileNames[i]) != 0) { blanks.insert(outGroupFilename); }
+ if(allFiles){
+ map<string, string> uniqueFastaNames;// so we don't add the same groupfile multiple times
+ map<string, string>::iterator it;
+ set<string> namesToRemove;
+ for(int i=0;i<fastaFileNames.size();i++){
+ for(int j=0;j<fastaFileNames[0].size();j++){
+ if (fastaFileNames[i][j] != "") {
+ if(m->isBlank(fastaFileNames[i][j])){
+ remove(fastaFileNames[i][j].c_str());
+ namesToRemove.insert(fastaFileNames[i][j]);
+
+ if(qFileName != ""){
+ remove(qualFileNames[i][j].c_str());
+ namesToRemove.insert(qualFileNames[i][j]);
+ }
+ }else{
+ it = uniqueFastaNames.find(fastaFileNames[i][j]);
+ if (it == uniqueFastaNames.end()) {
+ uniqueFastaNames[fastaFileNames[i][j]] = barcodeNameVector[i];
+ }
+ }
+ }
+ }
+ }
+
+ //remove names for outputFileNames, just cleans up the output
+ vector<string> outputNames2;
+ for(int i = 0; i < outputNames.size(); i++) { if (namesToRemove.count(outputNames[i]) == 0) { outputNames2.push_back(outputNames[i]); } }
+ outputNames = outputNames2;
+
+ for (it = uniqueFastaNames.begin(); it != uniqueFastaNames.end(); it++) {
+ ifstream in;
+ m->openInputFile(it->first, in);