]> git.donarmstrong.com Git - mothur.git/blobdiff - trimseqscommand.h
changed reading of name file to use buffered reads. note the splitAtWhiteSpace functi...
[mothur.git] / trimseqscommand.h
index ba4e61411b8498820139e8ae2b1ed71cb37b0432..e280c8a1d4b50336f125dda5788d91d2af76c09a 100644 (file)
@@ -413,11 +413,13 @@ static DWORD WINAPI MyTrimThreadFunction(LPVOID lpParam){
                                                        
                                                        outGroupsFile << currSeq.getName() << '\t' << thisGroup << endl;
                                                        
+                            int numRedundants = 0;
                                                        if (pDataArray->nameFile != "") {
                                                                map<string, string>::iterator itName = pDataArray->nameMap.find(currSeq.getName());
                                                                if (itName != pDataArray->nameMap.end()) { 
                                                                        vector<string> thisSeqsNames; 
                                                                        pDataArray->m->splitAtChar(itName->second, thisSeqsNames, ',');
+                                    numRedundants = thisSeqsNames.size()-1; //we already include ourselves below
                                                                        for (int k = 1; k < thisSeqsNames.size(); k++) { //start at 1 to skip self
                                                                                outGroupsFile << thisSeqsNames[k] << '\t' << thisGroup << endl;
                                                                        }
@@ -425,8 +427,8 @@ static DWORD WINAPI MyTrimThreadFunction(LPVOID lpParam){
                                                        }
                                                        
                                                        map<string, int>::iterator it = pDataArray->groupCounts.find(thisGroup);
-                                                       if (it == pDataArray->groupCounts.end()) {      pDataArray->groupCounts[thisGroup] = 1; }
-                                                       else { pDataArray->groupCounts[it->first]++; }
+                                                       if (it == pDataArray->groupCounts.end()) {      pDataArray->groupCounts[thisGroup] = 1 + numRedundants; }
+                                                       else { pDataArray->groupCounts[it->first] += (1 + numRedundants); }
                             
                                                }
                                        }