]> git.donarmstrong.com Git - mothur.git/blobdiff - heatmapcommand.cpp
added set.dir command and modified commands to redirect input and output, removed...
[mothur.git] / heatmapcommand.cpp
index 1992ce593a7e65c2638f7d5ac0c5f39e4f50b5f9..04f12456a49b623a82bf3e009929d7a31870da35 100644 (file)
@@ -24,7 +24,7 @@ HeatMapCommand::HeatMapCommand(string option){
                
                else {
                        //valid paramters for this command
-                       string AlignArray[] =  {"groups","label","sorted","scale"};
+                       string AlignArray[] =  {"groups","label","sorted","scale","outputdir","inputdir"};
                        vector<string> myArray (AlignArray, AlignArray+(sizeof(AlignArray)/sizeof(string)));
                        
                        OptionParser parser(option);
@@ -37,6 +37,12 @@ HeatMapCommand::HeatMapCommand(string option){
                                if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
                        }
                        
+                       //if the user changes the output directory command factory will send this info to us in the output parameter 
+                       outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
+                               outputDir = ""; 
+                               outputDir += hasPath(globaldata->inputFileName); //if user entered a file with a path then preserve it  
+                       }
+                       
                        //make sure the user has already run the read.otu command
                        if ((globaldata->getListFile() == "") && (globaldata->getRabundFile() == "") && (globaldata->getSabundFile() == "") && (globaldata->getSharedFile() == "")) {
                                 mothurOut("You must read a list, rabund, sabund, or a list and a group, or a shared before you can use the heatmap.bin command."); mothurOutEndLine(); abort = true; 
@@ -69,7 +75,7 @@ HeatMapCommand::HeatMapCommand(string option){
                        scale = validParameter.validFile(parameters, "scale", false);                           if (scale == "not found") { scale = "log10"; }
                        
                        if (abort == false) {
-                               heatmap = new HeatMap(sorted, scale);
+                               heatmap = new HeatMap(sorted, scale, outputDir);
                                format = globaldata->getFormat();
                        }
                }