X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bergerparker.cpp;fp=bergerparker.cpp;h=c8c25ea71f2a87ef8d975b0843a7a7929cd6b9b9;hb=eb1c88346fb246e95a6b38935b103f95e38b82ca;hp=0000000000000000000000000000000000000000;hpb=d53f63d7e0d9c3feeb8ded5a74e6c150fae50fe9;p=mothur.git diff --git a/bergerparker.cpp b/bergerparker.cpp new file mode 100644 index 0000000..c8c25ea --- /dev/null +++ b/bergerparker.cpp @@ -0,0 +1,38 @@ +/* + * ssbp.cpp + * Mothur + * + * Created by Thomas Ryabin on 3/6/09. + * Copyright 2009 __MyCompanyName__. All rights reserved. + * + */ + +#include "bergerparker.h" +#include "calculator.h" + +/***************************************************************/ + +EstOutput BergerParker::getValues(SAbundVector* rank){ + try { + data.resize(1,0); + //Berger-Parker index + double BP = (double)rank->getNumSeqs()/(double)rank->getMaxRank(); + //cout << "BP index = " << 1/BP << "\n\n"; + + data[0] = BP; + if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; } + + return data; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the NPShannon class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the NPShannon class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} + +/***********************************************************************/ +