X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=getseqscommand.cpp;h=480bde3222c9057aafecacc208d84eac24573b72;hb=67ea6ccd74dbd64828d31b952808255f206364ff;hp=779ea912ebebbe58ec22e65723899c4ea566b85f;hpb=deba0af0ccdcb6005ed5b2b82649b137c63fbdf7;p=mothur.git diff --git a/getseqscommand.cpp b/getseqscommand.cpp index 779ea91..480bde3 100644 --- a/getseqscommand.cpp +++ b/getseqscommand.cpp @@ -427,6 +427,11 @@ int GetSeqsCommand::readFasta(){ Sequence currSeq(in); name = currSeq.getName(); + + if (!dups) {//adjust name if needed + map::iterator it = uniqueMap.find(name); + if (it != uniqueMap.end()) { name = it->second; } + } if (name != "") { //if this name is in the accnos file @@ -485,7 +490,12 @@ int GetSeqsCommand::readQual(){ string name = ""; string scores = ""; - in >> name; + in >> name; + + if (!dups) {//adjust name if needed + map::iterator it = uniqueMap.find(name); + if (it != uniqueMap.end()) { name = it->second; } + } if (name.length() != 0) { saveName = name.substr(1); @@ -748,6 +758,8 @@ int GetSeqsCommand::readName(){ wroteSomething = true; out << validSecond[0] << '\t'; + //we are changing the unique name in the fasta file + uniqueMap[firstCol] = validSecond[0]; //you know you have at least one valid second since first column is valid for (int i = 0; i < validSecond.size()-1; i++) { out << validSecond[i] << ','; } @@ -805,6 +817,7 @@ int GetSeqsCommand::readGroup(){ in >> name; //read from first column in >> group; //read from second column + //if this name is in the accnos file if (names.count(name) != 0) { @@ -862,6 +875,11 @@ int GetSeqsCommand::readTax(){ in >> name; //read from first column in >> tax; //read from second column + + if (!dups) {//adjust name if needed + map::iterator it = uniqueMap.find(name); + if (it != uniqueMap.end()) { name = it->second; } + } //if this name is in the accnos file if (names.count(name) != 0) { @@ -924,6 +942,11 @@ int GetSeqsCommand::readAlign(){ in >> name; //read from first column + + if (!dups) {//adjust name if needed + map::iterator it = uniqueMap.find(name); + if (it != uniqueMap.end()) { name = it->second; } + } //if this name is in the accnos file if (names.count(name) != 0) {