@@ -24,7+24,12 @@ int FormatPhylipMatrix::read(NameAssignment* nameMap){
string name;
ofstream out;
string name;
ofstream out;
- 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); }
+
list = new ListVector(nseqs);
list->set(0, name);
list = new ListVector(nseqs);
list->set(0, name);
@@ -37,11+42,11 @@ int FormatPhylipMatrix::read(NameAssignment* nameMap){
fileHandle.close(); //reset file
//open and get through numSeqs, code below formats rest of file
fileHandle.close(); //reset file
//open and get through numSeqs, code below formats rest of file
- openInputFile(filename, fileHandle);
- fileHandle >> nseqs; gobble(fileHandle);
+ m->openInputFile(filename, fileHandle);
+ fileHandle >> nseqs; m->gobble(fileHandle);
distFile = filename + ".rowFormatted";
distFile = filename + ".rowFormatted";
- openOutputFile(distFile, out);
+ m->openOutputFile(distFile, out);
break;
}
if(d == '\n'){
break;
}
if(d == '\n'){
@@ -59,7+64,7 @@ int FormatPhylipMatrix::read(NameAssignment* nameMap){
ofstream outTemp;
string tempFile = filename + ".temp";
ofstream outTemp;
string tempFile = filename + ".temp";
- openOutputFile(tempFile, outTemp);
+ m->openOutputFile(tempFile, outTemp);
//convert to square column matrix
for(int i=1;i<nseqs;i++){
//convert to square column matrix
for(int i=1;i<nseqs;i++){
@@ -70,7+75,7 @@ int FormatPhylipMatrix::read(NameAssignment* nameMap){