X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=whittaker.cpp;fp=whittaker.cpp;h=95f1c9c5fcb789a19a7496a83177ab639d0067e6;hb=477e76a8a79b60f6cd4253324dd830bdea25e3e9;hp=0000000000000000000000000000000000000000;hpb=e4827e0945cbda536064e5a345996b2a7dfcbb81;p=mothur.git diff --git a/whittaker.cpp b/whittaker.cpp new file mode 100644 index 0000000..95f1c9c --- /dev/null +++ b/whittaker.cpp @@ -0,0 +1,39 @@ +/* + * whittaker.cpp + * Mothur + * + * Created by Pat Schloss on 4/23/09. + * Copyright 2009 Patrick D. Schloss. All rights reserved. + * + */ + +#include "whittaker.h" + +/***********************************************************************/ + +EstOutput Whittaker::getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2){ + try{ + data.resize(1); + + int countA = 0; + int countB = 0; + int sTotal = shared1->getNumBins(); + for(int i=0;igetAbundance(i) != 0){ countA++; } + if(shared2->getAbundance(i) != 0){ countB++; } + } + + data[0] = 2*sTotal/(float)(countA+countB)-1; + return data; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the Whittaker class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the Whittaker class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} + +/***********************************************************************/ \ No newline at end of file