]> git.donarmstrong.com Git - mothur.git/blobdiff - normalizesharedcommand.cpp
indicator command
[mothur.git] / normalizesharedcommand.cpp
index 8a6b4adf524a40f8e38c350f6f322f7a9e1effe3..a4bdd47099c350e77cfe238bcf34e254d1db9341 100644 (file)
@@ -45,7 +45,7 @@ string NormalizeSharedCommand::getHelpString(){
                helpString += "Example normalize.shared(groups=A-B-C, scale=totalgroup).\n";
                helpString += "The default value for groups is all the groups in your groupfile, and all labels in your inputfile will be used.\n";
                helpString += "The normalize.shared command outputs a .norm.shared file.\n";
-               helpString += "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n";
+               helpString += "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n";
                return helpString;
        }
        catch(exception& e) {
@@ -77,6 +77,7 @@ NormalizeSharedCommand::NormalizeSharedCommand(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();
@@ -121,12 +122,12 @@ NormalizeSharedCommand::NormalizeSharedCommand(string option) {
                        sharedfile = validParameter.validFile(parameters, "shared", true);
                        if (sharedfile == "not open") { sharedfile = ""; abort = true; }        
                        else if (sharedfile == "not found") { sharedfile = ""; }
-                       else {  format = "sharedfile"; inputfile = sharedfile; }
+                       else {  format = "sharedfile"; inputfile = sharedfile; m->setSharedFile(sharedfile); }
                        
                        relabundfile = validParameter.validFile(parameters, "relabund", true);
                        if (relabundfile == "not open") { relabundfile = ""; abort = true; }    
                        else if (relabundfile == "not found") { relabundfile = ""; }
-                       else {  format = "relabund"; inputfile = relabundfile; }
+                       else {  format = "relabund"; inputfile = relabundfile; m->setRelAbundFile(relabundfile); }
                        
                        
                        if ((sharedfile == "") && (relabundfile == "")) { 
@@ -239,6 +240,7 @@ int NormalizeSharedCommand::execute(){
                                m->mothurOut("Normalizing to " + toString(norm) + "."); m->mothurOutEndLine();
                        }
                        
+                       
                        //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))) {
                                
@@ -247,6 +249,7 @@ int NormalizeSharedCommand::execute(){
                                if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){                  
                                        
                                        m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
+                                       if (!m->printedHeaders) { lookup[0]->printHeaders(out); }
                                        normalize(lookup, out);
                                        
                                        processedLabels.insert(lookup[0]->getLabel());
@@ -259,7 +262,7 @@ int NormalizeSharedCommand::execute(){
                                        for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }  
                                        lookup = input->getSharedRAbundVectors(lastLabel);
                                        m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
-                                       
+                                       if (!m->printedHeaders) { lookup[0]->printHeaders(out); }
                                        normalize(lookup, out);
                                        
                                        processedLabels.insert(lookup[0]->getLabel());
@@ -300,7 +303,7 @@ int NormalizeSharedCommand::execute(){
                                lookup = input->getSharedRAbundVectors(lastLabel);
                                
                                m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
-                               
+                               if (!m->printedHeaders) { lookup[0]->printHeaders(out); }
                                normalize(lookup, out);
                                
                                for (int i = 0; i < lookup.size(); i++) {  delete lookup[i];  }
@@ -350,6 +353,8 @@ int NormalizeSharedCommand::execute(){
                                if(allLines == 1 || labels.count(lookupFloat[0]->getLabel()) == 1){                     
                                        
                                        m->mothurOut(lookupFloat[0]->getLabel()); m->mothurOutEndLine();
+                                       
+                                       if (!m->printedHeaders) { lookupFloat[0]->printHeaders(out); }
                                        normalize(lookupFloat, out);
                                        
                                        processedLabels.insert(lookupFloat[0]->getLabel());
@@ -361,8 +366,9 @@ int NormalizeSharedCommand::execute(){
                                        
                                        for (int i = 0; i < lookupFloat.size(); i++) {  delete lookupFloat[i];  }  
                                        lookupFloat = input->getSharedRAbundFloatVectors(lastLabel);
-                                       m->mothurOut(lookupFloat[0]->getLabel()); m->mothurOutEndLine();
                                        
+                                       m->mothurOut(lookupFloat[0]->getLabel()); m->mothurOutEndLine();
+                                       if (!m->printedHeaders) { lookupFloat[0]->printHeaders(out); }
                                        normalize(lookupFloat, out);
                                        
                                        processedLabels.insert(lookupFloat[0]->getLabel());
@@ -404,6 +410,7 @@ int NormalizeSharedCommand::execute(){
                                
                                m->mothurOut(lookupFloat[0]->getLabel()); m->mothurOutEndLine();
                                
+                               if (!m->printedHeaders) { lookupFloat[0]->printHeaders(out); }
                                normalize(lookupFloat, out);
                                
                                for (int i = 0; i < lookupFloat.size(); i++) {  delete lookupFloat[i];  }