]> git.donarmstrong.com Git - mothur.git/blobdiff - newcommandtemplate.cpp
sffinfo bug with flow grams right index when clipQualRight=0
[mothur.git] / newcommandtemplate.cpp
index 92992061f29e2d01a65eb09445e6827caef2624f..b9dc986a7fa10f933cff0add5092e76a4ce62e5c 100644 (file)
@@ -6,37 +6,37 @@
 //  Copyright (c) 2012 Schloss Lab. All rights reserved.
 //
 
-
+//
 #include "newcommandtemplate.h"
 
 //**********************************************************************************************************************
 vector<string> NewCommand::setParameters(){    
        try {
                //eaxamples of each type of parameter. more info on the types of parameters can be found in commandparameter.h
-               CommandParameter pprocessors("processors", "Number", "", "1", "", "", "",false,false); parameters.push_back(pprocessors);
+               CommandParameter pprocessors("processors", "Number", "", "1", "", "", "","",false,false); parameters.push_back(pprocessors);
         
         //files that have dependancies
-        CommandParameter pphylip("phylip", "InputTypes", "", "", "PhylipColumn", "PhylipColumn", "none",false,false); parameters.push_back(pphylip);
-               CommandParameter pname("name", "InputTypes", "", "", "none", "none", "ColumnName",false,false); parameters.push_back(pname);
-               CommandParameter pcolumn("column", "InputTypes", "", "", "PhylipColumn", "PhylipColumn", "ColumnName",false,false); parameters.push_back(pcolumn);              
+        CommandParameter pphylip("phylip", "InputTypes", "", "", "PhylipColumn", "PhylipColumn", "none","outputType",false,false); parameters.push_back(pphylip);
+               CommandParameter pname("name", "InputTypes", "", "", "none", "none", "ColumnName","outputType",false,false); parameters.push_back(pname);
+               CommandParameter pcolumn("column", "InputTypes", "", "", "PhylipColumn", "PhylipColumn", "ColumnName","outputType",false,false); parameters.push_back(pcolumn);         
         //files that do not have dependancies - fasta is set to not be required whereas shared is set to be required
-               CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pfasta);
-        CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pshared);            
+               CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none","outputType",false,false); parameters.push_back(pfasta);
+        CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none","outputType",false,true); parameters.push_back(pshared);               
 
         
-        CommandParameter pgroups("groups", "String", "", "", "", "", "",false,false); parameters.push_back(pgroups);
-               CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel);
+        CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups);
+               CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
                
         //choose more than one multiple options
-        CommandParameter pcalc("calc", "Multiple", "jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-morisitahorn-braycurtis", "jest-thetayc", "", "", "",true,false); parameters.push_back(pcalc);
+        CommandParameter pcalc("calc", "Multiple", "jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-morisitahorn-braycurtis", "jest-thetayc", "", "", "","",true,false); parameters.push_back(pcalc);
         //choose only one multiple options
-        CommandParameter pdistance("distance", "Multiple", "column-lt-square", "column", "", "", "",false,false); parameters.push_back(pdistance);
+        CommandParameter pdistance("distance", "Multiple", "column-lt-square", "column", "", "", "","",false,false); parameters.push_back(pdistance);
         
-        CommandParameter ptiming("timing", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(ptiming);
+        CommandParameter ptiming("timing", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(ptiming);
         
         //every command must have inputdir and outputdir.  This allows mothur users to redirect input and output files.
-               CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
-               CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
+               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);          }
@@ -64,6 +64,23 @@ string NewCommand::getHelpString(){
        }
 }
 //**********************************************************************************************************************
+string NewCommand::getOutputPattern(string type) {
+    try {
+        string pattern = "";
+        
+        if (type == "fileType1") {  pattern = "[filename],tag1"; }
+        else if (type == "fileType2") {  pattern = "[filename],tag2"; }
+        else if (type == "fileType3") {  pattern = "[filename],tag3"; }
+        else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true;  }
+        
+        return pattern;
+    }
+    catch(exception& e) {
+        m->errorOut(e, "NewCommand", "getOutputPattern");
+        exit(1);
+    }
+}
+//**********************************************************************************************************************
 NewCommand::NewCommand(){      
        try {
                abort = true; calledHelp = true;
@@ -71,7 +88,7 @@ NewCommand::NewCommand(){
         vector<string> tempOutNames;
                outputTypes["fileType1"] = tempOutNames; //filetypes should be things like: shared, fasta, accnos...
                outputTypes["fileType2"] = tempOutNames;
-               outputTypes["FileType2"] = tempOutNames;
+               outputTypes["FileType3"] = tempOutNames;
        }
        catch(exception& e) {
                m->errorOut(e, "NewCommand", "NewCommand");
@@ -166,7 +183,7 @@ NewCommand::NewCommand(string option)  {
             
             ///variables for examples below that you will most likely want to put in the header for 
             //use by the other class functions.
-            string phylipfile, columnfile, namefile, fastafile, sharedfile, method;
+            string phylipfile, columnfile, namefile, fastafile, sharedfile, method, countfile;
             int processors;
             bool useTiming, allLines;
             vector<string> Estimators, Groups;
@@ -287,10 +304,13 @@ NewCommand::NewCommand(string option)  {
             //saved by mothur that is associated with the other files you are using as inputs.  
             //You can do so by adding the files associated with the namefile to the files vector and then asking parser to check.  
             //This saves our users headaches over file mismatches because they forgot to include the namefile, :)
-            if (namefile == "") {
-                               vector<string> files; files.push_back(fastafile);
-                               parser.getNameFile(files);
-                       }
+            if (countfile == "") { 
+                if (namefile == "") {
+                    vector<string> files; files.push_back(fastafile);
+                    parser.getNameFile(files);
+                }
+            }
+
                        
                }