]> git.donarmstrong.com Git - mothur.git/blobdiff - summarysharedcommand.cpp
paralellized seq.error and dist.shared added some error checks to libshuff and dist...
[mothur.git] / summarysharedcommand.cpp
index 6db7dab85b9b51ae798aaed4df4bc581adc5db6d..4363eaa9523570cd56146a75805b9dfc8e65e3d7 100644 (file)
@@ -56,7 +56,7 @@ vector<string> SummarySharedCommand::setParameters(){
                CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pshared);
                CommandParameter plabel("label", "String", "", "", "", "", "",false,false); parameters.push_back(plabel);
                CommandParameter pdistance("distance", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(pdistance);
-               CommandParameter pcalc("calc", "Multiple", "sharedchao-sharedsobs-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-whittaker-sharednseqs-ochiai-anderberg-skulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-structchi2-hamming-gower-memchi2-memchord-memeuclidean-mempearson", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan", "", "", "",true,false); parameters.push_back(pcalc);
+               CommandParameter pcalc("calc", "Multiple", "sharedchao-sharedsobs-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-whittaker-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-structchi2-hamming-gower-memchi2-memchord-memeuclidean-mempearson", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan", "", "", "",true,false); parameters.push_back(pcalc);
                CommandParameter pall("all", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(pall);
                CommandParameter pprocessors("processors", "Number", "", "1", "", "", "",false,false); parameters.push_back(pprocessors);
                CommandParameter pgroups("groups", "String", "", "", "", "", "",false,false); parameters.push_back(pgroups);
@@ -89,7 +89,7 @@ string SummarySharedCommand::getHelpString(){
                helpString += "The all parameter is used to specify if you want the estimate of all your groups together.  This estimate can only be made for sharedsobs and sharedchao calculators. The default is false.\n";
                helpString += "If you use sharedchao and run into memory issues, set all to false. \n";
                helpString += "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";
-               helpString += "Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n\n";
+               helpString += "Note: No spaces between parameter labels (i.e. label), '=' and parameters (i.e.yourLabel).\n";
                return helpString;
        }
        catch(exception& e) {
@@ -119,6 +119,7 @@ SummarySharedCommand::SummarySharedCommand(string option)  {
                                
                //allow user to run help
                if(option == "help") {  help(); abort = true; calledHelp = true; }
+               else if(option == "citation") { citation(); abort = true; calledHelp = true;}
                
                else {
                        vector<string> myArray = setParameters();
@@ -183,6 +184,11 @@ SummarySharedCommand::SummarySharedCommand(string option)  {
                                 if (calc == "default")  {  calc = "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan";  }
                        }
                        m->splitAtDash(calc, Estimators);
+                       if (m->inUsersGroups("citation", Estimators)) { 
+                               ValidCalculators validCalc; validCalc.printCitations(Estimators); 
+                               //remove citation from list of calcs
+                               for (int i = 0; i < Estimators.size(); i++) { if (Estimators[i] == "citation") {  Estimators.erase(Estimators.begin()+i); break; } }
+                       }
                        
                        groups = validParameter.validFile(parameters, "groups", false);                 
                        if (groups == "not found") { groups = ""; }
@@ -574,7 +580,7 @@ int SummarySharedCommand::process(vector<SharedRAbundVector*> thisLookup, string
                                                        ifstream intemp;
                                                        m->openInputFile(tempdistFileName, intemp);
                                                        
-                                                       for (int i = 0; i < calcDists.size(); i++) {
+                                                       for (int k = 0; k < calcDists.size(); k++) {
                                                                int size = 0;
                                                                intemp >> size; m->gobble(intemp);
                                                                        
@@ -586,7 +592,7 @@ int SummarySharedCommand::process(vector<SharedRAbundVector*> thisLookup, string
                                                                        intemp >> seq1 >> seq2 >> dist;   m->gobble(intemp);
                                                                        
                                                                        seqDist tempDist(seq1, seq2, dist);
-                                                                       calcDists[i].push_back(tempDist);
+                                                                       calcDists[k].push_back(tempDist);
                                                                }
                                                        }
                                                        intemp.close();