From: westcott Date: Thu, 29 Jan 2009 14:36:15 +0000 (+0000) Subject: rarefaction.shared() fixed bug X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=8c548985e92f5be0bde10eddea89a6ae888b73da rarefaction.shared() fixed bug --- diff --git a/collectsharedcommand.cpp b/collectsharedcommand.cpp index 434d4a4..1f5ed55 100644 --- a/collectsharedcommand.cpp +++ b/collectsharedcommand.cpp @@ -28,32 +28,32 @@ CollectSharedCommand::CollectSharedCommand(){ globaldata = GlobalData::getInstance(); string fileNameRoot; fileNameRoot = getRootName(globaldata->inputFileName); - groupmap = globaldata->gGroupmap; + //groupmap = globaldata->gGroupmap; int i; for (i=0; isharedEstimators.size(); i++) { if (globaldata->sharedEstimators[i] == "sharedChao") { - cDisplays.push_back(new CollectDisplay(new SharedChao1(), new SharedOneColumnFile(fileNameRoot+"shared.chao", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedChao1(), new SharedOneColumnFile(fileNameRoot+"shared.chao"))); }else if (globaldata->sharedEstimators[i] == "sharedSobs") { - cDisplays.push_back(new CollectDisplay(new SharedSobs(), new SharedOneColumnFile(fileNameRoot+"shared.sobs", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedSobs(), new SharedOneColumnFile(fileNameRoot+"shared.sobs"))); }else if (globaldata->sharedEstimators[i] == "sharedAce") { - cDisplays.push_back(new CollectDisplay(new SharedAce(), new SharedOneColumnFile(fileNameRoot+"shared.ace", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedAce(), new SharedOneColumnFile(fileNameRoot+"shared.ace"))); }else if (globaldata->sharedEstimators[i] == "sharedJabund") { - cDisplays.push_back(new CollectDisplay(new SharedJAbund(), new SharedOneColumnFile(fileNameRoot+"shared.jabund", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedJAbund(), new SharedOneColumnFile(fileNameRoot+"shared.jabund"))); }else if (globaldata->sharedEstimators[i] == "sharedSorensonAbund") { - cDisplays.push_back(new CollectDisplay(new SharedSorAbund(), new SharedOneColumnFile(fileNameRoot+"shared.sorabund", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedSorAbund(), new SharedOneColumnFile(fileNameRoot+"shared.sorabund"))); }else if (globaldata->sharedEstimators[i] == "sharedJclass") { - cDisplays.push_back(new CollectDisplay(new SharedJclass(), new SharedOneColumnFile(fileNameRoot+"shared.jclass", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedJclass(), new SharedOneColumnFile(fileNameRoot+"shared.jclass"))); }else if (globaldata->sharedEstimators[i] == "sharedSorClass") { - cDisplays.push_back(new CollectDisplay(new SharedSorClass(), new SharedOneColumnFile(fileNameRoot+"shared.sorclass", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedSorClass(), new SharedOneColumnFile(fileNameRoot+"shared.sorclass"))); }else if (globaldata->sharedEstimators[i] == "sharedJest") { - cDisplays.push_back(new CollectDisplay(new SharedJest(), new SharedOneColumnFile(fileNameRoot+"shared.jest", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedJest(), new SharedOneColumnFile(fileNameRoot+"shared.jest"))); }else if (globaldata->sharedEstimators[i] == "sharedSorEst") { - cDisplays.push_back(new CollectDisplay(new SharedSorEst(), new SharedOneColumnFile(fileNameRoot+"shared.sorest", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedSorEst(), new SharedOneColumnFile(fileNameRoot+"shared.sorest"))); }else if (globaldata->sharedEstimators[i] == "SharedThetaYC") { - cDisplays.push_back(new CollectDisplay(new SharedThetaYC(), new SharedOneColumnFile(fileNameRoot+"shared.thetayc", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedThetaYC(), new SharedOneColumnFile(fileNameRoot+"shared.thetayc"))); }else if (globaldata->sharedEstimators[i] == "SharedThetaN") { - cDisplays.push_back(new CollectDisplay(new SharedThetaN(), new SharedOneColumnFile(fileNameRoot+"shared.thetan", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedThetaN(), new SharedOneColumnFile(fileNameRoot+"shared.thetan"))); } } } diff --git a/commandfactory.cpp b/commandfactory.cpp index 2419369..ed6aebe 100644 --- a/commandfactory.cpp +++ b/commandfactory.cpp @@ -51,7 +51,7 @@ Command* CommandFactory::getCommand(string commandName){ if(commandName == "read.dist") { command = new ReadDistCommand(); } else if(commandName == "read.otu") { command = new ReadOtuCommand(); } - else if(commandName == "read.tree") { command = new ReadTreeCommand(); } + //else if(commandName == "read.tree") { command = new ReadTreeCommand(); } else if(commandName == "cluster") { command = new ClusterCommand(); } else if(commandName == "deconvolute") { command = new DeconvoluteCommand(); } else if(commandName == "help") { command = new HelpCommand(); } diff --git a/fileoutput.h b/fileoutput.h index 6eb5e8d..b7837d2 100644 --- a/fileoutput.h +++ b/fileoutput.h @@ -69,7 +69,7 @@ class SharedOneColumnFile : public FileOutput { public: - SharedOneColumnFile(string n, vector g) : inName(n), counter(0), outName(getPathName(n) + ".temp." + getSimpleName(n)) {}; + SharedOneColumnFile(string n) : inName(n), counter(0), outName(getPathName(n) + ".temp." + getSimpleName(n)) {}; ~SharedOneColumnFile(); void output(int, vector); void initFile(string); diff --git a/rarefact.cpp b/rarefact.cpp index 0be0327..e776393 100644 --- a/rarefact.cpp +++ b/rarefact.cpp @@ -3,7 +3,7 @@ * Dotur * * Created by Sarah Westcott on 11/18/08. - * Copyright 2008 __MyCompanyName__. All rights reserved. + * Copyright 2008 Schloss Lab UMASS Amherst. All rights reserved. * */ @@ -115,17 +115,10 @@ try { //randomize the groups random_shuffle(lookup.begin(), lookup.end()); - //send the first group - rcd->updateSharedData(lookup[0], lookup[0], 1, numGroupComb); - - //send each additional group one at a time - int n = 1; - for (int k = 0; k < (lookup.size() - 1); k++) { - for (int l = n; l < lookup.size(); l++) { - rcd->updateSharedData(lookup[k], lookup[l], l+1, numGroupComb); - mergeVectors(lookup[0], lookup[l]); - } - n++; + //send each group one at a time + for (int k = 0; k < lookup.size(); k++) { + rcd->updateSharedData(lookup[0], lookup[k], k+1, numGroupComb); + mergeVectors(lookup[0], lookup[k]); } //resets output files diff --git a/rarefactsharedcommand.cpp b/rarefactsharedcommand.cpp index 189be88..5e36299 100644 --- a/rarefactsharedcommand.cpp +++ b/rarefactsharedcommand.cpp @@ -15,20 +15,13 @@ RareFactSharedCommand::RareFactSharedCommand(){ try { globaldata = GlobalData::getInstance(); - string fileNameRoot, groups; + string fileNameRoot; fileNameRoot = getRootName(globaldata->inputFileName); - groupmap = globaldata->gGroupmap; - - //initialize groups for label - groups = ""; - for (int i = 0; i < groupmap->namesOfGroups.size(); i++) { - groups = groups + groupmap->namesOfGroups[i]; - } - + int i; for (i=0; isharedRareEstimators.size(); i++) { if (globaldata->sharedRareEstimators[i] == "sharedobserved") { - rDisplays.push_back(new RareDisplay(new SharedSobs(), new SharedThreeColumnFile(fileNameRoot+"r_shared.observed", groups))); + rDisplays.push_back(new RareDisplay(new SharedSobs(), new SharedThreeColumnFile(fileNameRoot+"shared.rarefaction", ""))); } } } diff --git a/rarefactsharedcommand.h b/rarefactsharedcommand.h index e7d2abc..1d87710 100644 --- a/rarefactsharedcommand.h +++ b/rarefactsharedcommand.h @@ -17,7 +17,6 @@ #include "sharedordervector.h" #include "sharedlistvector.h" #include "inputdata.h" -#include "groupmap.h" #include "rarefact.h" #include "display.h" #include "readmatrix.hpp" @@ -45,7 +44,6 @@ public: private: GlobalData* globaldata; - GroupMap* groupmap; SharedListVector* SharedList; ReadMatrix* read; SharedOrderVector* order; diff --git a/sharedsobs.cpp b/sharedsobs.cpp index 14f5bf5..9c3f4dd 100644 --- a/sharedsobs.cpp +++ b/sharedsobs.cpp @@ -16,7 +16,7 @@ EstOutput SharedSobs::getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2){ try { data.resize(1,0); - int observed = 0;; + int observed = 0; //loop through the species in each group for (int k = 0; k < shared1->size(); k++) {