From: westcott Date: Tue, 24 Mar 2009 15:11:00 +0000 (+0000) Subject: added sharedbraycurtis, sharedmorisirahorn, sharedkulczynski, sharedkulczynskicody... X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=25cde7ff05bbe741da1712f2c740e0bc8706e523 added sharedbraycurtis, sharedmorisirahorn, sharedkulczynski, sharedkulczynskicody and sharedlennon calculators. --- diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index 7e2a8e4..4149310 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -7,6 +7,11 @@ objects = { /* Begin PBXBuildFile section */ + 217595330F791EEE001CC3C6 /* sharedkulczynski.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 217595320F791EEE001CC3C6 /* sharedkulczynski.cpp */; }; + 2175953F0F792111001CC3C6 /* sharedkulczynskicody.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2175953E0F792111001CC3C6 /* sharedkulczynskicody.cpp */; }; + 217595590F792490001CC3C6 /* sharedlennon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 217595580F792490001CC3C6 /* sharedlennon.cpp */; }; + 217595640F7927BB001CC3C6 /* sharedmorisitahorn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 217595630F7927BB001CC3C6 /* sharedmorisitahorn.cpp */; }; + 217595710F792A33001CC3C6 /* sharedbraycurtis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 217595700F792A33001CC3C6 /* sharedbraycurtis.cpp */; }; 372E12700F26365B0095CF7E /* readotucommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E126F0F26365B0095CF7E /* readotucommand.cpp */; }; 372E12960F263D5A0095CF7E /* readdistcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E12950F263D5A0095CF7E /* readdistcommand.cpp */; }; 372E12ED0F264D320095CF7E /* commandfactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E12EC0F264D320095CF7E /* commandfactory.cpp */; }; @@ -117,6 +122,16 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 217595310F791EEE001CC3C6 /* sharedkulczynski.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedkulczynski.h; sourceTree = ""; }; + 217595320F791EEE001CC3C6 /* sharedkulczynski.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedkulczynski.cpp; sourceTree = ""; }; + 2175953D0F792111001CC3C6 /* sharedkulczynskicody.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedkulczynskicody.h; sourceTree = ""; }; + 2175953E0F792111001CC3C6 /* sharedkulczynskicody.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedkulczynskicody.cpp; sourceTree = ""; }; + 217595570F792490001CC3C6 /* sharedlennon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedlennon.h; sourceTree = ""; }; + 217595580F792490001CC3C6 /* sharedlennon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedlennon.cpp; sourceTree = ""; }; + 217595620F7927BB001CC3C6 /* sharedmorisitahorn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedmorisitahorn.h; sourceTree = ""; }; + 217595630F7927BB001CC3C6 /* sharedmorisitahorn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedmorisitahorn.cpp; sourceTree = ""; }; + 2175956F0F792A33001CC3C6 /* sharedbraycurtis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedbraycurtis.h; sourceTree = ""; }; + 217595700F792A33001CC3C6 /* sharedbraycurtis.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedbraycurtis.cpp; sourceTree = ""; }; 370936DE0F6E7A4A00EB4C2C /* nseqs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nseqs.h; sourceTree = ""; }; 3709370A0F6E7FC100EB4C2C /* sharednseqs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharednseqs.h; sourceTree = ""; }; 372E126E0F26365B0095CF7E /* readotucommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readotucommand.h; sourceTree = ""; }; @@ -438,6 +453,8 @@ 37D928220F21331F001D4494 /* sharedace.cpp */, 3765B5140F780A7F00C3EDC5 /* sharedanderberg.h */, 3765B5150F780A7F00C3EDC5 /* sharedanderberg.cpp */, + 2175956F0F792A33001CC3C6 /* sharedbraycurtis.h */, + 217595700F792A33001CC3C6 /* sharedbraycurtis.cpp */, 37D928250F21331F001D4494 /* sharedchao1.h */, 37D928240F21331F001D4494 /* sharedchao1.cpp */, 37D928290F21331F001D4494 /* sharedjabund.h */, @@ -446,6 +463,14 @@ 37D9282A0F21331F001D4494 /* sharedjclass.cpp */, 37D9282D0F21331F001D4494 /* sharedjest.h */, 37D9282C0F21331F001D4494 /* sharedjest.cpp */, + 217595310F791EEE001CC3C6 /* sharedkulczynski.h */, + 217595320F791EEE001CC3C6 /* sharedkulczynski.cpp */, + 2175953D0F792111001CC3C6 /* sharedkulczynskicody.h */, + 2175953E0F792111001CC3C6 /* sharedkulczynskicody.cpp */, + 217595570F792490001CC3C6 /* sharedlennon.h */, + 217595580F792490001CC3C6 /* sharedlennon.cpp */, + 217595620F7927BB001CC3C6 /* sharedmorisitahorn.h */, + 217595630F7927BB001CC3C6 /* sharedmorisitahorn.cpp */, 3709370A0F6E7FC100EB4C2C /* sharednseqs.h */, 3765B4E00F78055000C3EDC5 /* sharedochiai.h */, 3765B4E10F78055000C3EDC5 /* sharedochiai.cpp */, @@ -727,6 +752,11 @@ 3765B47A0F77D15900C3EDC5 /* nocommands.cpp in Sources */, 3765B4E20F78055000C3EDC5 /* sharedochiai.cpp in Sources */, 3765B5160F780A7F00C3EDC5 /* sharedanderberg.cpp in Sources */, + 217595330F791EEE001CC3C6 /* sharedkulczynski.cpp in Sources */, + 2175953F0F792111001CC3C6 /* sharedkulczynskicody.cpp in Sources */, + 217595590F792490001CC3C6 /* sharedlennon.cpp in Sources */, + 217595640F7927BB001CC3C6 /* sharedmorisitahorn.cpp in Sources */, + 217595710F792A33001CC3C6 /* sharedbraycurtis.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/collectsharedcommand.cpp b/collectsharedcommand.cpp index 93c15f6..6ee2943 100644 --- a/collectsharedcommand.cpp +++ b/collectsharedcommand.cpp @@ -22,6 +22,11 @@ #include "sharednseqs.h" #include "sharedochiai.h" #include "sharedanderberg.h" +#include "sharedkulczynski.h" +#include "sharedkulczynskicody.h" +#include "sharedlennon.h" +#include "sharedmorisitahorn.h" +#include "sharedbraycurtis.h" //********************************************************************************************************************** @@ -65,8 +70,17 @@ CollectSharedCommand::CollectSharedCommand(){ cDisplays.push_back(new CollectDisplay(new SharedOchiai(), new SharedOneColumnFile(fileNameRoot+"shared.ochiai"))); }else if (globaldata->Estimators[i] == "sharedanderberg") { cDisplays.push_back(new CollectDisplay(new SharedAnderberg(), new SharedOneColumnFile(fileNameRoot+"shared.anderberg"))); + }else if (globaldata->Estimators[i] == "sharedkulczynski") { + cDisplays.push_back(new CollectDisplay(new SharedKulczynski(), new SharedOneColumnFile(fileNameRoot+"shared.kulczynski"))); + }else if (globaldata->Estimators[i] == "sharedkulczynskicody") { + cDisplays.push_back(new CollectDisplay(new SharedKulczynskiCody(), new SharedOneColumnFile(fileNameRoot+"shared.kulczynskicody"))); + }else if (globaldata->Estimators[i] == "sharedlennon") { + cDisplays.push_back(new CollectDisplay(new SharedLennon(), new SharedOneColumnFile(fileNameRoot+"shared.lennon"))); + }else if (globaldata->Estimators[i] == "sharedmorisitahorn") { + cDisplays.push_back(new CollectDisplay(new SharedMorHorn(), new SharedOneColumnFile(fileNameRoot+"shared.morisitahorn"))); + }else if (globaldata->Estimators[i] == "sharedbraycurtis") { + cDisplays.push_back(new CollectDisplay(new SharedBrayCurtis(), new SharedOneColumnFile(fileNameRoot+"shared.braycurtis"))); } - } } diff --git a/sharedbraycurtis.cpp b/sharedbraycurtis.cpp new file mode 100644 index 0000000..3cc3177 --- /dev/null +++ b/sharedbraycurtis.cpp @@ -0,0 +1,62 @@ +/* + * sharedbraycurtis.cpp + * Mothur + * + * Created by Sarah Westcott on 3/24/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + +#include "sharedbraycurtis.h" + +/***********************************************************************/ +//This is used by SharedJAbund and SharedSorAbund +EstOutput SharedBrayCurtis::getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2) { + try { + EstOutput data; + data.resize(1,0); + + int sumSharedA, sumSharedB, sumSharedAB, tempA, tempB; + sumSharedA = 0; sumSharedB = 0; sumSharedAB = 0; + + /*Xi, Yi = abundance of the ith shared OTU in A and B + sumSharedA = the sum of all shared otus in A + sumSharedB = the sum of all shared otus in B + sumSharedAB = the sum of the minimum otus int all shared otus in AB. + */ + + for (int i = 0; i < shared1->size(); i++) { + //store in temps to avoid multiple repetitive function calls + tempA = shared1->getAbundance(i); + tempB = shared2->getAbundance(i); + + + if ((tempA != 0) && (tempB != 0)) {//they are shared + sumSharedA += tempA; + sumSharedB += tempB; + + //sum the min of tempA and tempB + if (tempA < tempB) { sumSharedAB += tempA; } + else { sumSharedAB += tempB; } + } + } + + data[0] = (2 * sumSharedAB) / (float)( sumSharedA + sumSharedB); + + if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; } + + return data; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the SharedBrayCurtis class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the SharedBrayCurtis class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + + +} + +/***********************************************************************/ diff --git a/sharedbraycurtis.h b/sharedbraycurtis.h new file mode 100644 index 0000000..ba36729 --- /dev/null +++ b/sharedbraycurtis.h @@ -0,0 +1,29 @@ +#ifndef SHAREDBRAYCURTIS_H +#define SHAREDBRAYCURTIS_H +/* + * sharedbraycurtis.h + * Mothur + * + * Created by Sarah Westcott on 3/24/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ +#include "calculator.h" + +/***********************************************************************/ + +class SharedBrayCurtis : public Calculator { + +public: + SharedBrayCurtis() : Calculator("SharedBrayCurtis", 1) {}; + EstOutput getValues(SAbundVector*) {return data;}; + EstOutput getValues(SharedRAbundVector*, SharedRAbundVector*); +private: + +}; + +/***********************************************************************/ + + + +#endif diff --git a/sharedkulczynski.cpp b/sharedkulczynski.cpp new file mode 100644 index 0000000..30c8c7a --- /dev/null +++ b/sharedkulczynski.cpp @@ -0,0 +1,52 @@ +/* + * sharedkulczynski.cpp + * Mothur + * + * Created by John Westcott on 3/24/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + +#include "sharedkulczynski.h" + +/***********************************************************************/ + +EstOutput SharedKulczynski::getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2) { + try { + int S1, S2, S12, tempA, tempB; + S1 = 0; S2 = 0; S12 = 0; tempA = 0; tempB = 0; + + /*S1, S2 = number of OTUs observed or estimated in A and B + S12=number of OTUs shared between A and B */ + + data.resize(1,0); + + for (int i = 0; i < shared1->size(); i++) { + //store in temps to avoid multiple repetitive function calls + tempA = shared1->getAbundance(i); + tempB = shared2->getAbundance(i); + + if (tempA != 0) { S1++; } + if (tempB != 0) { S2++; } + + //they are shared + if ((tempA != 0) && (tempB != 0)) { S12++; } + } + + data[0] = S12 / (float)(S1 + S2 - (2 * S12)); + + if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; } + + return data; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the SharedKulczynski class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the SharedKulczynski class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} + +/***********************************************************************/ diff --git a/sharedkulczynski.h b/sharedkulczynski.h new file mode 100644 index 0000000..91a19ca --- /dev/null +++ b/sharedkulczynski.h @@ -0,0 +1,31 @@ +#ifndef SHAREDKULCZYNSKI_H +#define SHAREDKULCZYNSKI_H +/* + * sharedkulczynski.h + * Mothur + * + * Created by John Westcott on 3/24/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + + +#include "calculator.h" + +/***********************************************************************/ + +class SharedKulczynski : public Calculator { + +public: + SharedKulczynski() : Calculator("SharedKulczynski", 1) {}; + EstOutput getValues(SAbundVector*) {return data;}; + EstOutput getValues(SharedRAbundVector*, SharedRAbundVector*); +private: + +}; + +/***********************************************************************/ + + + +#endif \ No newline at end of file diff --git a/sharedkulczynskicody.cpp b/sharedkulczynskicody.cpp new file mode 100644 index 0000000..3de7e76 --- /dev/null +++ b/sharedkulczynskicody.cpp @@ -0,0 +1,52 @@ +/* + * sharedkulczynskicody.cpp + * Mothur + * + * Created by Sarah Westcott on 3/24/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + +#include "sharedkulczynskicody.h" + +/***********************************************************************/ + +EstOutput SharedKulczynskiCody::getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2) { + try { + int S1, S2, S12, tempA, tempB; + S1 = 0; S2 = 0; S12 = 0; tempA = 0; tempB = 0; + + /*S1, S2 = number of OTUs observed or estimated in A and B + S12=number of OTUs shared between A and B */ + + data.resize(1,0); + + for (int i = 0; i < shared1->size(); i++) { + //store in temps to avoid multiple repetitive function calls + tempA = shared1->getAbundance(i); + tempB = shared2->getAbundance(i); + + if (tempA != 0) { S1++; } + if (tempB != 0) { S2++; } + + //they are shared + if ((tempA != 0) && (tempB != 0)) { S12++; } + } + + data[0] = 0.5 * ((S12 / (float)S1) + (S12 / (float)S2)); + + if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; } + + return data; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the SharedKulczynskiCody class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the SharedKulczynskiCody class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} + +/***********************************************************************/ diff --git a/sharedkulczynskicody.h b/sharedkulczynskicody.h new file mode 100644 index 0000000..7fb30ce --- /dev/null +++ b/sharedkulczynskicody.h @@ -0,0 +1,32 @@ +#ifndef SHAREDKULCZYNSKICODY_H +#define SHAREDKULCZYNSKICODY_H + +/* + * sharedkulczynskicody.h + * Mothur + * + * Created by Sarah Westcott on 3/24/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + + +#include "calculator.h" + +/***********************************************************************/ + +class SharedKulczynskiCody : public Calculator { + +public: + SharedKulczynskiCody() : Calculator("SharedKulczynskiCody", 1) {}; + EstOutput getValues(SAbundVector*) {return data;}; + EstOutput getValues(SharedRAbundVector*, SharedRAbundVector*); +private: + +}; + +/***********************************************************************/ + + + +#endif \ No newline at end of file diff --git a/sharedlennon.cpp b/sharedlennon.cpp new file mode 100644 index 0000000..45dfc6a --- /dev/null +++ b/sharedlennon.cpp @@ -0,0 +1,58 @@ +/* + * sharedlennon.cpp + * Mothur + * + * Created by Sarah Westcott on 3/24/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + +#include "sharedlennon.h" + +/***********************************************************************/ + +EstOutput SharedLennon::getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2) { + try { + int S1, S2, S12, tempA, tempB, min; + S1 = 0; S2 = 0; S12 = 0; tempA = 0; tempB = 0; min = 0; + + /*S1, S2 = number of OTUs observed or estimated in A and B + S12=number of OTUs shared between A and B */ + + data.resize(1,0); + + for (int i = 0; i < shared1->size(); i++) { + //store in temps to avoid multiple repetitive function calls + tempA = shared1->getAbundance(i); + tempB = shared2->getAbundance(i); + + if (tempA != 0) { S1++; } + if (tempB != 0) { S2++; } + + //they are shared + if ((tempA != 0) && (tempB != 0)) { S12++; } + } + + + tempA = S1 - S12; tempB = S2 - S12; + + if (tempA < tempB) { min = tempA; } + else { min = tempB; } + + data[0] = S12 / (float)(S12 + min); + + if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; } + + return data; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the SharedLennon class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the SharedLennon class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} + +/***********************************************************************/ diff --git a/sharedlennon.h b/sharedlennon.h new file mode 100644 index 0000000..57a6355 --- /dev/null +++ b/sharedlennon.h @@ -0,0 +1,32 @@ +#ifndef SHAREDLENNON_H +#define SHAREDLENNON_H + +/* + * sharedlennon.h + * Mothur + * + * Created by Sarah Westcott on 3/24/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + + +#include "calculator.h" + +/***********************************************************************/ + +class SharedLennon : public Calculator { + +public: + SharedLennon() : Calculator("SharedLennon", 1) {}; + EstOutput getValues(SAbundVector*) {return data;}; + EstOutput getValues(SharedRAbundVector*, SharedRAbundVector*); +private: + +}; + +/***********************************************************************/ + + + +#endif \ No newline at end of file diff --git a/sharedmorisitahorn.cpp b/sharedmorisitahorn.cpp new file mode 100644 index 0000000..6ceac75 --- /dev/null +++ b/sharedmorisitahorn.cpp @@ -0,0 +1,64 @@ +/* + * sharedmorisitahorn.cpp + * Mothur + * + * Created by Sarah Westcott on 3/24/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + +#include "sharedmorisitahorn.h" + +/***********************************************************************/ +EstOutput SharedMorHorn::getValues(SharedRAbundVector* shared1, SharedRAbundVector* shared2) { + try { + data.resize(1,0); + + int Atotal, Btotal, tempA, tempB; + Atotal = 0; Btotal = 0; + float morhorn, sumSharedA, sumSharedB, a, b, d; + morhorn = 0.0; sumSharedA = 0.0; sumSharedB = 0.0; a = 0.0; b = 0.0; d = 0.0; + + //get the total values we need to calculate the theta denominator sums + for (int i = 0; i < shared1->size(); i++) { + //store in temps to avoid multiple repetitive function calls + Atotal += shared1->getAbundance(i); + Btotal += shared2->getAbundance(i); + } + + //calculate the theta denominator sums + for (int j = 0; j < shared1->size(); j++) { + //store in temps to avoid multiple repetitive function calls + tempA = shared1->getAbundance(j); + tempB = shared2->getAbundance(j); + + //they are shared + if ((tempA != 0) && (tempB != 0)) { + if (Atotal != 0) { sumSharedA = (tempA / (float)Atotal); } + if (Btotal != 0) { sumSharedB = (tempB / (float)Btotal); } + + a += sumSharedA * sumSharedA; + b += sumSharedB * sumSharedB; + d += sumSharedA * sumSharedB; + } + } + + morhorn = (2 * d) / (float) (a + b); + + if (isnan(morhorn) || isinf(morhorn)) { morhorn = 0; } + + data[0] = morhorn; + + return data; + } + catch(exception& e) { + cout << "Standard Error: " << e.what() << " has occurred in the SharedMorHorn class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } + catch(...) { + cout << "An unknown error has occurred in the SharedMorHorn class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + exit(1); + } +} + +/***********************************************************************/ \ No newline at end of file diff --git a/sharedmorisitahorn.h b/sharedmorisitahorn.h new file mode 100644 index 0000000..9c2f755 --- /dev/null +++ b/sharedmorisitahorn.h @@ -0,0 +1,30 @@ +#ifndef SHAREDMORHORN_H +#define SHAREDMORHORN_H +/* + * sharedmorisitahorn.h + * Mothur + * + * Created by Sarah Westcott on 3/24/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + + +#include "calculator.h" + +/***********************************************************************/ + +class SharedMorHorn : public Calculator { + +public: + SharedMorHorn() : Calculator("SharedMorisitaHorn", 1) {}; + EstOutput getValues(SAbundVector*) {return data;}; + EstOutput getValues(SharedRAbundVector*, SharedRAbundVector*); +private: + +}; + +/***********************************************************************/ + +#endif + diff --git a/sharedthetayc.cpp b/sharedthetayc.cpp index a055b66..ad2e1c5 100644 --- a/sharedthetayc.cpp +++ b/sharedthetayc.cpp @@ -16,8 +16,8 @@ EstOutput SharedThetaYC::getValues(SharedRAbundVector* shared1, SharedRAbundVect int Atotal, Btotal, tempA, tempB; Atotal = 0; Btotal = 0; - float numerator, denominator, thetaYC, sumSharedA, sumSharedB, a, b, d; - numerator = 0.0; denominator = 0.0; thetaYC = 0.0; sumSharedA = 0.0; sumSharedB = 0.0; a = 0.0; b = 0.0; d = 0.0; + float thetaYC, sumSharedA, sumSharedB, a, b, d; + thetaYC = 0.0; sumSharedA = 0.0; sumSharedB = 0.0; a = 0.0; b = 0.0; d = 0.0; //get the total values we need to calculate the theta denominator sums for (int i = 0; i < shared1->size(); i++) { diff --git a/summarysharedcommand.cpp b/summarysharedcommand.cpp index 7698704..44bd581 100644 --- a/summarysharedcommand.cpp +++ b/summarysharedcommand.cpp @@ -22,6 +22,11 @@ #include "sharedthetan.h" #include "sharedochiai.h" #include "sharedanderberg.h" +#include "sharedkulczynski.h" +#include "sharedkulczynskicody.h" +#include "sharedlennon.h" +#include "sharedmorisitahorn.h" +#include "sharedbraycurtis.h" //********************************************************************************************************************** @@ -65,9 +70,17 @@ SummarySharedCommand::SummarySharedCommand(){ sumCalculators.push_back(new SharedOchiai()); }else if (globaldata->Estimators[i] == "sharedanderberg") { sumCalculators.push_back(new SharedAnderberg()); + }else if (globaldata->Estimators[i] == "sharedkulczynski") { + sumCalculators.push_back(new SharedKulczynski()); + }else if (globaldata->Estimators[i] == "sharedkulczynskicody") { + sumCalculators.push_back(new SharedKulczynskiCody()); + }else if (globaldata->Estimators[i] == "sharedlennon") { + sumCalculators.push_back(new SharedLennon()); + }else if (globaldata->Estimators[i] == "sharedmorisitahorn") { + sumCalculators.push_back(new SharedMorHorn()); + }else if (globaldata->Estimators[i] == "sharedbraycurtis") { + sumCalculators.push_back(new SharedBrayCurtis()); } - - } } diff --git a/validcalculator.cpp b/validcalculator.cpp index b29ff57..0ffa216 100644 --- a/validcalculator.cpp +++ b/validcalculator.cpp @@ -164,6 +164,11 @@ void ValidCalculators::initialShared() { shared["sharednseqs"] = "sharednseqs"; shared["sharedochiai"] = "sharedochiai"; shared["sharedanderberg"] = "sharedanderberg"; + shared["sharedkulczynski"] = "sharedkulczynski"; + shared["sharedkulczynskicody"] = "sharedkulczynskicody"; + shared["sharedlennon"] = "sharedlennon"; + shared["sharedmorisitahorn"] = "sharedmorisitahorn"; + shared["sharedbraycurtis"] = "sharedbraycurtis"; shared["default"] = "default"; } catch(exception& e) { @@ -242,6 +247,11 @@ void ValidCalculators::initialSharedSummary() { sharedsummary["sharednseqs"] = "sharednseqs"; sharedsummary["sharedochiai"] = "sharedochiai"; sharedsummary["sharedanderberg"] = "sharedanderberg"; + sharedsummary["sharedkulczynski"] = "sharedkulczynski"; + sharedsummary["sharedkulczynskicody"] = "sharedkulczynskicody"; + sharedsummary["sharedlennon"] = "sharedlennon"; + sharedsummary["sharedmorisitahorn"] = "sharedmorisitahorn"; + sharedsummary["sharedbraycurtis"] = "sharedbraycurtis"; sharedsummary["default"] = "default"; } catch(exception& e) {