]> git.donarmstrong.com Git - mothur.git/blobdiff - unifracweightedcommand.cpp
added multiple processors option for Windows users to align.seqs, dist.seqs, summary...
[mothur.git] / unifracweightedcommand.cpp
index 994f09bcda36aa0bd5705b921cdc647387bd9500..a0d710e7b2ebbb7cffaf4aca88365a3ab73a197c 100644 (file)
@@ -134,8 +134,8 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        }
                        
                        m->runParse = true;
-                       m->Groups.clear();
-                       m->namesOfGroups.clear();
+                       m->clearGroups();
+                       m->clearAllGroups();
                        m->Treenames.clear();
                        m->names.clear();
                        
@@ -168,7 +168,7 @@ UnifracWeightedCommand::UnifracWeightedCommand(string option) {
                        if (groups == "not found") { groups = ""; }
                        else { 
                                m->splitAtDash(groups, Groups);
-                               m->Groups = Groups;
+                               m->setGroups(Groups);
                        }
                                
                        itersString = validParameter.validFile(parameters, "iters", false);                     if (itersString == "not found") { itersString = "1000"; }
@@ -253,7 +253,7 @@ int UnifracWeightedCommand::execute() {
                                if (m->control_pressed) { 
                                        delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; }
                                        for (int i = 0; i < outputNames.size(); i++) {  m->mothurRemove(outputNames[i]); } outputTypes.clear();
-                                       m->Groups.clear();
+                                       m->clearGroups();
                                        return 0;
                                }
                                
@@ -277,8 +277,10 @@ int UnifracWeightedCommand::execute() {
                        
                util = new SharedUtil();
                string s; //to make work with setgroups
-               util->setGroups(m->Groups, tmap->namesOfGroups, s, numGroups, "weighted");      //sets the groups the user wants to analyze
-               util->getCombos(groupComb, m->Groups, numComp);
+               vector<string> Groups = m->getGroups();
+               vector<string> nameGroups = tmap->getNamesOfGroups();
+               util->setGroups(Groups, nameGroups, s, numGroups, "weighted");  //sets the groups the user wants to analyze
+               util->getCombos(groupComb, Groups, numComp);
                delete util;
                
                weighted = new Weighted(tmap, includeRoot);
@@ -327,7 +329,7 @@ int UnifracWeightedCommand::execute() {
                                vector< vector<string> > namesOfGroupCombos;
                                for (int a=0; a<numGroups; a++) { 
                                        for (int l = 0; l < a; l++) {   
-                                               vector<string> groups; groups.push_back(m->Groups[a]); groups.push_back(m->Groups[l]);
+                                               vector<string> groups; groups.push_back((m->getGroups())[a]); groups.push_back((m->getGroups())[l]);
                                                namesOfGroupCombos.push_back(groups);
                                        }
                                }
@@ -409,7 +411,7 @@ int UnifracWeightedCommand::execute() {
                if (phylip) {   createPhylipFile();             }
 
                //clear out users groups
-               m->Groups.clear();
+               m->clearGroups();
                delete tmap; delete weighted;
                for (int i = 0; i < T.size(); i++) { delete T[i]; }
                
@@ -639,17 +641,17 @@ void UnifracWeightedCommand::createPhylipFile() {
                        
                        if ((outputForm == "lt") || (outputForm == "square")) {
                                //output numSeqs
-                               out << m->Groups.size() << endl;
+                               out << m->getNumGroups() << endl;
                        }
 
                        //make matrix with scores in it
-                       vector< vector<float> > dists;  dists.resize(m->Groups.size());
-                       for (int i = 0; i < m->Groups.size(); i++) {
-                               dists[i].resize(m->Groups.size(), 0.0);
+                       vector< vector<float> > dists;  dists.resize(m->getNumGroups());
+                       for (int i = 0; i < m->getNumGroups(); i++) {
+                               dists[i].resize(m->getNumGroups(), 0.0);
                        }
                        
                        //flip it so you can print it
-                       for (int r=0; r<m->Groups.size(); r++) { 
+                       for (int r=0; r<m->getNumGroups(); r++) { 
                                for (int l = 0; l < r; l++) {
                                        dists[r][l] = utreeScores[count];
                                        dists[l][r] = utreeScores[count];
@@ -658,9 +660,9 @@ void UnifracWeightedCommand::createPhylipFile() {
                        }
 
                        //output to file
-                       for (int r=0; r<m->Groups.size(); r++) { 
+                       for (int r=0; r<m->getNumGroups(); r++) { 
                                //output name
-                               string name = m->Groups[r];
+                               string name = (m->getGroups())[r];
                                if (name.length() < 10) { //pad with spaces to make compatible
                                        while (name.length() < 10) {  name += " ";  }
                                }
@@ -675,12 +677,12 @@ void UnifracWeightedCommand::createPhylipFile() {
                                        out << name << '\t';
                                        
                                        //output distances
-                                       for (int l = 0; l < m->Groups.size(); l++) {    out  << dists[r][l] << '\t';  }
+                                       for (int l = 0; l < m->getNumGroups(); l++) {   out  << dists[r][l] << '\t';  }
                                        out << endl;
                                }else{
                                        //output distances
                                        for (int l = 0; l < r; l++) {   
-                                               string otherName = m->Groups[l];
+                                               string otherName = (m->getGroups())[l];
                                                if (otherName.length() < 10) { //pad with spaces to make compatible
                                                        while (otherName.length() < 10) {  otherName += " ";  }
                                                }