]> git.donarmstrong.com Git - mothur.git/blobdiff - clustercommand.cpp
modified bin.seqs and get.oturep commands to include use of a groupfile if provided...
[mothur.git] / clustercommand.cpp
index 79728164fcde1cbe0e8f528e6826825dfbb4a752..307b774b4ad36b364c92c0152310f560dee1089d 100644 (file)
@@ -15,13 +15,13 @@ ClusterCommand::ClusterCommand(){
        try{
                globaldata = GlobalData::getInstance();
        
-               if(globaldata->getSparseMatrix() != NULL)       {       matrix = new SparseMatrix(*globaldata->getSparseMatrix());              }
+               if(globaldata->gSparseMatrix != NULL)   {       matrix = new SparseMatrix(*globaldata->gSparseMatrix);          }
        //  Not sure if we want the address or an entire new memory allocation.  Might be nice to have new memory so data
        //  doesn't need to be re-read, but then again, it could suck up a ton of memory.  Dunno.
        //      if(globaldata->getSparseMatrix() != NULL)       {       matrix = globaldata->getSparseMatrix();         }
        
-               if(globaldata->getListVector() != NULL){
-                       list = new ListVector(*globaldata->getListVector());
+               if(globaldata->gListVector != NULL){
+                       list = new ListVector(*globaldata->gListVector);
                        rabund = new RAbundVector(list->getRAbundVector());
                        //rabund->print(cout);
                }
@@ -106,9 +106,15 @@ int ClusterCommand::execute(){
                else if(rndPreviousDist<cutoff){
                        printData(toString(rndPreviousDist, length-1));
                }
-       
+               
+               //delete globaldata's copy of the sparsematrix and listvector to free up memory
+               delete globaldata->gSparseMatrix;  globaldata->gSparseMatrix = NULL;
+               delete globaldata->gListVector;  globaldata->gListVector = NULL;
+               
                //saves .list file so you can do the collect, rarefaction and summary commands without doing a read.list
-               globaldata->setDistFile("");
+               if (globaldata->getFormat() == "phylip") { globaldata->setPhylipFile(""); }
+               else if (globaldata->getFormat() == "column") { globaldata->setColumnFile(""); }
+               
                globaldata->setListFile(fileroot+ tag + ".list");
                globaldata->setNameFile("");
                globaldata->setFormat("list");