X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=treegroupscommand.cpp;h=9594767f81ad234a969db760d7cc0be6e1575111;hb=a98eb683e17d8e49583bf2d215ab7562a4cdca75;hp=c4e58c28b3a7c56892981c7e221b738daa610ccd;hpb=aa9238c0a9e6e7aa0ed8b8b606b08ad4fd7dcfe3;p=mothur.git diff --git a/treegroupscommand.cpp b/treegroupscommand.cpp index c4e58c2..9594767 100644 --- a/treegroupscommand.cpp +++ b/treegroupscommand.cpp @@ -58,7 +58,7 @@ TreeGroupCommand::TreeGroupCommand(string option) { it = parameters.find("phylip"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["phylip"] = inputDir + it->second; } } @@ -66,7 +66,7 @@ TreeGroupCommand::TreeGroupCommand(string option) { it = parameters.find("column"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["column"] = inputDir + it->second; } } @@ -74,7 +74,7 @@ TreeGroupCommand::TreeGroupCommand(string option) { it = parameters.find("name"); //user has given a template file if(it != parameters.end()){ - path = hasPath(it->second); + path = m->hasPath(it->second); //if the user has not given a path then, add inputdir. else leave path alone. if (path == "") { parameters["name"] = inputDir + it->second; } } @@ -111,7 +111,7 @@ TreeGroupCommand::TreeGroupCommand(string option) { label = validParameter.validFile(parameters, "label", false); if (label == "not found") { label = ""; } else { - if(label != "all") { splitAtDash(label, labels); allLines = 0; } + if(label != "all") { m->splitAtDash(label, labels); allLines = 0; } else { allLines = 1; } } @@ -124,7 +124,7 @@ TreeGroupCommand::TreeGroupCommand(string option) { groups = validParameter.validFile(parameters, "groups", false); if (groups == "not found") { groups = ""; } else { - splitAtDash(groups, Groups); + m->splitAtDash(groups, Groups); globaldata->Groups = Groups; } @@ -133,7 +133,7 @@ TreeGroupCommand::TreeGroupCommand(string option) { else { if (calc == "default") { calc = "jclass-thetayc"; } } - splitAtDash(calc, Estimators); + m->splitAtDash(calc, Estimators); string temp; temp = validParameter.validFile(parameters, "precision", false); if (temp == "not found") { temp = "100"; } @@ -146,7 +146,7 @@ TreeGroupCommand::TreeGroupCommand(string option) { //if the user changes the output directory command factory will send this info to us in the output parameter outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found"){ outputDir = ""; - outputDir += hasPath(globaldata->inputFileName); //if user entered a file with a path then preserve it + outputDir += m->hasPath(globaldata->inputFileName); //if user entered a file with a path then preserve it } @@ -244,7 +244,8 @@ int TreeGroupCommand::execute(){ if (format == "sharedfile") { //if the users entered no valid calculators don't execute command if (treeCalculators.size() == 0) { m->mothurOut("You have given no valid calculators."); m->mothurOutEndLine(); return 0; } - + + if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap; globaldata->gGroupmap = NULL; } //you have groups read = new ReadOTUFile(globaldata->inputFileName); read->read(&*globaldata); @@ -258,17 +259,17 @@ int TreeGroupCommand::execute(){ //used in tree constructor globaldata->runParse = false; - //clear globaldatas old tree names if any - globaldata->Treenames.clear(); - - //fills globaldatas tree names - globaldata->Treenames = globaldata->Groups; - //create treemap class from groupmap for tree class to use tmap = new TreeMap(); tmap->makeSim(globaldata->gGroupmap); globaldata->gTreemap = tmap; + //clear globaldatas old tree names if any + globaldata->Treenames.clear(); + + //fills globaldatas tree names + globaldata->Treenames = globaldata->Groups; + if (m->control_pressed) { return 0; } //create tree file @@ -322,7 +323,7 @@ int TreeGroupCommand::execute(){ if (m->control_pressed) { return 0; } //create a new filename - outputFile = outputDir + getRootName(getSimpleName(globaldata->inputFileName)) + "tre"; + outputFile = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName)) + "tre"; outputNames.push_back(outputFile); createTree(); @@ -512,7 +513,7 @@ int TreeGroupCommand::makeSimsShared() { userLabels.erase(lookup[0]->getLabel()); } - if ((anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { + if ((m->anyLabelsToProcess(lookup[0]->getLabel(), userLabels, "") == true) && (processedLabels.count(lastLabel) != 1)) { string saveLabel = lookup[0]->getLabel(); for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } @@ -593,7 +594,7 @@ int TreeGroupCommand::process(vector thisLookup) { for (int g = 0; g < numGroups; g++) { index[g] = g; } //create a new filename - outputFile = outputDir + getRootName(getSimpleName(globaldata->inputFileName)) + treeCalculators[i]->getName() + "." + thisLookup[0]->getLabel() + ".tre"; + outputFile = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName)) + treeCalculators[i]->getName() + "." + thisLookup[0]->getLabel() + ".tre"; outputNames.push_back(outputFile); for (int k = 0; k < thisLookup.size(); k++) { @@ -606,7 +607,7 @@ int TreeGroupCommand::process(vector thisLookup) { subset.push_back(thisLookup[k]); subset.push_back(thisLookup[l]); data = treeCalculators[i]->getValues(subset); //saves the calculator outputs - + //cout << thisLookup[k]->getGroup() << '\t' << thisLookup[l]->getGroup() << '\t' << (1.0 - data[0]) << endl; if (m->control_pressed) { return 1; } //save values in similarity matrix