X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothurout.cpp;h=8a3b6313072a158f611e1a69a84d0a9713add18c;hb=bd27c2b0612942815b7417c79f7ee41f669a2a34;hp=fc16d204b142e5a6f55783f56bc52aafb8e6a4d1;hpb=c48d91112209b841444923670dca5454da0e2a4d;p=mothur.git diff --git a/mothurout.cpp b/mothurout.cpp index fc16d20..8a3b631 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -2242,9 +2242,11 @@ map MothurOut::readNames(string namefile, unsigned long int& numSeq /************************************************************/ int MothurOut::checkName(string& name) { try { - for (int i = 0; i < name.length(); i++) { - if (name[i] == ':') { name[i] = '_'; changedSeqNames = true; } - } + if (modifyNames) { + for (int i = 0; i < name.length(); i++) { + if (name[i] == ':') { name[i] = '_'; changedSeqNames = true; } + } + } return 0; } catch(exception& e) { @@ -3270,6 +3272,26 @@ vector MothurOut::getAverages(vector< vector >& dists) { exit(1); } } +/**************************************************************************************************/ +double MothurOut::getAverage(vector dists) { + try{ + double average = 0; + + for (int i = 0; i < dists.size(); i++) { + average += dists[i]; + } + + //finds average. + average /= (double) dists.size(); + + return average; + } + catch(exception& e) { + errorOut(e, "MothurOut", "getAverage"); + exit(1); + } +} + /**************************************************************************************************/ vector MothurOut::getStandardDeviation(vector< vector >& dists) { try{