]> git.donarmstrong.com Git - mothur.git/blobdiff - fullmatrix.cpp
fixes while testing 1.12.0
[mothur.git] / fullmatrix.cpp
index 72866491648e1fb02f681c1ca5842fdbba8e58a2..fe61307552b67bdc4567d00025e1a1401a9e70f3 100644 (file)
@@ -18,8 +18,9 @@ FullMatrix::FullMatrix(ifstream& filehandle) {
                groupmap = globaldata->gGroupmap;
                
                string name, group;
-               filehandle >> numSeqs >> name;
                
+               filehandle >> numSeqs >> name;
+       
                //make the matrix filled with zeros
                matrix.resize(numSeqs); 
                for(int i = 0; i < numSeqs; i++) {
@@ -44,6 +45,7 @@ FullMatrix::FullMatrix(ifstream& filehandle) {
                                
                                for(int i=0;i<numSeqs;i++){
                                        filehandle >> matrix[0][i];
+                                       if (globaldata->sim) {  matrix[0][i] = 1.0 - matrix[0][i];  }
                                }
                                break;
                        }
@@ -54,7 +56,7 @@ FullMatrix::FullMatrix(ifstream& filehandle) {
                                break;
                        }
                }
-               
+       
                //read rest of matrix
                if (square == true) {  readSquareMatrix(filehandle); }
                else {  readLTMatrix(filehandle); }
@@ -93,6 +95,7 @@ int FullMatrix::readSquareMatrix(ifstream& filehandle) {
                                if (m->control_pressed) { delete reading;  return 0; }
                                
                                filehandle >> matrix[i][j];
+                               if (globaldata->sim) {  matrix[i][j] = 1.0 - matrix[i][j];  }
                                
                                count++;
                                reading->update(count);
@@ -114,6 +117,7 @@ int FullMatrix::readSquareMatrix(ifstream& filehandle) {
 /**************************************************************************/
 int FullMatrix::readLTMatrix(ifstream& filehandle) {
        try {
+               
                Progress* reading;
                reading = new Progress("Reading matrix:     ", numSeqs * (numSeqs - 1) / 2);
                
@@ -135,8 +139,10 @@ int FullMatrix::readLTMatrix(ifstream& filehandle) {
                                if (m->control_pressed) { delete reading;  return 0; }
                                
                                filehandle >> distance;
-               
+                               if (globaldata->sim) {  distance = 1.0 - distance;  }
+                               
                                matrix[i][j] = distance;  matrix[j][i] = distance;
+                               
                                count++;
                                reading->update(count);
                        }