]> git.donarmstrong.com Git - mothur.git/blobdiff - otuhierarchycommand.cpp
added load.logfile command. changed summary.single output for subsample=t.
[mothur.git] / otuhierarchycommand.cpp
index 2f99aa6091452933f6796f21aa043449bfce1dd4..389879634e9ea1c003bde25604652187f8f460cb 100644 (file)
@@ -46,7 +46,26 @@ string OtuHierarchyCommand::getHelpString(){
                exit(1);
        }
 }
-
+//**********************************************************************************************************************
+string OtuHierarchyCommand::getOutputFileNameTag(string type, string inputName=""){    
+       try {
+        string outputFileName = "";
+               map<string, vector<string> >::iterator it;
+        
+        //is this a type this command creates
+        it = outputTypes.find(type);
+        if (it == outputTypes.end()) {  m->mothurOut("[ERROR]: this command doesn't create a " + type + " output file.\n"); }
+        else {
+            if (type == "otuheirarchy") {  outputFileName =  "otu.hierarchy"; }
+            else { m->mothurOut("[ERROR]: No definition for type " + type + " output file tag.\n"); m->control_pressed = true;  }
+        }
+        return outputFileName;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "OtuHierarchyCommand", "getOutputFileNameTag");
+               exit(1);
+       }
+}
 //**********************************************************************************************************************
 OtuHierarchyCommand::OtuHierarchyCommand(){    
        try {
@@ -180,7 +199,7 @@ int OtuHierarchyCommand::execute(){
                }
                
                ofstream out;
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(listFile)) + lists[0].getLabel() + "-" + lists[1].getLabel() + ".otu.hierarchy";
+               string outputFileName = outputDir + m->getRootName(m->getSimpleName(listFile)) + lists[0].getLabel() + "-" + lists[1].getLabel() + "." + getOutputFileNameTag("otuhierarchy");
                m->openOutputFile(outputFileName, out);
                
                //go through each bin in "big" otu and output the bins in "little" otu which created it