X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=libshuff.cpp;h=5f1bdefe6ea95e36c6b30800a690af2ceecb1fbb;hp=b7e5f27007f4fe33fd2e4d43ff8ea50a2399c130;hb=a8e2df1b96a57f5f29576b08361b86a96a8eff4f;hpb=197c6d3303439582502840980d6a85cf3aab2314 diff --git a/libshuff.cpp b/libshuff.cpp index b7e5f27..5f1bdef 100644 --- a/libshuff.cpp +++ b/libshuff.cpp @@ -17,21 +17,16 @@ void swap(int& i,int& j){ int t = i; i = j; j = t; } Libshuff::Libshuff(FullMatrix* D, int it, float step, float co) : matrix(D), iters(it), stepSize(step), cutOff(co){ try{ + m = MothurOut::getInstance(); groupNames = matrix->getGroups(); groupSizes = matrix->getSizes(); numGroups = matrix->getNumGroups(); - initializeGroups(matrix); } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the Libshuff class Function Libshuff. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + m->errorOut(e, "Libshuff", "Libshuff"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the Libshuff class function Libshuff. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } - } /***********************************************************************/ @@ -48,20 +43,16 @@ void Libshuff::initializeGroups(FullMatrix* matrix){ } int index=0; for(int i=0;ierrorOut(e, "Libshuff", "initializeGroups"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the Libshuff class function initializeGroups. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } - } /***********************************************************************/ @@ -76,7 +67,8 @@ vector Libshuff::getMinX(int x){ try{ vector minX(groupSizes[x], 0); for(int i=0;i 1 ? (i==0 ? matrix->get(groups[x][0], groups[x][1]) : matrix->get(groups[x][i], groups[x][0])) : 0.0); + minX[i] = (groupSizes[x] > 1 ? (i==0 ? matrix->get(groups[x][0], groups[x][1]) : matrix->get(groups[x][i], groups[x][0])) : 0.0); //get the first value in row i of this block + //minX[i] = matrix->get(groups[x][i], groups[x][0]); for(int j=0;jget(groups[x][i], groups[x][j]); @@ -87,14 +79,9 @@ vector Libshuff::getMinX(int x){ return minX; } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the Libshuff class Function getMinX. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + m->errorOut(e, "Libshuff", "getMinX"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the Libshuff class function getMinX. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } - } /***********************************************************************/ @@ -113,13 +100,9 @@ vector Libshuff::getMinXY(int x, int y){ return minXY; } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the Libshuff class Function getMinXY. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + m->errorOut(e, "Libshuff", "getMinXY"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the Libshuff class function getMinXY. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } } /***********************************************************************/ @@ -143,13 +126,9 @@ void Libshuff::randomizeGroups(int x, int y){ for(int k=0;kerrorOut(e, "Libshuff", "randomizeGroups"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the Libshuff class function randomizeGroups. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } } /***********************************************************************/