globaldata = GlobalData::getInstance();
groupmap = globaldata->gGroupmap;
- float minSoFar = 0.0;
string name, group;
filehandle >> numSeqs >> name;
square = true;
filehandle.putback(d);
- if (numSeqs >= 2) {
- //save first distance that is not distance to itself as minimum
- filehandle >> matrix[0][0] >> minSoFar;
- matrix[0][1] = minSoFar;
- }
-
- for(int i=2;i<numSeqs;i++){
+ for(int i=0;i<numSeqs;i++){
filehandle >> matrix[0][i];
- if (matrix[0][i] < minSoFar) { minSoFar = matrix[0][i]; }
}
- index[0].minDist = minSoFar;
break;
}
reading = new Progress("Reading matrix: ", numSeqs * numSeqs);
int count = 0;
- float distance, minSoFar;
- minSoFar = 0.0;
+ float distance;
+
string group, name;
for(int i=1;i<numSeqs;i++){
index[i].groupname = group;
index[i].seqName = name;
- filehandle >> minSoFar;
- matrix[i][0] = minSoFar;
-
if(group == "not found") { cout << "Error: Sequence '" << name << "' was not found in the group file, please correct." << endl; exit(1); }
- for(int j=1;j<numSeqs;j++){
+ for(int j=0;j<numSeqs;j++){
filehandle >> distance;
-
- if ((distance < minSoFar) && (i != j)) { minSoFar = distance; }
matrix[i][j] = distance;
count++;
reading->update(count);
}
-
- //save minimum value for each row
- index[i].minDist = minSoFar;
}
reading->finish();
delete reading;
reading = new Progress("Reading matrix: ", numSeqs * (numSeqs - 1) / 2);
int count = 0;
- float distance, minSoFar;
- minSoFar = 0.0;
+ float distance;
string group, name;
group = groupmap->getGroup(name);
index[i].groupname = group;
index[i].seqName = name;
-
- filehandle >> minSoFar;
- matrix[i][0] = minSoFar;
if(group == "not found") { cout << "Error: Sequence '" << name << "' was not found in the group file, please correct." << endl; exit(1); }
- for(int j=1;j<i;j++){
+ for(int j=0;j<i;j++){
filehandle >> distance;
-
- if (distance < minSoFar) { minSoFar = distance; }
matrix[i][j] = distance; matrix[j][i] = distance;
count++;
reading->update(count);
}
- //save minimum value for each row
- index[i].minDist = minSoFar;
}
reading->finish();
delete reading;
}
}
+
/**************************************************************************/
+void FullMatrix::getMinsForRowsVectors(){
+ try{
+ numGroups = globaldata->gGroupmap->namesOfGroups.size();
+ numUserGroups = globaldata->Groups.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<int> bounds; //bounds[0] = 0, bounds[1] = starting row in matrix from group B, bounds[2] = starting row in matrix from group C, bounds[3] = no need to find C because its numSeqs.
+ bounds.resize(numGroups);
+
+ bounds[numGroups] = numSeqs;
+ //for each group find bounds of subgroup/comparison
+ for (int i = 0; i < numGroups; i++) {
+ getBounds(bounds[i], globaldata->gGroupmap->namesOfGroups[i]);
+ }
+
+ /************************************************************/
+ //fill the minsForRows vectors for each group the user wants
+ /************************************************************/
+ int countx = bounds[0]; //where second group starts
+ int county = bounds[0];
+
+ //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)) {
+ if (inUsersGroups(index[x].groupname, globaldata->Groups)) {
+ }
+ }
+ }
+ }
+
+
+
+
+ }
+ 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);
+ }
+
+}