*
*/
+/* This class is designed to implement an integral form of the Cramer-von Mises statistic.
+ you may refer to the "Integration of Microbial Ecology and Statistics: A Test To Compare Gene Libraries"
+ paper in Applied and Environmental Microbiology, Sept. 2004, p. 5485-5492 0099-2240/04/$8.00+0
+ DOI: 10.1128/AEM.70.9.5485-5492.2004 Copyright 2004 American Society for Microbiology for more information. */
+
+
#include "libshuffcommand.h"
//**********************************************************************************************************************
deltaValues.clear();
deltaValues.resize(dist.size());
- coverage->getValues(matrix, cValues, dist, "user");
+ coverage->getValues(matrix, cValues, dist);
+
+ float distDiff = 0;
- //loop through each distance and load rsumdelta
+ //loop through each distance and load sumdelta
for (int p = 0; p < cValues.size(); p++) {
//find delta values
int count = 0;
for (int j = 0; j < numGroups; j++) {
//don't save AA to AA
if (i != j) {
- //(Caa - Cab)^2
- deltaValues[p].push_back( (abs(cValues[p][i][i]-cValues[p][i][j]) * abs(cValues[p][i][i]-cValues[p][i][j])) );
+ //(Caa - Cab)^2 * distDiff
+ deltaValues[p].push_back(((cValues[p][i][i]-cValues[p][i][j]) * (cValues[p][i][i]-cValues[p][i][j])) * distDiff); //* distDiff
sumDelta[count] += deltaValues[p][count];
count++;
}
}
}
+ if (p < cValues.size() - 1) {
+ distDiff = dist[p+1] - dist[p];
+ }
}
printCoverageFile();
for (int j = 0; j < numGroups; j++) {
//don't save AA to AA
if (i != j) {
- //(Caa - Cab)^2
- rsumDelta[count][m] += ((abs(cValues[p][i][i]-cValues[p][i][j]) * abs(cValues[p][i][i]-cValues[p][i][j])));
+ //rsumDelta[3][500] = the sum of the delta scores for BB-BC for random matrix # 500.
+ rsumDelta[count][m] += cValues[p][i][j]; // where cValues[p][0][1] = delta value at distance p of AA-AB, cValues[p][1][2] = delta value at distance p of BB-BC.
count++;
}
}
}
-
}
-//cout << "iter " << m << endl;
+
//clear out old Values
reading->update(m);
cValues.clear();
-//cout << "random sum delta for iter " << m << endl;
-//for (int i = 0; i < rsumDelta.size(); i++) {
-// cout << setprecision(6) << rsumDelta[i][m] << '\t';
-//}
-//cout << endl;
-
}
reading->finish();
//sort so labels match
sort(globaldata->Groups.begin(), globaldata->Groups.end());
+ //sort
+ sort(globaldata->gGroupmap->namesOfGroups.begin(), globaldata->gGroupmap->namesOfGroups.end());
+
+
// number of comparisons i.e. with groups A,B,C = AA, AB, AC, BA, BB, BC...;
for (int i=0; i<numGroups; i++) {
for (int l = 0; l < numGroups; l++) {