#include "sharedbraycurtis.h"
#include "sharedjackknife.h"
#include "whittaker.h"
+#include "odum.h"
+#include "canberra.h"
+#include "structeuclidean.h"
+#include "structchord.h"
+#include "hellinger.h"
+#include "manhattan.h"
+#include "structpearson.h"
+#include "soergel.h"
+#include "spearman.h"
+#include "structkulczynski.h"
+#include "structchi2.h"
+#include "speciesprofile.h"
+#include "hamming.h"
+#include "gower.h"
+#include "memchi2.h"
+#include "memchord.h"
+#include "memeuclidean.h"
+#include "mempearson.h"
//**********************************************************************************************************************
vector<string> SummarySharedCommand::getValidParameters(){
//**********************************************************************************************************************
SummarySharedCommand::SummarySharedCommand(){
try {
- abort = true;
- //initialize outputTypes
+ abort = true; calledHelp = true;
vector<string> tempOutNames;
outputTypes["summary"] = tempOutNames;
}
SummarySharedCommand::SummarySharedCommand(string option) {
try {
globaldata = GlobalData::getInstance();
- abort = false;
+ abort = false; calledHelp = false;
allLines = 1;
labels.clear();
Estimators.clear();
//allow user to run help
- if(option == "help") { validCalculator = new ValidCalculators(); help(); abort = true; }
+ if(option == "help") { validCalculator = new ValidCalculators(); help(); abort = true; calledHelp = true; }
else {
//valid paramters for this command
sumCalculators.push_back(new BrayCurtis());
}else if (Estimators[i] == "whittaker") {
sumCalculators.push_back(new Whittaker());
+ }else if (Estimators[i] == "odum") {
+ sumCalculators.push_back(new Odum());
+ }else if (Estimators[i] == "canberra") {
+ sumCalculators.push_back(new Canberra());
+ }else if (Estimators[i] == "structeuclidean") {
+ sumCalculators.push_back(new StructEuclidean());
+ }else if (Estimators[i] == "structchord") {
+ sumCalculators.push_back(new StructChord());
+ }else if (Estimators[i] == "hellinger") {
+ sumCalculators.push_back(new Hellinger());
+ }else if (Estimators[i] == "manhattan") {
+ sumCalculators.push_back(new Manhattan());
+ }else if (Estimators[i] == "structpearson") {
+ sumCalculators.push_back(new StructPearson());
+ }else if (Estimators[i] == "soergel") {
+ sumCalculators.push_back(new Soergel());
+ }else if (Estimators[i] == "spearman") {
+ sumCalculators.push_back(new Spearman());
+ }else if (Estimators[i] == "structkulczynski") {
+ sumCalculators.push_back(new StructKulczynski());
+ }else if (Estimators[i] == "speciesprofile") {
+ sumCalculators.push_back(new SpeciesProfile());
+ }else if (Estimators[i] == "hamming") {
+ sumCalculators.push_back(new Hamming());
+ }else if (Estimators[i] == "structchi2") {
+ sumCalculators.push_back(new StructChi2());
+ }else if (Estimators[i] == "gower") {
+ sumCalculators.push_back(new Gower());
+ }else if (Estimators[i] == "memchi2") {
+ sumCalculators.push_back(new MemChi2());
+ }else if (Estimators[i] == "memchord") {
+ sumCalculators.push_back(new MemChord());
+ }else if (Estimators[i] == "memeuclidean") {
+ sumCalculators.push_back(new MemEuclidean());
+ }else if (Estimators[i] == "mempearson") {
+ sumCalculators.push_back(new MemPearson());
}
}
}
int SummarySharedCommand::execute(){
try {
- if (abort == true) { return 0; }
+ if (abort == true) { if (calledHelp) { return 0; } return 2; }
ofstream outputFileHandle, outAll;
string outputFileName = outputDir + m->getRootName(m->getSimpleName(globaldata->inputFileName)) + "shared.summary";
}
exit(0);
- }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
+ }else {
+ m->mothurOut("[ERROR]: unable to spawn the necessary processes."); m->mothurOutEndLine();
+ for (int i = 0; i < processIDS.size(); i++) { kill (processIDS[i], SIGINT); }
+ exit(0);
+ }
}
//parent do your part
outDist.close();
}
}
+ return 0;
}
catch(exception& e) {
m->errorOut(e, "SummarySharedCommand", "process");
}
for(int i=0;i<sumCalculators.size();i++) {
-
+
+ //if this calc needs all groups to calculate the pair load all groups
+ if (sumCalculators[i]->getNeedsAll()) {
+ //load subset with rest of lookup for those calcs that need everyone to calc for a pair
+ for (int w = 0; w < thisLookup.size(); w++) {
+ if ((w != k) && (w != l)) { subset.push_back(thisLookup[w]); }
+ }
+ }
+
vector<double> tempdata = sumCalculators[i]->getValues(subset); //saves the calculator outputs
if (m->control_pressed) { outputFileHandle.close(); return 1; }
outputFileHandle << '\t';
sumCalculators[i]->print(outputFileHandle);
- seqDist temp(l, k, tempdata[0]);
+ seqDist temp(l, k, (1.0 - tempdata[0]));
calcDists[i].push_back(temp);
}
outputFileHandle << endl;