X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=groupmap.cpp;fp=groupmap.cpp;h=f6705e53db2048691b95050f3005bdccecf21347;hb=8c616f2509abd2fb9485a38607c1b439d243b85c;hp=0e0be0e8cf2799527e2664bb79b1cdded09e215c;hpb=7bf581f8c46b08eb3bb40715dac94695edee4a67;p=mothur.git diff --git a/groupmap.cpp b/groupmap.cpp index 0e0be0e..f6705e5 100644 --- a/groupmap.cpp +++ b/groupmap.cpp @@ -46,6 +46,32 @@ int GroupMap::readMap() { fileHandle.close(); return error; } +/************************************************************/ +int GroupMap::readDesignMap() { + string seqName, seqGroup; + int error = 0; + + while(fileHandle){ + fileHandle >> seqName; m->gobble(fileHandle); //read from first column + fileHandle >> seqGroup; //read from second column + + if (m->control_pressed) { fileHandle.close(); return 1; } + + setNamesOfGroups(seqGroup); + + it = groupmap.find(seqName); + + if (it != groupmap.end()) { error = 1; m->mothurOut("Your designfile contains more than 1 group named " + seqName + ", group names must be unique. Please correct."); m->mothurOutEndLine(); } + else { + groupmap[seqName] = seqGroup; //store data in map + seqsPerGroup[seqGroup]++; //increment number of seqs in that group + } + m->gobble(fileHandle); + } + fileHandle.close(); + return error; +} + /************************************************************/ int GroupMap::getNumGroups() { return namesOfGroups.size(); } /************************************************************/