]> git.donarmstrong.com Git - mothur.git/blobdiff - clustercommand.cpp
1.22.0
[mothur.git] / clustercommand.cpp
index cdcc6ca9745d8bdf3509c3505ef5c15dc61fd991..678912c2076a10af0580f9b778238e3134542c44 100644 (file)
@@ -75,6 +75,7 @@ ClusterCommand::ClusterCommand(string option)  {
                
                //allow user to run help
                if(option == "help") { help(); abort = true; calledHelp = true; }
+               else if(option == "citation") { citation(); abort = true; calledHelp = true;}
                
                else {
                        vector<string> myArray = setParameters();
@@ -134,25 +135,26 @@ ClusterCommand::ClusterCommand(string option)  {
                        phylipfile = validParameter.validFile(parameters, "phylip", true);
                        if (phylipfile == "not open") { phylipfile = ""; abort = true; }
                        else if (phylipfile == "not found") { phylipfile = ""; }        
-                       else {  distfile = phylipfile;  format = "phylip";      }
+                       else {  distfile = phylipfile;  format = "phylip";      m->setPhylipFile(phylipfile); }
                        
                        columnfile = validParameter.validFile(parameters, "column", true);
                        if (columnfile == "not open") { columnfile = ""; abort = true; }        
                        else if (columnfile == "not found") { columnfile = ""; }
-                       else {  distfile = columnfile; format = "column";       }
+                       else {  distfile = columnfile; format = "column"; m->setColumnFile(columnfile); }
                        
                        namefile = validParameter.validFile(parameters, "name", true);
                        if (namefile == "not open") { abort = true; }   
                        else if (namefile == "not found") { namefile = ""; }
+                       else { m->setNameFile(namefile); }
                        
                        if ((phylipfile == "") && (columnfile == "")) { 
                                //is there are current file available for either of these?
                                //give priority to column, then phylip
                                columnfile = m->getColumnFile(); 
-                               if (columnfile != "") {  m->mothurOut("Using " + columnfile + " as input file for the column parameter."); m->mothurOutEndLine(); }
+                               if (columnfile != "") {  distfile = columnfile; format = "column"; m->mothurOut("Using " + columnfile + " as input file for the column parameter."); m->mothurOutEndLine(); }
                                else { 
                                        phylipfile = m->getPhylipFile(); 
-                                       if (phylipfile != "") {  m->mothurOut("Using " + phylipfile + " as input file for the phylip parameter."); m->mothurOutEndLine(); }
+                                       if (phylipfile != "") { distfile = phylipfile;  format = "phylip"; m->mothurOut("Using " + phylipfile + " as input file for the phylip parameter."); m->mothurOutEndLine(); }
                                        else { 
                                                m->mothurOut("No valid current files. You must provide a phylip or column file before you can use the cluster command."); m->mothurOutEndLine(); 
                                                abort = true;
@@ -242,7 +244,7 @@ int ClusterCommand::execute(){
                if (m->control_pressed) { //clean up
                        delete list; delete matrix; delete rabund;
                        sabundFile.close();rabundFile.close();listFile.close();
-                       for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());         } outputTypes.clear();
+                       for (int i = 0; i < outputNames.size(); i++) {  m->mothurRemove(outputNames[i]);        } outputTypes.clear();
                        return 0;
                }
                
@@ -281,7 +283,7 @@ int ClusterCommand::execute(){
                        if (m->control_pressed) { //clean up
                                delete list; delete matrix; delete rabund; delete cluster;
                                sabundFile.close();rabundFile.close();listFile.close();
-                               for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());         } outputTypes.clear();
+                               for (int i = 0; i < outputNames.size(); i++) {  m->mothurRemove(outputNames[i]);        } outputTypes.clear();
                                return 0;
                        }
                
@@ -324,7 +326,7 @@ int ClusterCommand::execute(){
                        cout.flush();
                        print_start = false;
                }
-       
+               
                if(previousDist <= 0.0000){
                        printData("unique");
                }