EstOutput Unweighted::getValues(Tree* t, int p, string o) {
try {
- globaldata = GlobalData::getInstance();
processors = p;
outputDir = o;
-
+
+ CountTable* ct = t->getCountTable();
+
//if the users enters no groups then give them the score of all groups
- int numGroups = globaldata->Groups.size();
+ int numGroups = m->getNumGroups();
//calculate number of comparsions
int numComp = 0;
for (int r=0; r<numGroups; r++) {
for (int l = 0; l < r; l++) {
numComp++;
- vector<string> groups; groups.push_back(globaldata->Groups[r]); groups.push_back(globaldata->Groups[l]);
+ vector<string> groups; groups.push_back((m->getGroups())[r]); groups.push_back((m->getGroups())[l]);
namesOfGroupCombos.push_back(groups);
}
}
vector<string> groups;
if (numGroups == 0) {
//get score for all users groups
- for (int i = 0; i < tmap->namesOfGroups.size(); i++) {
- if (tmap->namesOfGroups[i] != "xxx") {
- groups.push_back(tmap->namesOfGroups[i]);
+ for (int i = 0; i < (ct->getNamesOfGroups()).size(); i++) {
+ if ((ct->getNamesOfGroups())[i] != "xxx") {
+ groups.push_back((ct->getNamesOfGroups())[i]);
}
}
namesOfGroupCombos.push_back(groups);
}else {
- for (int i = 0; i < globaldata->Groups.size(); i++) {
- groups.push_back(globaldata->Groups[i]);
+ for (int i = 0; i < m->getNumGroups(); i++) {
+ groups.push_back((m->getGroups())[i]);
}
namesOfGroupCombos.push_back(groups);
}
}
- #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
if(processors == 1){
- data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size());
+ data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), ct);
}else{
int numPairs = namesOfGroupCombos.size();
lines.push_back(linePair(startPos, numPairsPerProcessor));
}
- data = createProcesses(t, namesOfGroupCombos);
+ data = createProcesses(t, namesOfGroupCombos, ct);
lines.clear();
}
#else
- data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size());
+ data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), ct);
#endif
return data;
}
/**************************************************************************************************/
-EstOutput Unweighted::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos) {
+EstOutput Unweighted::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos, CountTable* ct) {
try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
int process = 1;
vector<int> processIDS;
process++;
}else if (pid == 0){
EstOutput myresults;
- myresults = driver(t, namesOfGroupCombos, lines[process].start, lines[process].num);
+ myresults = driver(t, namesOfGroupCombos, lines[process].start, lines[process].num, ct);
if (m->control_pressed) { exit(0); }
}
}
- results = driver(t, namesOfGroupCombos, lines[0].start, lines[0].num);
+ results = driver(t, namesOfGroupCombos, lines[0].start, lines[0].num, ct);
//force parent to wait until all the processes are done
for (int i=0;i<(processors-1);i++) {
m->gobble(in);
}
in.close();
- remove(s.c_str());
+ m->mothurRemove(s);
}
m->mothurOut("DONE."); m->mothurOutEndLine(); m->mothurOutEndLine();
}
}
/**************************************************************************************************/
-EstOutput Unweighted::driver(Tree* t, vector< vector<string> > namesOfGroupCombos, int start, int num) {
+EstOutput Unweighted::driver(Tree* t, vector< vector<string> > namesOfGroupCombos, int start, int num, CountTable* ct) {
try {
EstOutput Unweighted::getValues(Tree* t, string groupA, string groupB, int p, string o) {
try {
- globaldata = GlobalData::getInstance();
processors = p;
outputDir = o;
+ CountTable* ct = t->getCountTable();
+
//if the users enters no groups then give them the score of all groups
- int numGroups = globaldata->Groups.size();
+ int numGroups = m->getNumGroups();
//calculate number of comparsions
int numComp = 0;
for (int r=0; r<numGroups; r++) {
for (int l = 0; l < r; l++) {
numComp++;
- vector<string> groups; groups.push_back(globaldata->Groups[r]); groups.push_back(globaldata->Groups[l]);
+ vector<string> groups; groups.push_back((m->getGroups())[r]); groups.push_back((m->getGroups())[l]);
namesOfGroupCombos.push_back(groups);
}
}
vector<string> groups;
if (numGroups == 0) {
//get score for all users groups
- for (int i = 0; i < tmap->namesOfGroups.size(); i++) {
- if (tmap->namesOfGroups[i] != "xxx") {
- groups.push_back(tmap->namesOfGroups[i]);
+ for (int i = 0; i < (ct->getNamesOfGroups()).size(); i++) {
+ if ((ct->getNamesOfGroups())[i] != "xxx") {
+ groups.push_back((ct->getNamesOfGroups())[i]);
}
}
namesOfGroupCombos.push_back(groups);
}else {
- for (int i = 0; i < globaldata->Groups.size(); i++) {
- groups.push_back(globaldata->Groups[i]);
+ for (int i = 0; i < m->getNumGroups(); i++) {
+ groups.push_back((m->getGroups())[i]);
}
namesOfGroupCombos.push_back(groups);
}
}
- #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+ #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
if(processors == 1){
- data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), true);
+ data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), true, ct);
}else{
int numPairs = namesOfGroupCombos.size();
lines.push_back(linePair(startPos, numPairsPerProcessor));
}
- data = createProcesses(t, namesOfGroupCombos, true);
+ data = createProcesses(t, namesOfGroupCombos, true, ct);
lines.clear();
}
#else
- data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), true);
+ data = driver(t, namesOfGroupCombos, 0, namesOfGroupCombos.size(), true, ct);
#endif
return data;
}
/**************************************************************************************************/
-EstOutput Unweighted::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos, bool usingGroups) {
+EstOutput Unweighted::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos, bool usingGroups, CountTable* ct) {
try {
-#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
int process = 1;
vector<int> processIDS;
process++;
}else if (pid == 0){
EstOutput myresults;
- myresults = driver(t, namesOfGroupCombos, lines[process].start, lines[process].num, usingGroups);
+ myresults = driver(t, namesOfGroupCombos, lines[process].start, lines[process].num, usingGroups, ct);
if (m->control_pressed) { exit(0); }
}
}
- results = driver(t, namesOfGroupCombos, lines[0].start, lines[0].num, usingGroups);
+ results = driver(t, namesOfGroupCombos, lines[0].start, lines[0].num, usingGroups, ct);
//force parent to wait until all the processes are done
for (int i=0;i<(processors-1);i++) {
m->gobble(in);
}
in.close();
- remove(s.c_str());
+ m->mothurRemove(s);
}
return results;
}
}
/**************************************************************************************************/
-EstOutput Unweighted::driver(Tree* t, vector< vector<string> > namesOfGroupCombos, int start, int num, bool usingGroups) {
+EstOutput Unweighted::driver(Tree* t, vector< vector<string> > namesOfGroupCombos, int start, int num, bool usingGroups, CountTable* ct) {
try {
EstOutput results; results.resize(num);
int count = 0;
- Tree* copyTree = new Tree;
+ Tree* copyTree = new Tree(ct);
for (int h = start; h < (start+num); h++) {