]> git.donarmstrong.com Git - mothur.git/blobdiff - readcluster.cpp
trim.flows mod
[mothur.git] / readcluster.cpp
index 205581c72ab26bd767a0a4c47fdfcb3d73e124d5..d8227101b2c339b3904e95144d11f5cccb068dd3 100644 (file)
@@ -12,7 +12,6 @@
 /***********************************************************************/
 
 ReadCluster::ReadCluster(string distfile, float c, string o, bool s){
-               globaldata = GlobalData::getInstance();
                m = MothurOut::getInstance();
         distFile = distfile;
                cutoff = c;
@@ -23,7 +22,7 @@ ReadCluster::ReadCluster(string distfile, float c, string o, bool s){
 
 /***********************************************************************/
 
-int ReadCluster::read(NameAssignment* nameMap){
+int ReadCluster::read(NameAssignment*& nameMap){
        try {
         
                if (format == "phylip") { convertPhylip2Column(nameMap); }
@@ -44,7 +43,7 @@ int ReadCluster::read(NameAssignment* nameMap){
 }
 /***********************************************************************/
 
-int ReadCluster::convertPhylip2Column(NameAssignment* nameMap){
+int ReadCluster::convertPhylip2Column(NameAssignment*& nameMap){
        try {   
                //convert phylip file to column file
                map<int, string> rowToName;
@@ -61,8 +60,13 @@ int ReadCluster::convertPhylip2Column(NameAssignment* nameMap){
                int square, nseqs;
                string name;
                vector<string> matrixNames;
-        
-               in >> nseqs >> name;
+               
+               string numTest;
+               in >> numTest >> name;
+               
+               if (!m->isContainingOnlyDigits(numTest)) { m->mothurOut("[ERROR]: expected a number and got " + numTest + ", quitting."); m->mothurOutEndLine(); exit(1); }
+               else { convert(numTest, nseqs); }
+               
                rowToName[0] = name;
                matrixNames.push_back(name);
                
@@ -183,7 +187,6 @@ int ReadCluster::convertPhylip2Column(NameAssignment* nameMap){
                        for(int i=0;i<matrixNames.size();i++){
                                nameMap->push_back(matrixNames[i]);
                        }
-                       globaldata->nameMap = nameMap;
                }