+ try {
+
+ vector<Calculator*> treeCalculators;
+ ValidCalculators validCalculator;
+ for (int i=0; i<pDataArray->Estimators.size(); i++) {
+ if (validCalculator.isValidCalculator("matrix", pDataArray->Estimators[i]) == true) {
+ if (pDataArray->Estimators[i] == "sharedsobs") {
+ treeCalculators.push_back(new SharedSobsCS());
+ }else if (pDataArray->Estimators[i] == "sharedchao") {
+ treeCalculators.push_back(new SharedChao1());
+ }else if (pDataArray->Estimators[i] == "sharedace") {
+ treeCalculators.push_back(new SharedAce());
+ }else if (pDataArray->Estimators[i] == "jabund") {
+ treeCalculators.push_back(new JAbund());
+ }else if (pDataArray->Estimators[i] == "sorabund") {
+ treeCalculators.push_back(new SorAbund());
+ }else if (pDataArray->Estimators[i] == "jclass") {
+ treeCalculators.push_back(new Jclass());
+ }else if (pDataArray->Estimators[i] == "sorclass") {
+ treeCalculators.push_back(new SorClass());
+ }else if (pDataArray->Estimators[i] == "jest") {
+ treeCalculators.push_back(new Jest());
+ }else if (pDataArray->Estimators[i] == "sorest") {
+ treeCalculators.push_back(new SorEst());
+ }else if (pDataArray->Estimators[i] == "thetayc") {
+ treeCalculators.push_back(new ThetaYC());
+ }else if (pDataArray->Estimators[i] == "thetan") {
+ treeCalculators.push_back(new ThetaN());
+ }else if (pDataArray->Estimators[i] == "kstest") {
+ treeCalculators.push_back(new KSTest());
+ }else if (pDataArray->Estimators[i] == "sharednseqs") {
+ treeCalculators.push_back(new SharedNSeqs());
+ }else if (pDataArray->Estimators[i] == "ochiai") {
+ treeCalculators.push_back(new Ochiai());
+ }else if (pDataArray->Estimators[i] == "anderberg") {
+ treeCalculators.push_back(new Anderberg());
+ }else if (pDataArray->Estimators[i] == "kulczynski") {
+ treeCalculators.push_back(new Kulczynski());
+ }else if (pDataArray->Estimators[i] == "kulczynskicody") {
+ treeCalculators.push_back(new KulczynskiCody());
+ }else if (pDataArray->Estimators[i] == "lennon") {
+ treeCalculators.push_back(new Lennon());
+ }else if (pDataArray->Estimators[i] == "morisitahorn") {
+ treeCalculators.push_back(new MorHorn());
+ }else if (pDataArray->Estimators[i] == "braycurtis") {
+ treeCalculators.push_back(new BrayCurtis());
+ }else if (pDataArray->Estimators[i] == "whittaker") {
+ treeCalculators.push_back(new Whittaker());
+ }else if (pDataArray->Estimators[i] == "odum") {
+ treeCalculators.push_back(new Odum());
+ }else if (pDataArray->Estimators[i] == "canberra") {
+ treeCalculators.push_back(new Canberra());
+ }else if (pDataArray->Estimators[i] == "structeuclidean") {
+ treeCalculators.push_back(new StructEuclidean());
+ }else if (pDataArray->Estimators[i] == "structchord") {
+ treeCalculators.push_back(new StructChord());
+ }else if (pDataArray->Estimators[i] == "hellinger") {
+ treeCalculators.push_back(new Hellinger());
+ }else if (pDataArray->Estimators[i] == "manhattan") {
+ treeCalculators.push_back(new Manhattan());
+ }else if (pDataArray->Estimators[i] == "structpearson") {
+ treeCalculators.push_back(new StructPearson());
+ }else if (pDataArray->Estimators[i] == "soergel") {
+ treeCalculators.push_back(new Soergel());
+ }else if (pDataArray->Estimators[i] == "spearman") {
+ treeCalculators.push_back(new Spearman());
+ }else if (pDataArray->Estimators[i] == "structkulczynski") {
+ treeCalculators.push_back(new StructKulczynski());
+ }else if (pDataArray->Estimators[i] == "speciesprofile") {
+ treeCalculators.push_back(new SpeciesProfile());
+ }else if (pDataArray->Estimators[i] == "hamming") {
+ treeCalculators.push_back(new Hamming());
+ }else if (pDataArray->Estimators[i] == "structchi2") {
+ treeCalculators.push_back(new StructChi2());
+ }else if (pDataArray->Estimators[i] == "gower") {
+ treeCalculators.push_back(new Gower());
+ }else if (pDataArray->Estimators[i] == "memchi2") {
+ treeCalculators.push_back(new MemChi2());
+ }else if (pDataArray->Estimators[i] == "memchord") {
+ treeCalculators.push_back(new MemChord());
+ }else if (pDataArray->Estimators[i] == "memeuclidean") {
+ treeCalculators.push_back(new MemEuclidean());
+ }else if (pDataArray->Estimators[i] == "mempearson") {
+ treeCalculators.push_back(new MemPearson());
+ }
+ }
+ }
+
+ pDataArray->calcDists.resize(treeCalculators.size());
+
+ vector<SharedRAbundVector*> subset;
+ for (int k = pDataArray->start; k < pDataArray->end; k++) { // pass cdd each set of groups to compare
+
+ pDataArray->count++;
+
+ for (int l = 0; l < k; l++) {
+
+ if (k != l) { //we dont need to similiarity of a groups to itself
+ subset.clear(); //clear out old pair of sharedrabunds
+ //add new pair of sharedrabunds
+ subset.push_back(pDataArray->thisLookup[k]); subset.push_back(pDataArray->thisLookup[l]);
+
+ for(int i=0;i<treeCalculators.size();i++) {
+
+ //if this calc needs all groups to calculate the pair load all groups
+ if (treeCalculators[i]->getNeedsAll()) {
+ //load subset with rest of lookup for those calcs that need everyone to calc for a pair
+ for (int w = 0; w < pDataArray->thisLookup.size(); w++) {
+ if ((w != k) && (w != l)) { subset.push_back(pDataArray->thisLookup[w]); }
+ }
+ }
+
+ vector<double> tempdata = treeCalculators[i]->getValues(subset); //saves the calculator outputs
+
+ if (pDataArray->m->control_pressed) { return 1; }
+
+ seqDist temp(l, k, -(tempdata[0]-1.0));
+ pDataArray->calcDists[i].push_back(temp);
+ }
+ }
+ }
+ }
+
+ for(int i=0;i<treeCalculators.size();i++){ delete treeCalculators[i]; }
+
+ return 0;
+
+ }
+ catch(exception& e) {
+ pDataArray->m->errorOut(e, "TreeGroupsCommand", "MyTreeSharedThreadFunction");
+ exit(1);
+ }
+}
+#endif
+
+