]> git.donarmstrong.com Git - mothur.git/blobdiff - heatmapcommand.cpp
fixes while testing 1.33.0
[mothur.git] / heatmapcommand.cpp
index 57c4c86b44bf2ccf9368c2c8c26acc1e67d360af..e07ae220eba02c86117feaa656e2b07015a4b94b 100644 (file)
 //**********************************************************************************************************************
 vector<string> HeatMapCommand::setParameters(){        
        try {
-               CommandParameter plist("list", "InputTypes", "", "", "LRSS", "LRSS", "none",false,false); parameters.push_back(plist);
-               CommandParameter prabund("rabund", "InputTypes", "", "", "LRSS", "LRSS", "none",false,false); parameters.push_back(prabund);
-               CommandParameter psabund("sabund", "InputTypes", "", "", "LRSS", "LRSS", "none",false,false); parameters.push_back(psabund);
-               CommandParameter pshared("shared", "InputTypes", "", "", "LRSS", "LRSS", "none",false,false); parameters.push_back(pshared);    
-               CommandParameter prelabund("relabund", "InputTypes", "", "", "LRSS", "LRSS", "none",false,false); parameters.push_back(prelabund);
-               CommandParameter pgroups("groups", "String", "", "", "", "", "",false,false); parameters.push_back(pgroups);
-               CommandParameter pscale("scale", "Multiple", "log10-log2-linear", "log10", "", "", "",false,false); parameters.push_back(pscale);
-               CommandParameter psorted("sorted", "Multiple", "none-shared-topotu-topgroup", "shared", "", "", "",false,false); parameters.push_back(psorted);
-               CommandParameter pnumotu("numotu", "Number", "", "0", "", "", "",false,false); parameters.push_back(pnumotu);
-               CommandParameter pfontsize("fontsize", "Number", "", "24", "", "", "",false,false); parameters.push_back(pfontsize);
-               CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel);
-               CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
-               CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
+               CommandParameter plist("list", "InputTypes", "", "", "LRSS", "LRSS", "none","svg",false,false,true); parameters.push_back(plist);
+               CommandParameter prabund("rabund", "InputTypes", "", "", "LRSS", "LRSS", "none","svg",false,false); parameters.push_back(prabund);
+               CommandParameter psabund("sabund", "InputTypes", "", "", "LRSS", "LRSS", "none","svg",false,false); parameters.push_back(psabund);
+               CommandParameter pshared("shared", "InputTypes", "", "", "LRSS", "LRSS", "none","svg",false,false,true); parameters.push_back(pshared); 
+               CommandParameter prelabund("relabund", "InputTypes", "", "", "LRSS", "LRSS", "none","svg",false,false); parameters.push_back(prelabund);
+               CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups);
+               CommandParameter pscale("scale", "Multiple", "log10-log2-linear", "log10", "", "", "","",false,false); parameters.push_back(pscale);
+               CommandParameter psorted("sorted", "Multiple", "none-shared-topotu-topgroup", "shared", "", "", "","",false,false); parameters.push_back(psorted);
+               CommandParameter pnumotu("numotu", "Number", "", "0", "", "", "","",false,false); parameters.push_back(pnumotu);
+               CommandParameter pfontsize("fontsize", "Number", "", "24", "", "", "","",false,false); parameters.push_back(pfontsize);
+               CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
+               CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
+               CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);
                
                vector<string> myArray;
                for (int i = 0; i < parameters.size(); i++) {   myArray.push_back(parameters[i].name);          }
@@ -61,6 +61,22 @@ string HeatMapCommand::getHelpString(){
        }
 }
 
+//**********************************************************************************************************************
+string HeatMapCommand::getOutputPattern(string type) {
+    try {
+        string pattern = "";
+        
+        if (type == "svg") {  pattern = "[filename],svg"; } 
+        else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true;  }
+        
+        return pattern;
+    }
+    catch(exception& e) {
+        m->errorOut(e, "HeatMapCommand", "getOutputPattern");
+        exit(1);
+    }
+}
+
 //**********************************************************************************************************************
 HeatMapCommand::HeatMapCommand(){      
        try {
@@ -151,27 +167,27 @@ HeatMapCommand::HeatMapCommand(string option) {
                        
                        //check for required parameters
                        listfile = validParameter.validFile(parameters, "list", true);
-                       if (listfile == "not open") { listfile = ""; abort = true; }
+                       if (listfile == "not open") { abort = true; }
                        else if (listfile == "not found") { listfile = ""; }
                        else {  format = "list"; inputfile = listfile; m->setListFile(listfile); }
                        
                        sabundfile = validParameter.validFile(parameters, "sabund", true);
-                       if (sabundfile == "not open") { sabundfile = ""; abort = true; }        
+                       if (sabundfile == "not open") {  abort = true; }        
                        else if (sabundfile == "not found") { sabundfile = ""; }
                        else {  format = "sabund"; inputfile = sabundfile; m->setSabundFile(sabundfile); }
                        
                        rabundfile = validParameter.validFile(parameters, "rabund", true);
-                       if (rabundfile == "not open") { rabundfile = ""; abort = true; }        
+                       if (rabundfile == "not open") {  abort = true; }        
                        else if (rabundfile == "not found") { rabundfile = ""; }
                        else {  format = "rabund"; inputfile = rabundfile; m->setRabundFile(rabundfile); }
                        
                        sharedfile = validParameter.validFile(parameters, "shared", true);
-                       if (sharedfile == "not open") { sharedfile = ""; abort = true; }        
+                       if (sharedfile == "not open") { abort = true; } 
                        else if (sharedfile == "not found") { sharedfile = ""; }
                        else {  format = "sharedfile"; inputfile = sharedfile; m->setSharedFile(sharedfile); }
                        
                        relabundfile = validParameter.validFile(parameters, "relabund", true);
-                       if (relabundfile == "not open") { relabundfile = ""; abort = true; }    
+                       if (relabundfile == "not open") {  abort = true; }      
                        else if (relabundfile == "not found") { relabundfile = ""; }
                        else {  format = "relabund"; inputfile = relabundfile; m->setRelAbundFile(relabundfile); }
                        
@@ -226,10 +242,10 @@ HeatMapCommand::HeatMapCommand(string option) {
                        }
                        
                        string temp = validParameter.validFile(parameters, "numotu", false);            if (temp == "not found") { temp = "0"; }
-                       convert(temp, numOTU);
+                       m->mothurConvert(temp, numOTU);
                        
                        temp = validParameter.validFile(parameters, "fontsize", false);                         if (temp == "not found") { temp = "24"; }
-                       convert(temp, fontSize);
+                       m->mothurConvert(temp, fontSize);
                        
                        sorted = validParameter.validFile(parameters, "sorted", false);                         
                        if (sorted == "not found") {