]> git.donarmstrong.com Git - mothur.git/blobdiff - mgclustercommand.cpp
added large parameter to mgcluster along with new rabund support
[mothur.git] / mgclustercommand.cpp
index 42f6d0ad72b7fcc35674b3734664f4c48b2e0fab..508b05f01d432a83d387b9b5b072d59a4b0fdcd5 100644 (file)
@@ -235,20 +235,20 @@ int MGClusterCommand::execute(){
                read = new ReadBlast(blastfile, cutoff, penalty, length, minWanted, hclusterWanted);
                read->read(nameMap);
         
-//        list = new ListVector(nameMap->getListVector());
-//        RAbundVector* rabund = NULL;
-//        
-//        if(large) {
-//            map<string, int> nameMapCounts = m->readNames(namefile);
-//            createRabund(nameMapCounts);
-//            rabund = &rav;
-//        }else {
-//            rabund = new RAbundVector(list->getRAbundVector());
-//        }
+        list = new ListVector(nameMap->getListVector());
+        RAbundVector* rabund = NULL;
+        
+        if(large) {
+            map<string, int> nameMapCounts = m->readNames(namefile);
+            createRabund(nameMapCounts);
+            rabund = &rav;
+        }else {
+            rabund = new RAbundVector(list->getRAbundVector());
+        }
         
                 
-               list = new ListVector(nameMap->getListVector());
-               RAbundVector* rabund = new RAbundVector(list->getRAbundVector());
+               //list = new ListVector(nameMap->getListVector());
+               //rabund = new RAbundVector(list->getRAbundVector());
                
                if (m->control_pressed) { outputTypes.clear(); delete nameMap; delete read; delete list; delete rabund; return 0; }
                
@@ -519,8 +519,8 @@ int MGClusterCommand::execute(){
                        m->mothurRemove(overlapFile);
                }
                
-               delete list; 
-               delete rabund;
+               delete list;
+               if (!large) {delete rabund;}
                listFile.close();
                sabundFile.close();
                rabundFile.close();
@@ -714,22 +714,22 @@ void MGClusterCommand::sortHclusterFiles(string unsortedDist, string unsortedOve
 }
 
 //**********************************************************************************************************************
-//
-//void MGClusterCommand::createRabund(map<string, int> nameMapCounts){
-//    try {
-//        //RAbundVector rav;
-//        map<string,int>::iterator it;
-//        //it = nameMapCounts.begin();
-//        //for(int i = 0; i < list->getNumBins(); i++) {   rav.push_back((*it).second); it++;    }
-//        for ( it=nameMapCounts.begin(); it!=nameMapCounts.end(); it++ ) {    rav.push_back( it->second );    }
-//        //return rav;
-//    }
-//    catch(exception& e) {
-//             m->errorOut(e, "MGClusterCommand", "createRabund");
-//             exit(1);
-//     }
-//    
-//}
+
+void MGClusterCommand::createRabund(map<string, int> nameMapCounts){
+    try {
+        //RAbundVector rav;
+        map<string,int>::iterator it;
+        //it = nameMapCounts.begin();
+        //for(int i = 0; i < list->getNumBins(); i++) {   rav.push_back((*it).second); it++;    }
+        for ( it=nameMapCounts.begin(); it!=nameMapCounts.end(); it++ ) {    rav.push_back( it->second );    }
+        //return rav;
+    }
+    catch(exception& e) {
+               m->errorOut(e, "MGClusterCommand", "createRabund");
+               exit(1);
+       }
+    
+}
 
 //**********************************************************************************************************************