-}
-/***********************************************************************/
-
-inline bool isTrue(string f){
-
- if ((f == "TRUE") || (f == "T") || (f == "true") || (f == "t")) { return true; }
- else { return false; }
-}
-
-/***********************************************************************/
-
-inline float roundDist(float dist, int precision){
-
- return int(dist * precision + 0.5)/float(precision);
-
-}
-
-/***********************************************************************/
-
-inline int getNumNames(string names){
-
- int count = 0;
-
- if(names != ""){
- count = 1;
- for(int i=0;i<names.size();i++){
- if(names[i] == ','){
- count++;
- }
- }
- }
-
- return count;
-
-}
-
-/**************************************************************************************************/
-
-inline vector<vector<double> > binomial(int maxOrder){
-
- vector<vector<double> > binomial(maxOrder+1);
-
- for(int i=0;i<=maxOrder;i++){
- binomial[i].resize(maxOrder+1);
- binomial[i][0]=1;
- binomial[0][i]=0;
- }
- binomial[0][0]=1;
-
- binomial[1][0]=1;
- binomial[1][1]=1;
-
- for(int i=2;i<=maxOrder;i++){
- binomial[1][i]=0;
- }
-
- for(int i=2;i<=maxOrder;i++){
- for(int j=1;j<=maxOrder;j++){
- if(i==j){ binomial[i][j]=1; }
- if(j>i) { binomial[i][j]=0; }
- else { binomial[i][j]=binomial[i-1][j-1]+binomial[i-1][j]; }
- }
- }
-
- return binomial;
-}
-
-/***********************************************************************/
-
-inline string getRootName(string longName){
-
- string rootName = longName;
-
- if(longName.find_last_of(".") != longName.npos){
- int pos = longName.find_last_of('.')+1;
- rootName = longName.substr(0, pos);
- }
-
- return rootName;
-}
-/***********************************************************************/
-
-inline string getSimpleName(string longName){
-
- string simpleName = longName;
-
- if(longName.find_last_of("/") != longName.npos){
- int pos = longName.find_last_of('/')+1;
- simpleName = longName.substr(pos, longName.length());
- }
-
- return simpleName;
-}
-/***********************************************************************/
-
-inline int factorial(int num){
- int total = 1;
-
- for (int i = 1; i <= num; i++) {
- total *= i;
- }
-
- return total;
-}
-/**************************************************************************************************
-
-double min(double x, double y)
-{
- if(x<y){ return x; }
- else { return y; }
-}
-
-/***********************************************************************/
-
-inline string getPathName(string longName){
-
- string rootPathName = longName;
-
- if(longName.find_last_of('/') != longName.npos){
- int pos = longName.find_last_of('/')+1;
- rootPathName = longName.substr(0, pos);
- }
-
- return rootPathName;
-}
-
-/***********************************************************************/
-
-inline string getExtension(string longName){
-
- string extension = longName;
-
- if(longName.find_last_of('.') != longName.npos){
- int pos = longName.find_last_of('.');
- extension = longName.substr(pos, longName.length());
- }
-
- return extension;
-}
-
-/***********************************************************************/
-
-inline int openInputFile(string fileName, ifstream& fileHandle){
-
- fileHandle.open(fileName.c_str());
- if(!fileHandle) {
- cerr << "Error: Could not open " << fileName << endl;
- return 1;
- }
- else {
- return 0;
- }
-
-}
-
-/***********************************************************************/
-
-inline int openOutputFile(string fileName, ofstream& fileHandle){
-
- fileHandle.open(fileName.c_str(), ios::trunc);
- if(!fileHandle) {
- cerr << "Error: Could not open " << fileName << endl;
- return 1;
- }
- else {
- return 0;
- }
-
-}
-/***********************************************************************/
-
-inline int openOutputFileAppend(string fileName, ofstream& fileHandle){
-
- fileHandle.open(fileName.c_str(), ios::app);
- if(!fileHandle) {
- cerr << "Error: Could not open " << fileName << endl;
- return 1;
- }
- else {
- return 0;
- }
-
-}
-
-
-/***********************************************************************/
-
-inline int getNumSeqs(ifstream& file){
-
- int numSeqs = count(istreambuf_iterator<char>(file),istreambuf_iterator<char>(), '>');
- file.seekg(0);
- return numSeqs;
-
-}
-
-/***********************************************************************/
-
-//This function parses the estimator options and puts them in a vector
-inline void splitAtDash(string& estim, vector<string>& container) {
- try {
- string individual;
-
- while (estim.find_first_of('-') != -1) {
- individual = estim.substr(0,estim.find_first_of('-'));
- if ((estim.find_first_of('-')+1) <= estim.length()) { //checks to make sure you don't have dash at end of string
- estim = estim.substr(estim.find_first_of('-')+1, estim.length());
- container.push_back(individual);
- }
- }
- //get last one
- container.push_back(estim);
- }
- catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the mothur class Function splitAtDash. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the mothur class function splitAtDash. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
-
-}
-
-/***********************************************************************/
-//This function parses the label options and puts them in a set
-inline void splitAtDash(string& estim, set<string>& container) {
- try {
- string individual;