]> git.donarmstrong.com Git - mothur.git/blobdiff - mgclustercommand.cpp
edited createRabund function
[mothur.git] / mgclustercommand.cpp
index 61e130647c6734ee49ba99b0bcded20804ee103d..e5681efb220d1635382ea6b077a36ea4e0f50226 100644 (file)
@@ -230,9 +230,19 @@ int MGClusterCommand::execute(){
                //must remember to delete those objects here since readBlast does not
                read = new ReadBlast(blastfile, cutoff, penalty, length, minWanted, hclusterWanted);
                read->read(nameMap);
-               
-               list = new ListVector(nameMap->getListVector());
-               RAbundVector* rabund = new RAbundVector(list->getRAbundVector());
+        
+        list = new ListVector(nameMap->getListVector());
+        RAbundVector* rabund = NULL;
+        if(large) {
+            map<string, int> nameMapCounts = m->readNames(namefile);
+            RAbundVector* rabund = createRabund(list, nameMapCounts);
+        }else {
+            RAbundVector* rabund = new RAbundVector(list->getRAbundVector());
+        }
+        
+                
+               //list = new ListVector(nameMap->getListVector());
+               //RAbundVector* rabund = new RAbundVector(list->getRAbundVector());
                
                if (m->control_pressed) { outputTypes.clear(); delete nameMap; delete read; delete list; delete rabund; return 0; }
                
@@ -699,7 +709,19 @@ void MGClusterCommand::sortHclusterFiles(string unsortedDist, string unsortedOve
 
 //**********************************************************************************************************************
 
+RAbundVector MGClusterCommand::createRabund(ListVector list, map<string, int> nameMapCounts){
+    try {
+        RAbundVector rav;
+        for(int i = 0; i < list->getNumBins(); i++) {   rav.push_back(nameMapCounts[i]);    }
+        return rav;
+    }
+    catch(exception& e) {
+               m->errorOut(e, "MGClusterCommand", "createRabund");
+               exit(1);
+       }
+    
+}
 
-
+//**********************************************************************************************************************