]> git.donarmstrong.com Git - mothur.git/blobdiff - fullmatrix.cpp
changes while testing
[mothur.git] / fullmatrix.cpp
index 43c6f2e30a6dc04458e5aab7c42a8ada3636dae5..4451d6645ea8691b941ebbc991f82cc4ce8b4706 100644 (file)
 
 /**************************************************************************/
 //This constructor reads a distance matrix file and stores the data in the matrix.
-FullMatrix::FullMatrix(ifstream& filehandle) {
+FullMatrix::FullMatrix(ifstream& filehandle, GroupMap* g, bool s) : groupmap(g), sim(s) {
        try{
                m = MothurOut::getInstance();
-               globaldata = GlobalData::getInstance();
-               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,7 +43,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];  }
+                                       if (sim) {  matrix[0][i] = 1.0 - matrix[0][i];  }
                                }
                                break;
                        }
@@ -55,7 +54,7 @@ FullMatrix::FullMatrix(ifstream& filehandle) {
                                break;
                        }
                }
-               
+       
                //read rest of matrix
                if (square == true) {  readSquareMatrix(filehandle); }
                else {  readLTMatrix(filehandle); }
@@ -94,7 +93,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];  }
+                               if (sim) {  matrix[i][j] = 1.0 - matrix[i][j];  }
                                
                                count++;
                                reading->update(count);
@@ -116,6 +115,7 @@ int FullMatrix::readSquareMatrix(ifstream& filehandle) {
 /**************************************************************************/
 int FullMatrix::readLTMatrix(ifstream& filehandle) {
        try {
+               
                Progress* reading;
                reading = new Progress("Reading matrix:     ", numSeqs * (numSeqs - 1) / 2);
                
@@ -137,7 +137,7 @@ int FullMatrix::readLTMatrix(ifstream& filehandle) {
                                if (m->control_pressed) { delete reading;  return 0; }
                                
                                filehandle >> distance;
-                               if (globaldata->sim) {  distance = 1.0 - distance;  }
+                               if (sim) {  distance = 1.0 - distance;  }
                                
                                matrix[i][j] = distance;  matrix[j][i] = distance;