X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=readdistcommand.cpp;h=8bf6996333b246814a28009d309ab8f3b6bf8718;hb=2bb9267aa4b4ecdf8488b06605cc9f3f36fa4332;hp=630f6493fef9b542dfd8fea434f935987b6ac98f;hpb=c69e2e9749626cfbf1d6cb0125ae94f869e00b18;p=mothur.git diff --git a/readdistcommand.cpp b/readdistcommand.cpp index 630f649..8bf6996 100644 --- a/readdistcommand.cpp +++ b/readdistcommand.cpp @@ -12,52 +12,17 @@ #include "readcolumn.h" #include "readmatrix.hpp" -//********************************************************************************************************************** -vector ReadDistCommand::getValidParameters(){ - try { - string Array[] = {"phylip", "column", "name", "cutoff", "precision", "group","outputdir","inputdir","sim"}; - vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); - return myArray; - } - catch(exception& e) { - m->errorOut(e, "ReadDistCommand", "getValidParameters"); - exit(1); - } -} -//********************************************************************************************************************** -vector ReadDistCommand::getRequiredParameters(){ - try { - string Array[] = {"phylip","column","or"}; - vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); - return myArray; - } - catch(exception& e) { - m->errorOut(e, "ReadDistCommand", "getRequiredParameters"); - exit(1); - } -} -//********************************************************************************************************************** -vector ReadDistCommand::getRequiredFiles(){ - try { - vector myArray; - return myArray; - } - catch(exception& e) { - m->errorOut(e, "ReadDistCommand", "getRequiredFiles"); - exit(1); - } -} //********************************************************************************************************************** ReadDistCommand::ReadDistCommand(string option) { try { - globaldata = GlobalData::getInstance(); abort = false; calledHelp = false; //allow user to run help if(option == "help") { help(); abort = true; calledHelp = true; } + else if(option == "citation") { citation(); abort = true; calledHelp = true;} else { - //valid paramters for this command + /*//valid paramters for this command string Array[] = {"phylip", "column", "name", "cutoff", "precision", "group","outputdir","inputdir","sim"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); @@ -156,7 +121,7 @@ ReadDistCommand::ReadDistCommand(string option) { //get user cutoff and precision or use defaults string temp; temp = validParameter.validFile(parameters, "precision", false); if (temp == "not found") { temp = "100"; } - convert(temp, precision); + m->mothurConvert(temp, precision); temp = validParameter.validFile(parameters, "sim", false); if (temp == "not found") { temp = "F"; } sim = m->isTrue(temp); @@ -193,7 +158,7 @@ ReadDistCommand::ReadDistCommand(string option) { } } } - +*/ } } @@ -202,45 +167,13 @@ ReadDistCommand::ReadDistCommand(string option) { exit(1); } } -//********************************************************************************************************************** - -void ReadDistCommand::help(){ - try { - m->mothurOut("The read.dist command parameter options are phylip or column, group, name, sim, cutoff and precision\n"); - m->mothurOut("The read.dist command can be used in two ways. The first is to read a phylip or column and run the cluster command\n"); - m->mothurOut("For this use the read.dist command should be in the following format: \n"); - m->mothurOut("read.dist(phylip=yourDistFile, name=yourNameFile, cutoff=yourCutoff, precision=yourPrecision) \n"); - m->mothurOut("The phylip or column parameter is required, but only one may be used. If you use a column file the name filename is required. \n"); - m->mothurOut("The sim parameter is used to indicate that your distance file contains similarity values instead of distance values. The default is false, if sim=true then mothur will convert the similarity values to distances. \n"); - m->mothurOut("If you do not provide a cutoff value 10.00 is assumed. If you do not provide a precision value then 100 is assumed.\n"); - m->mothurOut("The second way to use the read.dist command is to read a phylip or column and a group, so you can use the libshuff command.\n"); - m->mothurOut("For this use the read.dist command should be in the following format: \n"); - m->mothurOut("read.dist(phylip=yourPhylipfile, group=yourGroupFile). The cutoff and precision parameters are not valid with this use. \n"); - m->mothurOut("Note: No spaces between parameter labels (i.e. phylip), '=' and parameters (i.e.yourPhylipfile).\n\n"); - } - catch(exception& e) { - m->errorOut(e, "ReadDistCommand", "help"); - exit(1); - } -} - -//********************************************************************************************************************** - -ReadDistCommand::~ReadDistCommand(){ - if (abort == false) { - if (format != "matrix") { - delete read; - delete nameMap; - } - } -} - //********************************************************************************************************************** int ReadDistCommand::execute(){ try { if (abort == true) { if (calledHelp) { return 0; } return 2; } - + m->mothurOut(getHelpString()); m->mothurOutEndLine(); +/* time_t start = time(NULL); size_t numDists = 0; @@ -264,7 +197,7 @@ int ReadDistCommand::execute(){ m->openOutputFile(newGroupFile, outGroups); for (int i = 0; i < matrix->getNumSeqs(); i++) { - if (m->control_pressed) { delete groupMap; delete matrix; outGroups.close(); remove(newGroupFile.c_str()); return 0; } + if (m->control_pressed) { delete groupMap; delete matrix; outGroups.close(); m->mothurRemove(newGroupFile); return 0; } Names temp = matrix->getRowInfo(i); outGroups << temp.seqName << '\t' << temp.groupName << endl; @@ -281,7 +214,7 @@ int ReadDistCommand::execute(){ groupMap = new GroupMap(groupfile); groupMap->readMap(); - if (m->control_pressed) { delete groupMap; delete matrix; remove(newGroupFile.c_str()); return 0; } + if (m->control_pressed) { delete groupMap; delete matrix; m->mothurRemove(newGroupFile); return 0; } globaldata->gGroupmap = groupMap; } @@ -314,6 +247,7 @@ int ReadDistCommand::execute(){ } m->mothurOut("It took " + toString(time(NULL) - start) + " secs to read "); m->mothurOutEndLine(); + */ return 0; }