X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=calculator.h;h=127c835e13318dbc8c0e853d510add1ddbc9c8a7;hb=50ed3b6104d5821d6184f882e1e1423d47dcbf10;hp=06c3a2425a2a56cbfce3ac3b19b83591dd288c7c;hpb=20a2d0350a737a434c89f303662d64a8eeea7b05;p=mothur.git diff --git a/calculator.h b/calculator.h index 06c3a24..127c835 100644 --- a/calculator.h +++ b/calculator.h @@ -3,21 +3,13 @@ using namespace std; -#include -#include -#include -#include -#include -#include -#include -#include -#include "utilities.hpp" +#include "mothur.h" #include "sabundvector.hpp" #include "sharedsabundvector.h" #include "rabundvector.hpp" #include "uvest.h" -/* The calculator class is the parent class for all the different estimators implemented in mothur. +/* The calculator class is the parent class for all the different estimators implemented in mothur except the tree calculators. It has 2 pure functions EstOutput getValues(SAbundVector*), which works on a single group, and EstOutput getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2), which compares 2 groups. */ @@ -31,17 +23,19 @@ class Calculator { public: Calculator(){}; - Calculator(string n, int c) : name(n), cols(c) {}; + Calculator(string n, int c, bool m) : name(n), cols(c), multiple(m) {}; virtual EstOutput getValues(SAbundVector*) = 0; - virtual EstOutput getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2) = 0; + virtual EstOutput getValues(vector) = 0; virtual void print(ostream& f) { f.setf(ios::fixed, ios::floatfield); f.setf(ios::showpoint); f << data[0]; for(int i=1;i); //This prints the values of the vector on one line with a space between each value. void printElements(vector); //This prints the values of the vector on one line with a space between each value. int findString(vector, string);//This returns the index of the given string in the given vector, if the string does not exist in the vector it returns -1. double mean(vector); //This returns the mean value of the vector. double stError(vector); //This returns the standard error of the vector. + int sumElements(vector, int); + int sumElements(vector); double sumElements(vector); //This returns the sum of all the values in the vector. double sumElements(vector, int); //This returns the sum of all the values in the vector excluding those whose index is before the given index. double findMax(vector); //This returns the maximum value in the vector. + int numNZ(vector); //This returns the number of non-zero values in the vector. double numNZ(vector); //This returns the number of non-zero values in the vector. double numPos(vector); //This returns the number of positive values in the vector. double findMaxDiff(vector, vector); //This returns the absolute value of the maximum difference between the two vectors. @@ -83,27 +81,6 @@ class VecCalc vector getSData(char[]);//This takes a file name as a parameter and reads all of the data in the file into a vector. }; -/**************************************************************************************************/ -/*This Class contains methods that return the B Diverstiy of two sets -of data. The four methods are the Whittaker's measure, the Marczewski-Stainhaus distance, -the Sorensen quantitative index, and the Morisita-Horn index. -The main method takes a number of columns of data and performs all 4 methods on each -combination of columns. It prints a table for every method that shows the B Diverstiy for -each combination. It also calculates the overall diversity for Whittaker's measure and -the Marczewski-Steinhaus distance.*/ - - -class BDiversity -{ - public: - void doBD(vector, double);//Main method - double getWhitt(vector,vector);//Whittacker's measure - double getMS(vector, vector);//Marczewski-Stainhaus distance - double getSor(vector, vector);//Sorensen quantitative index - double getMor(vector, vector);//Morisita-Horn index - void printD(vector >, int);//This prints a table that represents the given 2D vector, the second paramter specifies which method is to be used (1 for Whitt, 2 for MS, 3 for Sor, and 4 for Mor) -}; - /**************************************************************************************************/ /*This Class is similar to the GeometricSeries.h class. It calculates @@ -122,11 +99,11 @@ class BrokenStick It prints the D-Statistic and the critical values for the Kolmogorov-Smirnov 1-sample test at the 95% confidence interval.*/ -class GeometricSeries +/*class GeometricSeries { public: void doGeomTest(vector); -}; +};*/ /**************************************************************************************************/ //This Class calculates the jackknifed estimate of the data and @@ -147,16 +124,6 @@ class KS2SampleTest public: void doKSTest(vector, vector); }; -/**************************************************************************************************/ -/*This Class calculates the Log Series Distribution for the data. -It then generates a D-Statistic and prints the D-Statistic and -the critical values for the Kolmogorov-Smirnov 1 sample test.*/ - -class LogSD -{ - public: - void doLogSD(vector, vector); -}; /**************************************************************************************************/ //This Class calculates and prints the Q-Statistic for the data. @@ -182,6 +149,14 @@ class TDTable double getConfLimit(int,int); }; +/**************************************************************************************************/ +//This Class stores the table of the confidence limits of the One-Sample Kolmogorov-Smirnov Test. +class KOSTable +{ + public: + double getConfLimit(int); +}; + /**************************************************************************************************/ /*This Class calculates the truncated lognormal for the data. It then prints the D-Statistic and the critical values for the