X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=getrelabundcommand.cpp;fp=getrelabundcommand.cpp;h=90d084f3e9be3f27f0723f4e5b095bd3cc61a1c7;hb=ccaad73f103d8f105264d65491ce19e5df80477d;hp=4d155f2f0fda2b4462450ad5e2789e70a12b13d7;hpb=e0fbf58358a72f20352cf2a43922ab6b5bdf0cf8;p=mothur.git diff --git a/getrelabundcommand.cpp b/getrelabundcommand.cpp index 4d155f2..90d084f 100644 --- a/getrelabundcommand.cpp +++ b/getrelabundcommand.cpp @@ -226,14 +226,6 @@ int GetRelAbundCommand::getRelAbundance(vector& thisLookUp, try { if (pickedGroups) { eliminateZeroOTUS(thisLookUp); } - int totalNumSeqs = 0; - if ((scale == "totalgroup") || (scale == "averagegroup")) { - for (int i = 0; i < thisLookUp.size(); i++) { - //find total number of sequences in all samples - totalNumSeqs += thisLookUp[i]->getNumSeqs(); - } - } - float averageNumSeqs = totalNumSeqs / (float) thisLookUp.size(); for (int i = 0; i < thisLookUp.size(); i++) { out << thisLookUp[i]->getLabel() << '\t' << thisLookUp[i]->getGroup() << '\t' << thisLookUp[i]->getNumBins() << '\t'; @@ -246,8 +238,8 @@ int GetRelAbundCommand::getRelAbundance(vector& thisLookUp, float relabund = 0.0; - if (scale == "totalgroup") { //abund of this otu compared to total number of sequence in my group - relabund = abund / (float) totalNumSeqs; + if (scale == "totalgroup") { + relabund = abund / (float) thisLookUp[i]->getNumSeqs(); }else if (scale == "totalotu") { //calc the total in this otu int totalOtu = 0; @@ -255,7 +247,7 @@ int GetRelAbundCommand::getRelAbundance(vector& thisLookUp, relabund = abund / (float) totalOtu; }else if (scale == "averagegroup") { - relabund = abund / (float) averageNumSeqs; + relabund = abund / (float) (thisLookUp[i]->getNumSeqs() / (float) thisLookUp[i]->getNumBins()); }else if (scale == "averageotu") { //calc the total in this otu int totalOtu = 0;