From: westcott Date: Tue, 22 Mar 2011 11:38:42 +0000 (+0000) Subject: fixed clearcut version bug, added group count output to get.groups and remove.groups X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=d0954e27635712cdbd8b86e3c4510670803a2665 fixed clearcut version bug, added group count output to get.groups and remove.groups --- diff --git a/cmdargs.cpp b/cmdargs.cpp index 4812442..929b4aa 100644 --- a/cmdargs.cpp +++ b/cmdargs.cpp @@ -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 */ diff --git a/getgroupscommand.cpp b/getgroupscommand.cpp index ac76d73..7d81aaa 100644 --- a/getgroupscommand.cpp +++ b/getgroupscommand.cpp @@ -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(); diff --git a/helpcommand.cpp b/helpcommand.cpp index aeb7efc..3c799b0 100644 --- a/helpcommand.cpp +++ b/helpcommand.cpp @@ -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); + } } //**********************************************************************************************************************/ diff --git a/removegroupscommand.cpp b/removegroupscommand.cpp index 34a072b..f70edb6 100644 --- a/removegroupscommand.cpp +++ b/removegroupscommand.cpp @@ -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) { diff --git a/sffinfocommand.cpp b/sffinfocommand.cpp index 973e14f..2caad96 100644 --- a/sffinfocommand.cpp +++ b/sffinfocommand.cpp @@ -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) {