X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=fullmatrix.cpp;h=6151a65202901fa24ec6ff91166017a682483c62;hb=9ca2caadbeac83bb84b3330d9204b1b659d62941;hp=64d7b6af2dbe39279164fbe299c86a617af278e7;hpb=3659285c05daa94306a7b61dd97ec945b23d472b;p=mothur.git diff --git a/fullmatrix.cpp b/fullmatrix.cpp index 64d7b6a..6151a65 100644 --- a/fullmatrix.cpp +++ b/fullmatrix.cpp @@ -39,6 +39,7 @@ FullMatrix::FullMatrix(ifstream& filehandle) { if(isalnum(d)){ square = true; filehandle.putback(d); + for(int i=0;i> matrix[0][i]; } @@ -56,14 +57,9 @@ FullMatrix::FullMatrix(ifstream& filehandle) { if (square == true) { readSquareMatrix(filehandle); } else { readLTMatrix(filehandle); } - - - printMatrix(cout); //sort sequences so they are gathered in groups for processing sortGroups(0, numSeqs-1); - cout << "after sort" << endl; - printMatrix(cout); - + } catch(exception& e) { cout << "Standard Error: " << e.what() << " has occurred in the FullMatrix class Function FullMatrix. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; @@ -83,6 +79,7 @@ void FullMatrix::readSquareMatrix(ifstream& filehandle) { int count = 0; float distance; + string group, name; for(int i=1;iupdate(count); } + } reading->finish(); delete reading; @@ -204,8 +203,6 @@ void FullMatrix::sortGroups(int low, int high){ i++; j--; -cout << "swapping rows " << i << " " << j << endl; -printMatrix(cout); cout << endl; } } while(i <= j); @@ -253,5 +250,80 @@ void FullMatrix::printMatrix(ostream& out) { } } + +/**************************************************************************/ +void FullMatrix::getMinsForRowsVectors(){ + try{ + numGroups = globaldata->gGroupmap->namesOfGroups.size(); + + //sort globaldata->gGroupmap.namesOfGroups so that it will match the matrix + sort(globaldata->gGroupmap->namesOfGroups.begin(), globaldata->gGroupmap->namesOfGroups.end()); + + /*************************************************/ + //find where in matrix each group starts and stops + /*************************************************/ + vector bounds; //bounds[1] = starting row in matrix from group B, bounds[2] = starting row in matrix from group C, bounds[3] = no need to find upper bound of C because its numSeqs. + bounds.resize(numGroups); + + bounds[0] = 0; + bounds[numGroups] = numSeqs-1; + //for each group find bounds of subgroup/comparison + for (int i = 1; i < numGroups; i++) { + getBounds(bounds[i], globaldata->gGroupmap->namesOfGroups[i]); + } + + /************************************************************/ + //fill the minsForRows vectors for each group the user wants + /************************************************************/ + int countx = bounds[1]; //where second group starts + int county = bounds[1]; + + //go through the entire matrix + for (int x = 0; x < numSeqs; x++) { + for (int y = 0; y < numSeqs; y++) { + //if have not changed groups + if ((x < countx) && (y < county)) { + + } + } + } + + + + + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the FullMatrix class Function getMinsForRowsVectors. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the FullMatrix class function getMinsForRowsVectors. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + +} + /**************************************************************************/ +void FullMatrix::getBounds(int& higher, string group) { + try{ + bool gotLower = false; + + //for each group find bounds of subgroup/comparison + for (it = index.begin(); it != index.end(); it++) { + if (it->second.groupname == group) { + if (gotLower != true) { gotLower = true; } + }else if ((gotLower == true) && (it->second.groupname != group)) { higher = it->first; break; } + } + + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the FullMatrix class Function getBounds. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the FullMatrix class function getBounds. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + +}