]> git.donarmstrong.com Git - mothur.git/blob - goodscoverage.cpp
61ffe418f1380ddb4d02fa216a5f6b6ada8b9d58
[mothur.git] / goodscoverage.cpp
1 /*
2  *  goodscoverage.cpp
3  *  Mothur
4  *
5  *  Created by Thomas Ryabin on 4/8/09.
6  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "goodscoverage.h"
11 #include "calculator.h"
12
13 /**********************************************************/
14
15 EstOutput GoodsCoverage::getValues(SAbundVector* rank){
16         try {
17                 data.resize(1,0);
18                 
19                 double numSingletons = rank->get(1);
20                 double totalIndividuals = rank->getNumSeqs();
21                 
22                 data[0] = 1 - numSingletons/totalIndividuals;
23                 
24                 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
25
26                 return data;
27         }
28         catch(exception& e) {
29                 cout << "Standard Error: " << e.what() << " has occurred in the GoodsCoverage class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
30                 exit(1);
31         }
32         catch(...) {
33                 cout << "An unknown error has occurred in the GoodsCoverage class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
34                 exit(1);
35         }       
36 }
37
38 /***********************************************************************/
39