]> git.donarmstrong.com Git - mothur.git/blobdiff - sharedlistvector.cpp
added forward and reverse barcodes to trim.seqs to process illumina seqs
[mothur.git] / sharedlistvector.cpp
index f2d8e07f81320d58b500287dc66df8e068246ee5..6dfcb97f0aff013d15c1c641e93a24b0d7b229a3 100644 (file)
 
 /***********************************************************************/
 
-SharedListVector::SharedListVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0){globaldata = GlobalData::getInstance(); groupmap = NULL; }
+SharedListVector::SharedListVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0){ groupmap = NULL; }
 
 /***********************************************************************/
 
-SharedListVector::SharedListVector(int n):     DataVector(), data(n, "") , maxRank(0), numBins(0), numSeqs(0){globaldata = GlobalData::getInstance(); groupmap = NULL; }
+SharedListVector::SharedListVector(int n):     DataVector(), data(n, "") , maxRank(0), numBins(0), numSeqs(0){ groupmap = NULL; }
 
 /***********************************************************************/
 SharedListVector::SharedListVector(ifstream& f) : DataVector(), maxRank(0), numBins(0), numSeqs(0) {
        try {
-               globaldata = GlobalData::getInstance();
-
                //set up groupmap for later.
-               groupmap = new GroupMap(globaldata->getGroupFile());
-               groupmap->readMap();
+               groupmap = new GroupMap(m->getGroupFile());
+               groupmap->readMap(); 
 
                int hold;
                string inputData;
                f >> label >> hold;
        
                data.assign(hold, "");
-       
+               
                for(int i=0;i<hold;i++){
                        f >> inputData;
                        set(i, inputData);
                }
-       
+               
        }
        catch(exception& e) {
                m->errorOut(e, "SharedListVector", "SharedListVector");
@@ -61,6 +59,8 @@ void SharedListVector::set(int binNumber, string seqNames){
                if(nNames_new > maxRank)        {       maxRank = nNames_new;   }
        
                numSeqs += (nNames_new - nNames_old);
+               
+                        
        }
        catch(exception& e) {
                m->errorOut(e, "SharedListVector", "set");
@@ -266,17 +266,20 @@ vector<SharedRAbundVector*> SharedListVector::getSharedRAbundVector() {
                vector<SharedRAbundVector*> lookup;  //contains just the groups the user selected
                map<string, SharedRAbundVector*> finder;  //contains all groups in groupmap
                string group, names, name;
-       
-               util->setGroups(globaldata->Groups, globaldata->gGroupmap->namesOfGroups);
+               
+               vector<string> Groups = m->getGroups();
+               vector<string> allGroups = groupmap->getNamesOfGroups();
+               util->setGroups(Groups, allGroups);
+               m->setGroups(Groups);
                delete util;
 
-               for (int i = 0; i < globaldata->gGroupmap->namesOfGroups.size(); i++) {
+               for (int i = 0; i < allGroups.size(); i++) {
                        SharedRAbundVector* temp = new SharedRAbundVector(data.size());
-                       finder[globaldata->gGroupmap->namesOfGroups[i]] = temp;
-                       finder[globaldata->gGroupmap->namesOfGroups[i]]->setLabel(label);
-                       finder[globaldata->gGroupmap->namesOfGroups[i]]->setGroup(globaldata->gGroupmap->namesOfGroups[i]);
-                       if (m->inUsersGroups(globaldata->gGroupmap->namesOfGroups[i], globaldata->Groups)) {  //if this group is in user groups
-                               lookup.push_back(finder[globaldata->gGroupmap->namesOfGroups[i]]);
+                       finder[allGroups[i]] = temp;
+                       finder[allGroups[i]]->setLabel(label);
+                       finder[allGroups[i]]->setGroup(allGroups[i]);
+                       if (m->inUsersGroups(allGroups[i], m->getGroups())) {  //if this group is in user groups
+                               lookup.push_back(finder[allGroups[i]]);
                        }
                }