X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=sharedsabundvector.cpp;fp=sharedsabundvector.cpp;h=0000000000000000000000000000000000000000;hp=efd14bcc249207ac4181fc552b8a918d57144083;hb=4a877efa127e56e81a21f53cfdbbfd3bfbe8c4ff;hpb=a6cf29fa4dac0909c7582cb1094151d34093ee76 diff --git a/sharedsabundvector.cpp b/sharedsabundvector.cpp deleted file mode 100644 index efd14bc..0000000 --- a/sharedsabundvector.cpp +++ /dev/null @@ -1,275 +0,0 @@ -/* - * sharedSharedSAbundVector.cpp - * Dotur - * - * Created by Sarah Westcott on 12/10/08. - * Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved. - * - */ - -#include "sharedsabundvector.h" -#include "sabundvector.hpp" - - -/***********************************************************************/ - -SharedSAbundVector::SharedSAbundVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0){ } - -/***********************************************************************/ - -SharedSAbundVector::SharedSAbundVector(int size) : DataVector(), maxRank(0), numBins(0), numSeqs(0) { - individual newGuy; - //initialize data - for (int i=0; i< size; i++) { - newGuy.bin = i; - newGuy.abundance = 0; - data.push_back(newGuy); - } -} - -/***********************************************************************/ - -void SharedSAbundVector::set(int bin, int abundance, string groupName){ - try { - - int initSize = data[bin].abundance; - data[bin].abundance = abundance; - data[bin].group = groupName; - - if(bin != 0){ - numBins += (abundance - initSize); - } - - numSeqs += bin * (abundance - initSize); - - if(bin > maxRank) { maxRank = bin; } - } - catch(exception& e) { - m->errorOut(e, "SharedSAbundVector", "set"); - exit(1); - } -} - -/***********************************************************************/ - -individual SharedSAbundVector::get(int index){ - return data[index]; -} -/***********************************************************************/ - -int SharedSAbundVector::getAbundance(int index){ - return data[index].abundance; -} - -/***********************************************************************/ - -void SharedSAbundVector::push_back(int abundance, int bin, string groupName){ - try { - individual newGuy; - newGuy.abundance = abundance; - newGuy.bin = bin; - newGuy.group = groupName; - - data.push_back(newGuy); - - maxRank++; - - numBins += abundance; - - numSeqs += (maxRank * abundance); - } - catch(exception& e) { - m->errorOut(e, "SharedSAbundVector", "push_back"); - exit(1); - } -} - -/***********************************************************************/ - -void SharedSAbundVector::resize(int size){ - data.resize(size); -} - -/***********************************************************************/ - -int SharedSAbundVector::size(){ - return data.size(); -} - -/***********************************************************************/ -void SharedSAbundVector::print(ostream& output){ - try { - output << label << '\t' << maxRank << '\t'; - - for(int i=1;i<=maxRank;i++){ - output << data[i].abundance << '\t'; - } - output << endl; - } - catch(exception& e) { - m->errorOut(e, "SharedSAbundVector", "print"); - exit(1); - } -} -/***********************************************************************/ -string SharedSAbundVector::getGroup(){ - return group; -} - -/***********************************************************************/ - -void SharedSAbundVector::setGroup(string groupName){ - group = groupName; -} - -/**********************************************************************/ -int SharedSAbundVector::getNumBins(){ - return numBins; -} - -/***********************************************************************/ - -int SharedSAbundVector::getNumSeqs(){ - return numSeqs; -} - -/***********************************************************************/ - -int SharedSAbundVector::getMaxRank(){ - return maxRank; -} -/***********************************************************************/ -RAbundVector SharedSAbundVector::getRAbundVector(){ - try { - RAbundVector rav; - - for(int i=1;ierrorOut(e, "SharedSAbundVector", "getRAbundVector"); - exit(1); - } -} -/***********************************************************************/ -SAbundVector SharedSAbundVector::getSAbundVector(){ - try { - RAbundVector rav; - SAbundVector sav; - - rav = getRAbundVector(); - sav = rav.getSAbundVector(); - return sav; - - } - catch(exception& e) { - m->errorOut(e, "SharedSAbundVector", "getSAbundVector"); - exit(1); - } -} - -/***********************************************************************/ - -bool compareMembers (individual member, individual member2){ - - if(member.abundance < member2.abundance){ - return true; } - else{ - return false; - } -} - -/***********************************************************************/ -SharedRAbundVector SharedSAbundVector::getSharedRAbundVector(){ - try { - SharedRAbundVector rav; - - for(int i=1;ierrorOut(e, "SharedSAbundVector", "getSharedRAbundVector"); - exit(1); - } -} - - -/***********************************************************************/ - -SharedSAbundVector SharedSAbundVector::getSharedSAbundVector(){ - return *this; -} - -/***********************************************************************/ -SharedOrderVector SharedSAbundVector::getSharedOrderVector() { - try { - SharedRAbundVector rav; - SharedOrderVector ov; - - rav = this->getSharedRAbundVector(); - ov = rav.getSharedOrderVector(); - - ov.updateStats(); - - return ov; - } - catch(exception& e) { - m->errorOut(e, "SharedSAbundVector", "getSharedOrderVector"); - exit(1); - } -} -/***********************************************************************/ - -void SharedSAbundVector::clear(){ - numBins = 0; - maxRank = 0; - numSeqs = 0; - data.clear(); -} - -/***********************************************************************/ -OrderVector SharedSAbundVector::getOrderVector(map* hold = NULL){ - try { - OrderVector ov; - - int binIndex = 0; - - for(int i=1;ierrorOut(e, "SharedSAbundVector", "getOrderVector"); - exit(1); - } -} - -/***********************************************************************/ -