]> git.donarmstrong.com Git - mothur.git/blobdiff - sharedsabundvector.cpp
adding treeclimber and unifrac pieces
[mothur.git] / sharedsabundvector.cpp
index 5175f5ee23b6a24b881eef09deb7272bee3ee6b2..8b6f8faa8695b8acb4a36730519ea6e751df8fb3 100644 (file)
@@ -3,7 +3,7 @@
  *  Dotur
  *
  *  Created by Sarah Westcott on 12/10/08.
- *  Copyright 2008 __MyCompanyName__. All rights reserved.
+ *  Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved.
  *
  */
 
@@ -30,60 +30,8 @@ SharedSAbundVector::SharedSAbundVector(int size) :   DataVector(), maxRank(0), num
                        newGuy.abundance = 0;
                        data.push_back(newGuy);
                }
-       //      for(int i=0;i<data.size();i++){
-       //              if(data[i].abundance != 0){     maxRank = i;    }
-       //              numSeqs += i*data[i].abundance;
-       //              numBins += data[i].abundance;
-       //      }
-
 };
 
-/***********************************************************************
-
-SharedSAbundVector::SharedSAbundVector(string id, vector<int> sav) : DataVector(id), data(sav) {
-       try {
-               
-               for(int i=0;i<sav.size();i++){
-                       if(data[i] != 0){       maxRank = i;    }
-                       numSeqs += i*data[i];
-                       numBins += data[i];
-               }
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the SharedSAbundVector class Function SharedSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the SharedSAbundVector class function SharedSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-
-/***********************************************************************
-
-SharedSAbundVector::SharedSAbundVector(ifstream& f): DataVector(), maxRank(0), numBins(0), numSeqs(0) {
-       try {
-               int hold;
-               f >> label >> hold;
-       
-               data.assign(hold+1, 0);
-               int inputData;
-       
-               for(int i=1;i<=hold;i++){
-                       f >> inputData;
-                       set(i, inputData);
-               }
-       }
-       catch(exception& e) {
-               cout << "Standard Error: " << e.what() << " has occurred in the SharedSAbundVector class Function SharedSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-       catch(...) {
-               cout << "An unknown error has occurred in the SharedSAbundVector class function SharedSAbundVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
-               exit(1);
-       }
-}
-
 /***********************************************************************/
 
 void SharedSAbundVector::set(int bin, int abundance, string groupName){
@@ -264,7 +212,7 @@ bool compareMembers (individual member, individual member2){
 }
 
 /***********************************************************************/
-SharedRAbundVector SharedSAbundVector::getSharedVector(){
+SharedRAbundVector SharedSAbundVector::getSharedRAbundVector(){
        try {
                SharedRAbundVector rav;
                
@@ -300,7 +248,26 @@ SharedSAbundVector SharedSAbundVector::getSharedSAbundVector(){
 }
 
 /***********************************************************************/
-
+SharedOrderVector SharedSAbundVector::getSharedOrderVector() {
+       try {
+               SharedRAbundVector rav;
+               SharedOrderVector ov;
+               
+               rav = this->getSharedRAbundVector();
+               ov = rav.getSharedOrderVector();
+               
+               return ov;
+       }
+       catch(exception& e) {
+               cout << "Standard Error: " << e.what() << " has occurred in the SharedSAbundVector class Function getSharedOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }
+       catch(...) {
+               cout << "An unknown error has occurred in the SharedSAbundVector class function getSharedOrderVector. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+               exit(1);
+       }               
+}
+/***********************************************************************/
 OrderVector SharedSAbundVector::getOrderVector(map<string,int>* hold = NULL){
        try {
                OrderVector ov;