for(int i=0;i<numSeqs;i++){
filehandle >> matrix[0][i];
+ if (globaldata->sim) { matrix[0][i] = 1.0 - matrix[0][i]; }
}
break;
}
}
//read rest of matrix
- if (square == true) { readSquareMatrix(filehandle); }
- else { readLTMatrix(filehandle); }
+ if (square == true) { readSquareMatrix(filehandle); }
+ else { readLTMatrix(filehandle); }
- sortGroups(0, numSeqs-1);
+ filehandle.close();
+
+ if (!m->control_pressed) { sortGroups(0, numSeqs-1); }
}
catch(exception& e) {
}
}
/**************************************************************************/
-void FullMatrix::readSquareMatrix(ifstream& filehandle) {
+int FullMatrix::readSquareMatrix(ifstream& filehandle) {
try {
Progress* reading;
int count = 0;
string group, name;
-
+
for(int i=1;i<numSeqs;i++){
filehandle >> name;
if(group == "not found") { m->mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); m->mothurOutEndLine(); exit(1); }
for(int j=0;j<numSeqs;j++){
+ 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);
}
}
+
+ if (m->control_pressed) { delete reading; return 0; }
+
reading->finish();
delete reading;
+
+ return 0;
}
catch(exception& e) {
m->errorOut(e, "FullMatrix", "readSquareMatrix");
}
}
/**************************************************************************/
-void FullMatrix::readLTMatrix(ifstream& filehandle) {
+int FullMatrix::readLTMatrix(ifstream& filehandle) {
try {
Progress* reading;
reading = new Progress("Reading matrix: ", numSeqs * (numSeqs - 1) / 2);
if(group == "not found") { m->mothurOut("Error: Sequence '" + name + "' was not found in the group file, please correct."); m->mothurOutEndLine(); exit(1); }
for(int j=0;j<i;j++){
+ 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);
}
}
-
+
+ if (m->control_pressed) { delete reading; return 0; }
+
reading->finish();
delete reading;
+
+ return 0;
}
catch(exception& e) {
m->errorOut(e, "FullMatrix", "readLTMatrix");