]> git.donarmstrong.com Git - mothur.git/blobdiff - secondarystructurecommand.cpp
major change to the tree class to use the count table class instead of tree map....
[mothur.git] / secondarystructurecommand.cpp
index 24142e0cf4aa6174a8006f1e0a7a85c82f10ab24..869df029fdd35efa6c3e9a9a22d46c6c4fea6667 100644 (file)
@@ -15,7 +15,8 @@ vector<string> AlignCheckCommand::setParameters(){
        try {
                CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pfasta);
                CommandParameter pmap("map", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pmap);
-               CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
+        CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pname);
+        CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
                CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
                
                vector<string> myArray;
@@ -31,7 +32,7 @@ vector<string> AlignCheckCommand::setParameters(){
 string AlignCheckCommand::getHelpString(){     
        try {
                string helpString = "";
-               helpString += "The align.check command reads a fasta file and map file.\n";
+               helpString += "The align.check command reads a fasta file and map file as well as an optional name file.\n";
                helpString += "It outputs a file containing the secondary structure matches in the .align.check file.\n";
                helpString += "The align.check command parameters are fasta and map, both are required.\n";
                helpString += "The align.check command should be in the following format: align.check(fasta=yourFasta, map=yourMap).\n";
@@ -45,6 +46,26 @@ string AlignCheckCommand::getHelpString(){
        }
 }
 //**********************************************************************************************************************
+string AlignCheckCommand::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 == "aligncheck")            {   outputFileName =  "align.check";   }
+            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, "AlignCheckCommand", "getOutputFileNameTag");
+               exit(1);
+       }
+}
+//**********************************************************************************************************************
 AlignCheckCommand::AlignCheckCommand(){        
        try {
                abort = true; calledHelp = true; 
@@ -170,7 +191,7 @@ int AlignCheckCommand::execute(){
                m->openInputFile(fastafile, in);
                
                ofstream out;
-               string outfile = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "align.check";
+               string outfile = outputDir + m->getRootName(m->getSimpleName(fastafile)) + getOutputFileNameTag("aligncheck");
                m->openOutputFile(outfile, out);