- ifstream inFASTA;
- string seqName;
- openInputFile(getRootName(fastaFile) + groupVector[i] + ".fasta", inFASTA);
- ofstream outGroups;
- openOutputFile(outputDir + getRootName(getSimpleName(fastaFile)) + groupVector[i] + ".groups", outGroups);
- outputNames.push_back(outputDir + getRootName(getSimpleName(fastaFile)) + groupVector[i] + ".groups");
-
- while(!inFASTA.eof()){
- if(inFASTA.get() == '>'){
- inFASTA >> seqName;
- outGroups << seqName << '\t' << groupVector[i] << endl;
+ if (m->isBlank(fastaFileNames[i])) { remove(fastaFileNames[i].c_str()); }
+ 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";
+ m->openOutputFile(outGroupFilename, outGroups);
+ outputNames.push_back(outGroupFilename);
+
+ string thisGroup = "";
+ if (i > comboStarts) {
+ map<string, int>::iterator itCombo;
+ for(itCombo=combos.begin();itCombo!=combos.end(); itCombo++){
+ if(itCombo->second == i){ thisGroup = itCombo->first; combos.erase(itCombo); break; }
+ }
+ }else{ thisGroup = groupVector[i]; }
+
+ while(!inFASTA.eof()){
+ if(inFASTA.get() == '>'){
+ inFASTA >> seqName;
+ outGroups << seqName << '\t' << thisGroup << endl;
+ }
+ while (!inFASTA.eof()) { char c = inFASTA.get(); if (c == 10 || c == 13){ break; } }
+ }
+ outGroups.close();
+ inFASTA.close();
+ }
+ }
+
+ if(qFileName != ""){
+ for(int i=0;i<qualFileNames.size();i++){
+ if (m->isBlank(qualFileNames[i])) { remove(qualFileNames[i].c_str()); }
+ else if (filesToRemove.count(qualFileNames[i]) > 0) { remove(qualFileNames[i].c_str()); }
+ else {
+ ifstream inQual;
+ string seqName;
+ m->openInputFile(qualFileNames[i], inQual);
+// ofstream outGroups;
+//
+// string thisGroup = "";
+// if (i > comboStarts) {
+// map<string, int>::iterator itCombo;
+// for(itCombo=combos.begin();itCombo!=combos.end(); itCombo++){
+// if(itCombo->second == i){ thisGroup = itCombo->first; combos.erase(itCombo); break; }
+// }
+// }
+// else{ thisGroup = groupVector[i]; }
+
+ inQual.close();