]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed clearcut version bug, added group count output to get.groups and remove.groups
authorwestcott <westcott>
Tue, 22 Mar 2011 11:38:42 +0000 (11:38 +0000)
committerwestcott <westcott>
Tue, 22 Mar 2011 11:38:42 +0000 (11:38 +0000)
cmdargs.cpp
getgroupscommand.cpp
helpcommand.cpp
removegroupscommand.cpp
sffinfocommand.cpp

index 481244256a0274bafa970461d4296e5bb6c065d2..929b4aac886d97135f7d9883396e9a2a3fb292b5 100644 (file)
@@ -259,12 +259,12 @@ NJ_handle_args(int argc,
   
   if(nj_args.version) {
     printf("Clearcut Version: %s\n", NJ_VERSION);
-    exit(0);
+   //exit(0);
   }
   
   if(nj_args.help) {
     NJ_usage();
-    exit(0);
+    //exit(0);
   }
   
   /* if stdin & explicit filename are specified for input */
index ac76d7397a004634e2b3d9a2c879e20ea7e95f2c..7d81aaa8848749a9bf53e3e2663791e3798b419c 100644 (file)
@@ -250,9 +250,11 @@ int GetGroupsCommand::execute(){
                if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {        remove(outputNames[i].c_str()); } return 0; }
                
                m->mothurOut("Selected " + toString(names.size()) + " sequences. From the groups: "); m->mothurOutEndLine();
-               for (int i = 0; i < Groups.size(); i++) {       m->mothurOut(Groups[i]); m->mothurOutEndLine(); }
+               for (int i = 0; i < Groups.size(); i++) {       m->mothurOut(Groups[i]); m->mothurOut(" contains " + toString(groupMap->getNumSeqs(Groups[i]))); m->mothurOutEndLine(); }
                m->mothurOutEndLine();
                
+               
+               
                if (outputNames.size() != 0) {
                        m->mothurOutEndLine();
                        m->mothurOut("Output File names: "); m->mothurOutEndLine();
index aeb7efc0b77e0ee0a04e5310af8d81c0049e72a7..3c799b0903afdc58c20a244356b3ecd8f51cf972 100644 (file)
@@ -58,12 +58,18 @@ HelpCommand::~HelpCommand(){}
 //**********************************************************************************************************************
 
 int HelpCommand::execute(){
-       validCommands->printCommands(cout);
-       m->mothurOut("For more information about a specific command type 'commandName(help)' i.e. 'read.dist(help)'"); m->mothurOutEndLine();
+       try {
+               validCommands->printCommands(cout);
+               m->mothurOut("For more information about a specific command type 'commandName(help)' i.e. 'read.dist(help)'"); m->mothurOutEndLine();
        
-       m->mothurOutEndLine(); m->mothurOut("For further assistance please refer to the Mothur manual on our wiki at http://www.mothur.org/wiki, or contact Pat Schloss at mothur.bugs@gmail.com.\n");
+               m->mothurOutEndLine(); m->mothurOut("For further assistance please refer to the Mothur manual on our wiki at http://www.mothur.org/wiki, or contact Pat Schloss at mothur.bugs@gmail.com.\n");
        
-       return 0;
+               return 0;
+       }
+       catch(exception& e) {
+               m->errorOut(e, "HelpCommand", "execute");
+               exit(1);
+       }
 }
 
 //**********************************************************************************************************************/
index 34a072b30a0b563fd22ddef60099224bdc6bf9f0..f70edb6bf9a6f9bde11b6eed03214fb624b6c6ca 100644 (file)
@@ -250,7 +250,7 @@ int RemoveGroupsCommand::execute(){
                if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {        remove(outputNames[i].c_str()); } return 0; }
                
                m->mothurOut("Removed " + toString(names.size()) + " sequences. From the groups: "); m->mothurOutEndLine();
-               for (int i = 0; i < Groups.size(); i++) {       m->mothurOut(Groups[i]); m->mothurOutEndLine(); }
+               for (int i = 0; i < Groups.size(); i++) {       m->mothurOut(Groups[i]); m->mothurOut(" contains " + toString(groupMap->getNumSeqs(Groups[i]))); m->mothurOutEndLine(); }
                m->mothurOutEndLine();
                
                if (outputNames.size() != 0) {
index 973e14f4fd68416bac6949a149a75bb5fbe174c4..2caad96df797bc2d5dca067a4ae2b3f4a4ebed5c 100644 (file)
@@ -625,32 +625,36 @@ int SffInfoCommand::readSeqData(ifstream& in, seqRead& read, int numFlowReads, i
 int SffInfoCommand::decodeName(string& timestamp, string& region, string& xy, string name) {
        try {
                
-               string time = name.substr(0, 6);
-               unsigned int timeNum = m->fromBase36(time);
-                       
-               int q1 = timeNum / 60;
-               int sec = timeNum - 60 * q1;
-               int q2 = q1 / 60;
-               int minute = q1 - 60 * q2;
-               int q3 = q2 / 24;
-               int hr = q2 - 24 * q3;
-               int q4 = q3 / 32;
-               int day = q3 - 32 * q4;
-               int q5 = q4 / 13;
-               int mon = q4 - 13 * q5;
-               int year = 2000 + q5;
-               
-               timestamp = toString(year) + "_" + toString(mon) + "_" + toString(day) + "_" + toString(hr) + "_" + toString(minute) + "_" + toString(sec);
-               
-               region = name.substr(7, 2);
-               
-               string xyNum = name.substr(9);
-               unsigned int myXy = m->fromBase36(xyNum);
-               int x = myXy >> 12;
-               int y = myXy & 4095;
-               
-               xy = toString(x) + "_" + toString(y);
+               if (name.length() >= 6) {
+                       string time = name.substr(0, 6);
+                       unsigned int timeNum = m->fromBase36(time);
                        
+                       int q1 = timeNum / 60;
+                       int sec = timeNum - 60 * q1;
+                       int q2 = q1 / 60;
+                       int minute = q1 - 60 * q2;
+                       int q3 = q2 / 24;
+                       int hr = q2 - 24 * q3;
+                       int q4 = q3 / 32;
+                       int day = q3 - 32 * q4;
+                       int q5 = q4 / 13;
+                       int mon = q4 - 13 * q5;
+                       int year = 2000 + q5;
+               
+                       timestamp = toString(year) + "_" + toString(mon) + "_" + toString(day) + "_" + toString(hr) + "_" + toString(minute) + "_" + toString(sec);
+               }
+               
+               if (name.length() >= 9) {
+                       region = name.substr(7, 2);
+               
+                       string xyNum = name.substr(9);
+                       unsigned int myXy = m->fromBase36(xyNum);
+                       int x = myXy >> 12;
+                       int y = myXy & 4095;
+               
+                       xy = toString(x) + "_" + toString(y);
+               }
+               
                return 0;
        }
        catch(exception& e) {