]> git.donarmstrong.com Git - mothur.git/blobdiff - sharedlistvector.cpp
added sequence name to error string in fastq.info. Changed np_shannon to npshannon.
[mothur.git] / sharedlistvector.cpp
index 0f4042fd1a44f040a64aec06de5a2c831985b759..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;
@@ -268,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]]);
                        }
                }