X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mgclustercommand.cpp;h=06f05192ad1e91a1c85b2de8e986039d82d5c375;hb=13f0aaa1f941bb5c066e626331549fa177810732;hp=61e130647c6734ee49ba99b0bcded20804ee103d;hpb=38491018f166c7c5517518cfa64832582f20dd85;p=mothur.git diff --git a/mgclustercommand.cpp b/mgclustercommand.cpp index 61e1306..06f0519 100644 --- a/mgclustercommand.cpp +++ b/mgclustercommand.cpp @@ -14,6 +14,7 @@ vector MGClusterCommand::setParameters(){ try { CommandParameter pblast("blast", "InputTypes", "", "", "none", "none", "none",false,true); parameters.push_back(pblast); CommandParameter pname("name", "InputTypes", "", "", "none", "none", "none",false,false); parameters.push_back(pname); + CommandParameter plarge("large", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(plarge); CommandParameter plength("length", "Number", "", "5", "", "", "",false,false); parameters.push_back(plength); CommandParameter ppenalty("penalty", "Number", "", "0.10", "", "", "",false,false); parameters.push_back(ppenalty); CommandParameter pcutoff("cutoff", "Number", "", "0.70", "", "", "",false,false); parameters.push_back(pcutoff); @@ -169,6 +170,9 @@ MGClusterCommand::MGClusterCommand(string option) { //check for optional parameter and set defaults string temp; + temp = validParameter.validFile(parameters, "large", false); if (temp == "not found") { temp = "false"; } + large = m->isTrue(temp); + temp = validParameter.validFile(parameters, "precision", false); if (temp == "not found") { temp = "100"; } precisionLength = temp.length(); m->mothurConvert(temp, precision); @@ -199,7 +203,7 @@ MGClusterCommand::MGClusterCommand(string option) { hclusterWanted = m->isTrue(temp); temp = validParameter.validFile(parameters, "hard", false); if (temp == "not found") { temp = "T"; } - hard = m->isTrue(temp); + hard = m->isTrue(temp); } } @@ -211,7 +215,7 @@ MGClusterCommand::MGClusterCommand(string option) { //********************************************************************************************************************** int MGClusterCommand::execute(){ try { - + cout << "1" << endl; if (abort == true) { if (calledHelp) { return 0; } return 2; } //read names file @@ -225,12 +229,24 @@ int MGClusterCommand::execute(){ time_t start; float previousDist = 0.00000; float rndPreviousDist = 0.00000; - + //read blastfile - creates sparsematrices for the distances and overlaps as well as a listvector //must remember to delete those objects here since readBlast does not read = new ReadBlast(blastfile, cutoff, penalty, length, minWanted, hclusterWanted); read->read(nameMap); - + + list = new ListVector(nameMap->getListVector()); + RAbundVector* rabund = NULL; + + if(large) { + map nameMapCounts = m->readNames(namefile); + createRabund(nameMapCounts); + rabund = &rav; + }else { + rabund = new RAbundVector(list->getRAbundVector()); + } + + list = new ListVector(nameMap->getListVector()); RAbundVector* rabund = new RAbundVector(list->getRAbundVector()); @@ -699,7 +715,22 @@ void MGClusterCommand::sortHclusterFiles(string unsortedDist, string unsortedOve //********************************************************************************************************************** +void MGClusterCommand::createRabund(map nameMapCounts){ + try { + //RAbundVector rav; + map::iterator it; + //it = nameMapCounts.begin(); + //for(int i = 0; i < list->getNumBins(); i++) { rav.push_back((*it).second); it++; } + for ( it=nameMapCounts.begin(); it!=nameMapCounts.end(); it++ ) { rav.push_back( it->second ); } + //return rav; + } + catch(exception& e) { + m->errorOut(e, "MGClusterCommand", "createRabund"); + exit(1); + } + +} - +//**********************************************************************************************************************