]> git.donarmstrong.com Git - mothur.git/blobdiff - fastamap.cpp
changes while testing
[mothur.git] / fastamap.cpp
index 25860e1a7b22bb9f20fca7ff9aa77a884a09827a..bf55493faece21cbd6c0043ac89149826c83c166 100644 (file)
@@ -64,11 +64,13 @@ void FastaMap::readFastaFile(string inFastaFile, string oldNameFileName){ //prin
        m->openInputFile(oldNameFileName, oldNameFile);
        
        map<string,string> oldNameMap;
+       map<string, string>::iterator itName;
        string name, list;
        while(!oldNameFile.eof()){
                if (m->control_pressed) { break; }
                
-               oldNameFile >> name >> list;
+               oldNameFile >> name; m->gobble(oldNameFile);
+               oldNameFile >> list;
                oldNameMap[name] = list;
                m->gobble(oldNameFile);
        }
@@ -87,6 +89,10 @@ void FastaMap::readFastaFile(string inFastaFile, string oldNameFileName){ //prin
                        if(currSeq.getIsAligned())      {       sequence = currSeq.getAligned();        }
                        else                                            {       sequence = currSeq.getUnaligned();      }
                        
+                       itName = seqmap.find(name);
+                       if (itName == seqmap.end()) { seqmap[name] = sequence;  }
+                       else { m->mothurOut("You already have a sequence named " + name + ", sequence names must be unique, please correct."); m->mothurOutEndLine(); }
+                       
                        seqmap[name] = sequence;  
                        map<string,group>::iterator it = data.find(sequence);
                        if (it == data.end()) {         //it's unique.