]> git.donarmstrong.com Git - mothur.git/blobdiff - rarefactsharedcommand.cpp
removed line option
[mothur.git] / rarefactsharedcommand.cpp
index 7e1b4773ddb0505861fd90a2c0064b37ce5e9c59..022ae65bf8530da954589881fbcfa811adba8082 100644 (file)
@@ -19,7 +19,6 @@ RareFactSharedCommand::RareFactSharedCommand(string option){
                
                abort = false;
                allLines = 1;
-               lines.clear();
                labels.clear();
                Estimators.clear();
                Groups.clear();
@@ -29,7 +28,7 @@ RareFactSharedCommand::RareFactSharedCommand(string option){
                
                else {
                        //valid paramters for this command
-                       string Array[] =  {"iters","line","label","calc","groups", "jumble"};
+                       string Array[] =  {"iters","label","calc","groups", "jumble"};
                        vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
                        
                        OptionParser parser(option);
@@ -51,13 +50,6 @@ RareFactSharedCommand::RareFactSharedCommand(string option){
                        
                        //check for optional parameter and set defaults
                        // ...at some point should added some additional type checking...
-                       line = validParameter.validFile(parameters, "line", false);                             
-                       if (line == "not found") { line = "";  }
-                       else { 
-                               if(line != "all") {  splitAtDash(line, lines);  allLines = 0;  }
-                               else { allLines = 1;  }
-                       }
-                       
                        label = validParameter.validFile(parameters, "label", false);                   
                        if (label == "not found") { label = ""; }
                        else { 
@@ -65,13 +57,10 @@ RareFactSharedCommand::RareFactSharedCommand(string option){
                                else { allLines = 1;  }
                        }
                        
-                       //make sure user did not use both the line and label parameters
-                       if ((line != "") && (label != "")) { mothurOut("You cannot use both the line and label parameters at the same time. "); mothurOutEndLine(); abort = true; }
-                       //if the user has not specified any line or labels use the ones from read.otu
-                       else if((line == "") && (label == "")) {  
+                       //if the user has not specified any labels use the ones from read.otu
+                       if(label == "") {  
                                allLines = globaldata->allLines; 
                                labels = globaldata->labels; 
-                               lines = globaldata->lines;
                        }
                                
                        calc = validParameter.validFile(parameters, "calc", false);                     
@@ -130,14 +119,14 @@ RareFactSharedCommand::RareFactSharedCommand(string option){
 void RareFactSharedCommand::help(){
        try {
                mothurOut("The rarefaction.shared command can only be executed after a successful read.otu command.\n");
-               mothurOut("The rarefaction.shared command parameters are label, line, iters, groups, jumble and calc.  No parameters are required, but you may not use \n");
-               mothurOut("both the line and label parameters at the same time. The rarefaction command should be in the following format: \n");
-               mothurOut("rarefaction.shared(label=yourLabel, line=yourLines, iters=yourIters, calc=yourEstimators, jumble=yourJumble, groups=yourGroups).\n");
-               mothurOut("Example rarefaction.shared(label=unique-.01-.03, line=0-5-10, iters=10000, groups=B-C, jumble=T, calc=sharedobserved).\n");
+               mothurOut("The rarefaction.shared command parameters are label, iters, groups, jumble and calc.  No parameters are required.\n");
+               mothurOut("The rarefaction command should be in the following format: \n");
+               mothurOut("rarefaction.shared(label=yourLabel, iters=yourIters, calc=yourEstimators, jumble=yourJumble, groups=yourGroups).\n");
+               mothurOut("Example rarefaction.shared(label=unique-0.01-0.03,  iters=10000, groups=B-C, jumble=T, calc=sharedobserved).\n");
                mothurOut("The default values for iters is 1000, freq is 100, and calc is sharedobserved which calculates the shared rarefaction curve for the observed richness.\n");
                mothurOut("The default value for groups is all the groups in your groupfile, and jumble is true.\n");
                validCalculator->printCalc("sharedrarefaction", cout);
-               mothurOut("The label and line parameters are used to analyze specific lines in your input.\n");
+               mothurOut("The label parameter is used to analyze specific labels in your input.\n");
                mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
                mothurOut("Note: No spaces between parameter labels (i.e. freq), '=' and parameters (i.e.yourFreq).\n\n");
        }
@@ -164,8 +153,6 @@ int RareFactSharedCommand::execute(){
        
                if (abort == true) { return 0; }
                
-               int count = 1;
-               
                //if the users entered no valid calculators don't execute command
                if (rDisplays.size() == 0) { return 0; }
 
@@ -185,12 +172,11 @@ int RareFactSharedCommand::execute(){
                //if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
                set<string> processedLabels;
                set<string> userLabels = labels;
-               set<int> userLines = lines;
        
                //as long as you are not at the end of the file or done wih the lines you want
-               while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
+               while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
                        
-                       if(allLines == 1 || lines.count(count) == 1 || labels.count(lookup[0]->getLabel()) == 1){
+                       if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){
                                
                                rCurve = new Rarefact(lookup, rDisplays);
                                rCurve->getSharedCurve(freq, nIters);
@@ -199,7 +185,6 @@ int RareFactSharedCommand::execute(){
                                mothurOut(lookup[0]->getLabel()); mothurOutEndLine();
                                processedLabels.insert(lookup[0]->getLabel());
                                userLabels.erase(lookup[0]->getLabel());
-                               userLines.erase(count);
                        }
                        
                        if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) {
@@ -221,7 +206,6 @@ int RareFactSharedCommand::execute(){
                        //get next line to process
                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  } 
                        lookup = input->getSharedRAbundVectors();
-                       count++;
                }
                
                //output error messages about any remaining user labels
@@ -237,7 +221,7 @@ int RareFactSharedCommand::execute(){
                        }
                }
                
-               //run last line if you need to
+               //run last label if you need to
                if (needToRun == true)  {
                        for (int i = 0; i < lookup.size(); i++) {  if (lookup[i] != NULL) {     delete lookup[i]; }  } 
                        lookup = input->getSharedRAbundVectors(lastLabel);