]> git.donarmstrong.com Git - mothur.git/blobdiff - nameassignment.cpp
some changes while testing 1.9
[mothur.git] / nameassignment.cpp
index 42d374d0b9e74842e4d3f289c75ae61645556ebd..0c30898dd4085f5000a68c005ccbeee1bcd3650c 100644 (file)
@@ -17,19 +17,23 @@ void NameAssignment::readMap(){
                string firstCol, secondCol, skip;
        //      int index = 0;
        
-       
-//             map<string, string> data;
+               
+               map<string, int>::iterator itData;
                int rowIndex = 0;
-
+               
                while(fileHandle){
                        fileHandle >> firstCol;                         //read from first column
                        fileHandle >> secondCol;                        //read from second column
+                                               
+                       itData = (*this).find(firstCol);
+                       if (itData == (*this).end()) {
+                       
+                               (*this)[firstCol] = rowIndex++;
+                               list.push_back(secondCol);              //adds data's value to list
+                               reverse[rowIndex] = firstCol;
+                               
+                       }else{  m->mothurOut(firstCol + " is already in namesfile. I will use first definition."); m->mothurOutEndLine();  }
                        
-//                     data[firstCol] = secondCol;                     //store data in map
-
-                       list.push_back(secondCol);              //adds data's value to list
-                       reverse[rowIndex] = firstCol;
-                       (*this)[firstCol] = rowIndex++;
                        gobble(fileHandle);
                }
                fileHandle.close();