]> git.donarmstrong.com Git - mothur.git/blobdiff - countseqscommand.cpp
added otu.association command. added calcSpearman, calcKendall and calcPearson functi...
[mothur.git] / countseqscommand.cpp
index a4464692607df14d08384f3cfdf112a4e18debb8..9cdd033ac29609d6f763f52597a4809fea204326 100644 (file)
@@ -117,11 +117,12 @@ CountSeqsCommand::CountSeqsCommand(string option)  {
                                namefile = m->getNameFile(); 
                                if (namefile != "") { m->mothurOut("Using " + namefile + " as input file for the name parameter."); m->mothurOutEndLine(); }
                                else {  m->mothurOut("You have no current namefile and the name parameter is required."); m->mothurOutEndLine(); abort = true; }
-                       }
+                       }else { m->setNameFile(namefile); }
                        
                        groupfile = validParameter.validFile(parameters, "group", true);
                        if (groupfile == "not open") { abort = true; }
                        else if (groupfile == "not found") {  groupfile = "";  }        
+                       else { m->setGroupFile(groupfile); }
                        
                        groups = validParameter.validFile(parameters, "groups", false);                 
                        if (groups == "not found") { groups = "all"; }
@@ -146,9 +147,9 @@ int CountSeqsCommand::execute(){
                if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                ofstream out;
-               string outputFileName = outputDir + m->getRootName(m->getSimpleName(namefile)) + ".seq.count";
+               string outputFileName = outputDir + m->getRootName(m->getSimpleName(namefile)) + "seq.count";
                m->openOutputFile(outputFileName, out); outputTypes["summary"].push_back(outputFileName);
-               out << "Representative Sequence\t total\t";
+               out << "Representative_Sequence\ttotal\t";
                
                GroupMap* groupMap;
                if (groupfile != "") { 
@@ -156,7 +157,8 @@ int CountSeqsCommand::execute(){
                        
                        //make sure groups are valid. takes care of user setting groupNames that are invalid or setting groups=all
                        SharedUtil* util = new SharedUtil();
-                       util->setGroups(Groups, groupMap->namesOfGroups);
+                       vector<string> nameGroups = groupMap->getNamesOfGroups();
+                       util->setGroups(Groups, nameGroups);
                        delete util;
                        
                        //sort groupNames so that the group title match the counts below, this is needed because the map object automatically sorts
@@ -221,7 +223,7 @@ int CountSeqsCommand::execute(){
                
                if (groupfile != "") { delete groupMap; }
                
-               if (m->control_pressed) { remove(outputFileName.c_str()); return 0; }
+               if (m->control_pressed) { m->mothurRemove(outputFileName); return 0; }
                
                m->mothurOutEndLine();
                m->mothurOut("Output File Name: "); m->mothurOutEndLine();