Permalink
Browse files

Fixing filenames for group name fix

  • Loading branch information...
1 parent a053acd commit 738f4aa6a533c6918c4411d39283fd2d72f21322 @mothur-westcott mothur-westcott committed Aug 8, 2016
Showing with 8 additions and 3 deletions.
  1. +8 −3 source/commands/sracommand.cpp
@@ -1327,15 +1327,19 @@ int SRACommand::mapGroupToFile(map<string, vector<string> >& files, vector<strin
try {
for (int i = 0; i < Groups.size(); i++) {
+ //correct filename issues if group name contains '-' characters
+ string thisGroup = Groups[i];
+ for (int k = 0; k < thisGroup.length(); k++) { if (thisGroup[k] == '-') { thisGroup[k] = '_'; } }
+
for (int j = 0; j < theseFiles.size(); j++) {
string tempName = m->getSimpleName(theseFiles[j]);
//if ((tempName == "GZGO5KL01.F006D146.sff") || (tempName == "G3BMWHG01.F008D021.sff") || (tempName == "GO2JXTW01.M002D125.sff") || (tempName == "GO5715J01.M003D125.sff")) { cout << Groups[i] << '\t' << theseFiles[j] << endl; }
//cout << i << '\t' << j << '\t' << Groups[i] << '\t' << theseFiles[j] << endl;
- int pos = theseFiles[j].find(Groups[i]);
+ int pos = theseFiles[j].find(thisGroup);
if (pos != string::npos) { //you have a potential match, make sure you dont have a case of partial name
- if (theseFiles[j][pos+Groups[i].length()] == '.') { //final.soil.sff vs final.soil2.sff both would match soil.
- map<string, vector<string> >::iterator it = files.find(Groups[i]);
+ if (theseFiles[j][pos+thisGroup.length()] == '.') { //final.soil.sff vs final.soil2.sff both would match soil.
+ map<string, vector<string> >::iterator it = files.find(thisGroup);
if (it == files.end()) {
vector<string> temp; temp.push_back(theseFiles[j]);
files[Groups[i]] = temp;
@@ -1346,6 +1350,7 @@ int SRACommand::mapGroupToFile(map<string, vector<string> >& files, vector<strin
}
}
}
+
return 0;
}
catch(exception& e) {

0 comments on commit 738f4aa

Please sign in to comment.