@@ -37,7+40,12 @@ int ClusterClassic::readPhylipFile(string filename, NameAssignment* nameMap) {
ifstream fileHandle;
m->openInputFile(filename, fileHandle);
ifstream fileHandle;
m->openInputFile(filename, fileHandle);
- fileHandle >> nseqs >> name;
+ string numTest;
+ fileHandle >> numTest >> name;
+
+ if (!m->isContainingOnlyDigits(numTest)) { m->mothurOut("[ERROR]: expected a number and got " + numTest + ", quitting."); m->mothurOutEndLine(); exit(1); }
+ else { convert(numTest, nseqs); }
+
matrixNames.push_back(name);
matrixNames.push_back(name);
@@ -102,7+110,7 @@ int ClusterClassic::readPhylipFile(string filename, NameAssignment* nameMap) {
fileHandle >> distance;
if (distance == -1) { distance = 1000000; }
fileHandle >> distance;
if (distance == -1) { distance = 1000000; }
- else if (globaldata->sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert.
+ else if (sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert.
//if(distance < cutoff){
dMatrix[i][j] = distance;
//if(distance < cutoff){
dMatrix[i][j] = distance;
@@ -124,7+132,7 @@ int ClusterClassic::readPhylipFile(string filename, NameAssignment* nameMap) {
if (m->control_pressed) { delete reading; fileHandle.close(); return 0; }
if (distance == -1) { distance = 1000000; }
if (m->control_pressed) { delete reading; fileHandle.close(); return 0; }
if (distance == -1) { distance = 1000000; }
- else if (globaldata->sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert.
+ else if (sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert.
//if(distance < cutoff){
if (distance < smallDist) { smallDist = distance; }
//if(distance < cutoff){
if (distance < smallDist) { smallDist = distance; }
@@ -162,7+170,7 @@ int ClusterClassic::readPhylipFile(string filename, NameAssignment* nameMap) {
if (m->control_pressed) { fileHandle.close(); delete reading; return 0; }
if (distance == -1) { distance = 1000000; }
if (m->control_pressed) { fileHandle.close(); delete reading; return 0; }
if (distance == -1) { distance = 1000000; }
- else if (globaldata->sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert.
+ else if (sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert.
if(j < i){
if (distance < smallDist) { smallDist = distance; }
if(j < i){
if (distance < smallDist) { smallDist = distance; }
@@ -185,7+193,7 @@ int ClusterClassic::readPhylipFile(string filename, NameAssignment* nameMap) {
if (m->control_pressed) { fileHandle.close(); delete reading; return 0; }
if (distance == -1) { distance = 1000000; }
if (m->control_pressed) { fileHandle.close(); delete reading; return 0; }
if (distance == -1) { distance = 1000000; }
- else if (globaldata->sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert.
+ else if (sim) { distance = 1.0 - distance; } //user has entered a sim matrix that we need to convert.
if(j < i){
if (distance < smallDist) { smallDist = distance; }
if(j < i){
if (distance < smallDist) { smallDist = distance; }