vector<double> D;
processors = p;
outputDir = o;
+
+ CountTable* ct = t->getCountTable();
numGroups = m->getNumGroups();
#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 Weighted::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos) {
+EstOutput Weighted::createProcesses(Tree* t, vector< vector<string> > namesOfGroupCombos, CountTable* ct) {
try {
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
int process = 1;
}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);
//m->mothurOut("Merging results."); m->mothurOutEndLine();
}
}
- 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++) {
}
}
/**************************************************************************************************/
-EstOutput Weighted::driver(Tree* t, vector< vector<string> > namesOfGroupCombos, int start, int num) {
+EstOutput Weighted::driver(Tree* t, vector< vector<string> > namesOfGroupCombos, int start, int num, CountTable* ct) {
try {
EstOutput results;
vector<double> D;
int numSeqsInGroupI = it->second;
double sum = getLengthToRoot(t, t->groupNodeInfo[groupA][j], groupA, groupB);
- double weightedSum = ((numSeqsInGroupI * sum) / (double)tmap->seqsPerGroup[groupA]);
+ double weightedSum = ((numSeqsInGroupI * sum) / (double)ct->getGroupCount(groupA));
D[count] += weightedSum;
}
int numSeqsInGroupL = it->second;
double sum = getLengthToRoot(t, t->groupNodeInfo[groupB][j], groupA, groupB);
- double weightedSum = ((numSeqsInGroupL * sum) / (double)tmap->seqsPerGroup[groupB]);
+ double weightedSum = ((numSeqsInGroupL * sum) / (double)ct->getGroupCount(groupB));
D[count] += weightedSum;
}
it = t->tree[i].pcount.find(groupA);
//if it does u = # of its descendants with a certain group / total number in tree with a certain group
if (it != t->tree[i].pcount.end()) {
- u = (double) t->tree[i].pcount[groupA] / (double) tmap->seqsPerGroup[groupA];
+ u = (double) t->tree[i].pcount[groupA] / (double) ct->getGroupCount(groupA);
}else { u = 0.00; }
//if it does subtract their percentage from u
if (it != t->tree[i].pcount.end()) {
- u -= (double) t->tree[i].pcount[groupB] / (double) tmap->seqsPerGroup[groupB];
+ u -= (double) t->tree[i].pcount[groupB] / (double) ct->getGroupCount(groupB);
}
if (includeRoot) {
try {
data.clear(); //clear out old values
+
+ CountTable* ct = t->getCountTable();
if (m->control_pressed) { return data; }
int numSeqsInGroupI = it->second;
double sum = getLengthToRoot(t, t->groupNodeInfo[groups[0]][j], groups[0], groups[1]);
- double weightedSum = ((numSeqsInGroupI * sum) / (double)tmap->seqsPerGroup[groups[0]]);
+ double weightedSum = ((numSeqsInGroupI * sum) / (double)ct->getGroupCount(groups[0]));
D += weightedSum;
}
int numSeqsInGroupL = it->second;
double sum = getLengthToRoot(t, t->groupNodeInfo[groups[1]][j], groups[0], groups[1]);
- double weightedSum = ((numSeqsInGroupL * sum) / (double)tmap->seqsPerGroup[groups[1]]);
+ double weightedSum = ((numSeqsInGroupL * sum) / (double)ct->getGroupCount(groups[1]));
D += weightedSum;
}
it = t->tree[i].pcount.find(groupA);
//if it does u = # of its descendants with a certain group / total number in tree with a certain group
if (it != t->tree[i].pcount.end()) {
- u = (double) t->tree[i].pcount[groupA] / (double) tmap->seqsPerGroup[groupA];
+ u = (double) t->tree[i].pcount[groupA] / (double) ct->getGroupCount(groupA);
}else { u = 0.00; }
it = t->tree[i].pcount.find(groupB);
//if it does subtract their percentage from u
if (it != t->tree[i].pcount.end()) {
- u -= (double) t->tree[i].pcount[groupB] / (double) tmap->seqsPerGroup[groupB];
+ u -= (double) t->tree[i].pcount[groupB] / (double) ct->getGroupCount(groupB);
}
if (includeRoot) {