]> git.donarmstrong.com Git - mothur.git/blobdiff - mgclustercommand.cpp
asdf
[mothur.git] / mgclustercommand.cpp
index b9c9d1eb845543bc38893068081b9367b913980b..e3287f7f9bb19a4079c28e92fe57cf99e06216d5 100644 (file)
@@ -228,7 +228,13 @@ int MGClusterCommand::execute(){
                if (namefile != "") {
                        nameMap = new NameAssignment(namefile);
                        nameMap->readMap();
-               }else{ nameMap= new NameAssignment(); }
+               }else if (countfile != "") {
+            ct = new CountTable();
+            ct->readTable(countfile, false);
+            nameMap= new NameAssignment();
+            vector<string> tempNames = ct->getNamesOfSeqs();
+            for (int i = 0; i < tempNames.size(); i++) {  nameMap->push_back(tempNames[i]);  }
+        }else{ nameMap= new NameAssignment(); }
                
                string fileroot = outputDir + m->getRootName(m->getSimpleName(blastfile));
                string tag = "";
@@ -245,9 +251,6 @@ int MGClusterCommand::execute(){
         RAbundVector* rabund = NULL;
         
         if(countfile != "") {
-            //map<string, int> nameMapCounts = m->readNames(namefile);
-            ct = new CountTable();
-            ct->readTable(countfile);
             rabund = new RAbundVector();
             createRabund(ct, list, rabund);
         }else {
@@ -271,10 +274,10 @@ int MGClusterCommand::execute(){
                
         map<string, string> variables; 
         variables["[filename]"] = fileroot;
-        if (countfile != "") { variables["[tag2]"] = "unique_list"; }
         variables["[clustertag]"] = tag;
         string sabundFileName = getOutputFileName("sabund", variables);
         string rabundFileName = getOutputFileName("rabund", variables);
+        if (countfile != "") { variables["[tag2]"] = "unique_list"; }
         string listFileName = getOutputFileName("list", variables);
         
         if (countfile == "") {
@@ -312,10 +315,13 @@ int MGClusterCommand::execute(){
                                outputTypes.clear();
                                return 0; 
                        }
-               
+            
+            
                        //cluster using cluster classes
                        while (distMatrix->getSmallDist() < cutoff && distMatrix->getNNodes() > 0){
                                
+                if (m->debug) {  cout << "numNodes=" << distMatrix->getNNodes() << " smallDist = " << distMatrix->getSmallDist() << endl; }
+                
                                cluster->update(cutoff);
                                
                                if (m->control_pressed) {