]> git.donarmstrong.com Git - mothur.git/blob - bootstrap.cpp
added modify names parameter to set.dir
[mothur.git] / bootstrap.cpp
1 /*
2  *  bootstrap.cpp
3  *  Dotur
4  *
5  *  Created by Sarah Westcott on 1/7/09.
6  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "bootstrap.h"
11
12 /***********************************************************************/
13
14 EstOutput Bootstrap::getValues(SAbundVector* rank){
15         try {
16                 //vector<double> bootData(3,0);
17                 data.resize(1,0);
18                 double maxRank = (double)rank->getMaxRank();
19                 double sampled = rank->getNumSeqs();
20                 double sobs = rank->getNumBins();
21
22                 double boot = (double)sobs;
23
24                 for(int i=1;i<=maxRank;i++){
25                         boot += (double)rank->get(i)*pow((1.0-(double)i/(double)sampled),sampled);
26                 }
27                 
28                 data[0] = boot;
29                 
30                 if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
31         
32                 return data;
33         }
34         catch(exception& e) {
35                 m->errorOut(e, "Bootstrap", "getValues");
36                 exit(1);
37         }
38 }
39
40 /***********************************************************************/