/***********************************************************************/
-Cluster::Cluster(RAbundVector* rav, ListVector* lv, SparseMatrix* dm, float c) :
-rabund(rav), list(lv), dMatrix(dm)
+Cluster::Cluster(RAbundVector* rav, ListVector* lv, SparseMatrix* dm, float c, string f) :
+rabund(rav), list(lv), dMatrix(dm), method(f)
{
/*
cout << "sizeof(MatData): " << sizeof(MatData) << endl;
//save so you can modify as it changes in average neighbor
cutoff = c;
+ m = MothurOut::getInstance();
}
/***********************************************************************/
nColCells = colCells.size();
}
catch(exception& e) {
- errorOut(e, "Cluster", "getRowColCells");
+ m->errorOut(e, "Cluster", "getRowColCells");
exit(1);
}
// cout << '\t' << rabund->get(smallRow) << '\t' << rabund->get(smallCol) << endl;
}
catch(exception& e) {
- errorOut(e, "Cluster", "clusterBins");
+ m->errorOut(e, "Cluster", "clusterBins");
exit(1);
}
// cout << '\t' << list->get(smallRow) << '\t' << list->get(smallCol) << endl;
}
catch(exception& e) {
- errorOut(e, "Cluster", "clusterNames");
+ m->errorOut(e, "Cluster", "clusterNames");
exit(1);
}
}
}
//if not merged it you need it for warning
- if (!merged) {
- mothurOut("Warning: trying to merge cell " + toString(rowCells[i]->row+1) + " " + toString(rowCells[i]->column+1) + " distance " + toString(rowCells[i]->dist) + " with value above cutoff. Results may vary from using cutoff at cluster command instead of read.dist."); mothurOutEndLine();
- if (cutOFF > rowCells[i]->dist) { cutOFF = rowCells[i]->dist; mothurOut("changing cutoff to " + toString(cutOFF)); mothurOutEndLine(); }
+ if ((!merged) && (method == "average")) {
+ //m->mothurOut("Warning: trying to merge cell " + toString(rowCells[i]->row+1) + " " + toString(rowCells[i]->column+1) + " distance " + toString(rowCells[i]->dist) + " with value above cutoff. Results may vary from using cutoff at cluster command instead of read.dist."); m->mothurOutEndLine();
+ if (cutOFF > rowCells[i]->dist) {
+ cutOFF = rowCells[i]->dist;
+ //m->mothurOut("changing cutoff to " + toString(cutOFF)); m->mothurOutEndLine();
+ }
}
removeCell(rowCells[i], i , -1);
// could be avoided
for (int i=nColCells-1;i>=0;i--) {
if (foundCol[i] == 0) {
- if (!((colCells[i]->row == smallRow) && (colCells[i]->column == smallCol))) {
- mothurOut("Warning: merging cell " + toString(colCells[i]->row+1) + " " + toString(colCells[i]->column+1) + " distance " + toString(colCells[i]->dist) + " value above cutoff. Results may vary from using cutoff at cluster command instead of read.dist."); mothurOutEndLine();
- if (cutOFF > colCells[i]->dist) { cutOFF = colCells[i]->dist; mothurOut("changing cutoff to " + toString(cutOFF)); mothurOutEndLine(); }
+ if (method == "average") {
+ if (!((colCells[i]->row == smallRow) && (colCells[i]->column == smallCol))) {
+ //m->mothurOut("Warning: merging cell " + toString(colCells[i]->row+1) + " " + toString(colCells[i]->column+1) + " distance " + toString(colCells[i]->dist) + " value above cutoff. Results may vary from using cutoff at cluster command instead of read.dist."); m->mothurOutEndLine();
+ if (cutOFF > colCells[i]->dist) {
+ cutOFF = colCells[i]->dist;
+ //m->mothurOut("changing cutoff to " + toString(cutOFF)); m->mothurOutEndLine();
+ }
+ }
}
removeCell(colCells[i], -1, i);
}
}
}
catch(exception& e) {
- errorOut(e, "Cluster", "update");
+ m->errorOut(e, "Cluster", "update");
exit(1);
}
}
/***********************************************************************/
-void Cluster::setMapWanted(bool m) {
+void Cluster::setMapWanted(bool f) {
try {
- mapWanted = m;
+ mapWanted = f;
//initialize map
for (int i = 0; i < list->getNumBins(); i++) {
}
catch(exception& e) {
- errorOut(e, "Cluster", "setMapWanted");
+ m->errorOut(e, "Cluster", "setMapWanted");
exit(1);
}
}
}
catch(exception& e) {
- errorOut(e, "Cluster", "updateMap");
+ m->errorOut(e, "Cluster", "updateMap");
exit(1);
}
}