/* Begin PBXBuildFile section */
219C1DE01552C4BD004209F9 /* newcommandtemplate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 219C1DDF1552C4BD004209F9 /* newcommandtemplate.cpp */; };
219C1DE41559BCCF004209F9 /* getcoremicrobiomecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 219C1DE31559BCCD004209F9 /* getcoremicrobiomecommand.cpp */; };
+ 483C952E188F0CAD0035E7B7 /* sharedrjsd.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 483C952D188F0CAD0035E7B7 /* sharedrjsd.cpp */; };
7E6BE10A12F710D8007ADDBE /* refchimeratest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E6BE10912F710D8007ADDBE /* refchimeratest.cpp */; };
834D9D581656D7C400E7FAB9 /* regularizedrandomforest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 834D9D561656D7C400E7FAB9 /* regularizedrandomforest.cpp */; };
834D9D5C1656DEC800E7FAB9 /* regularizeddecisiontree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 834D9D5A1656DEC700E7FAB9 /* regularizeddecisiontree.cpp */; };
219C1DE11552C508004209F9 /* newcommandtemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = newcommandtemplate.h; sourceTree = "<group>"; };
219C1DE31559BCCD004209F9 /* getcoremicrobiomecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = getcoremicrobiomecommand.cpp; sourceTree = "<group>"; };
219C1DE51559BCF2004209F9 /* getcoremicrobiomecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getcoremicrobiomecommand.h; sourceTree = "<group>"; };
+ 483C952C188F0C960035E7B7 /* sharedrjsd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sharedrjsd.h; sourceTree = "<group>"; };
+ 483C952D188F0CAD0035E7B7 /* sharedrjsd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedrjsd.cpp; sourceTree = "<group>"; };
7E6BE10812F710D8007ADDBE /* refchimeratest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = refchimeratest.h; sourceTree = "<group>"; };
7E6BE10912F710D8007ADDBE /* refchimeratest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = refchimeratest.cpp; sourceTree = "<group>"; };
7E78911B135F3E8600E725D2 /* eachgapdistignorens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eachgapdistignorens.h; sourceTree = "<group>"; };
A7E9B7FB12D37EC400DA6239 /* sharedjest.h */,
A7222D711856276C0055A993 /* sharedjsd.h */,
A7222D721856277C0055A993 /* sharedjsd.cpp */,
+ 483C952C188F0C960035E7B7 /* sharedrjsd.h */,
+ 483C952D188F0CAD0035E7B7 /* sharedrjsd.cpp */,
A7E9B7FC12D37EC400DA6239 /* sharedkstest.cpp */,
A7E9B7FD12D37EC400DA6239 /* sharedkstest.h */,
A7E9B7FE12D37EC400DA6239 /* sharedkulczynski.cpp */,
A7E9B94112D37EC400DA6239 /* setlogfilecommand.cpp in Sources */,
A7E9B94212D37EC400DA6239 /* sffinfocommand.cpp in Sources */,
A7E9B94312D37EC400DA6239 /* shannon.cpp in Sources */,
+ 483C952E188F0CAD0035E7B7 /* sharedrjsd.cpp in Sources */,
A7E9B94412D37EC400DA6239 /* shannoneven.cpp in Sources */,
A7E9B94512D37EC400DA6239 /* sharedace.cpp in Sources */,
A7E9B94612D37EC400DA6239 /* sharedanderbergs.cpp in Sources */,
//divide the groups between the processors
vector<linePair> lines;
- int numGroupsPerProcessor = groups.size() / processors;
- for (int i = 0; i < processors; i++) {
- int startIndex = i * numGroupsPerProcessor;
- int endIndex = (i+1) * numGroupsPerProcessor;
- if(i == (processors - 1)){ endIndex = groups.size(); }
- lines.push_back(linePair(startIndex, endIndex));
- }
+ int remainingPairs = groups.size();
+ int startIndex = 0;
+ for (int remainingProcessors = processors; remainingProcessors > 0; remainingProcessors--) {
+ int numPairs = remainingPairs; //case for last processor
+ if (remainingProcessors != 1) { numPairs = ceil(remainingPairs / remainingProcessors); }
+ lines.push_back(linePair(startIndex, (startIndex+numPairs))); //startIndex, endIndex
+ startIndex = startIndex + numPairs;
+ remainingPairs = remainingPairs - numPairs;
+ }
+
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
map<string, map<string, int> >::iterator itFile;
vector<string> filenames;
for(itFile = fileToPriority.begin(); itFile != fileToPriority.end(); itFile++) { filenames.push_back(itFile->first); }
-
- int numGroupsPerProcessor = filenames.size() / processors;
+
+ int numGroupsPerProcessor = ceil(filenames.size() / (double) processors);
int startIndex = pid * numGroupsPerProcessor;
int endIndex = (pid+1) * numGroupsPerProcessor;
if(pid == (processors - 1)){ endIndex = filenames.size(); }
//divide the groups between the processors
vector<linePair> lines;
- int numGroupsPerProcessor = groups.size() / processors;
- for (int i = 0; i < processors; i++) {
- int startIndex = i * numGroupsPerProcessor;
- int endIndex = (i+1) * numGroupsPerProcessor;
- if(i == (processors - 1)){ endIndex = groups.size(); }
- lines.push_back(linePair(startIndex, endIndex));
- }
-
+ int remainingPairs = groups.size();
+ int startIndex = 0;
+ for (int remainingProcessors = processors; remainingProcessors > 0; remainingProcessors--) {
+ int numPairs = remainingPairs; //case for last processor
+ if (remainingProcessors != 1) { numPairs = ceil(remainingPairs / remainingProcessors); }
+ lines.push_back(linePair(startIndex, (startIndex+numPairs))); //startIndex, endIndex
+ startIndex = startIndex + numPairs;
+ remainingPairs = remainingPairs - numPairs;
+ }
+
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
//loop through and create all the processes you want
#include "memeuclidean.h"
#include "mempearson.h"
#include "sharedjsd.h"
+#include "sharedrjsd.h"
//**********************************************************************************************************************
CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none","",false,true,true); parameters.push_back(pshared);
CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
CommandParameter pfreq("freq", "Number", "", "100", "", "", "","",false,false); parameters.push_back(pfreq);
- CommandParameter pcalc("calc", "Multiple", "sharedchao-sharedsobs-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-whittaker-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-structchi2-hamming-gower-memchi2-memchord-memeuclidean-mempearson-jsd", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan", "", "", "","",true,false,true); parameters.push_back(pcalc);
+ CommandParameter pcalc("calc", "Multiple", "sharedchao-sharedsobs-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-whittaker-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-structchi2-hamming-gower-memchi2-memchord-memeuclidean-mempearson-jsd-rjsd", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan", "", "", "","",true,false,true); parameters.push_back(pcalc);
CommandParameter pall("all", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(pall);
CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups);
CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
else if (type == "memeuclidean") { pattern = "[filename],memeuclidean"; }
else if (type == "mempearson") { pattern = "[filename],mempearson"; }
else if (type == "jsd") { pattern = "[filename],jsd"; }
+ else if (type == "rjsd") { pattern = "[filename],rjsd"; }
else { m->mothurOut("[ERROR]: No definition for type " + type + " output pattern.\n"); m->control_pressed = true; }
return pattern;
outputTypes["memeuclidean"] = tempOutNames;
outputTypes["mempearson"] = tempOutNames;
outputTypes["jsd"] = tempOutNames;
+ outputTypes["rjsd"] = tempOutNames;
}
catch(exception& e) {
outputTypes["memeuclidean"] = tempOutNames;
outputTypes["mempearson"] = tempOutNames;
outputTypes["jsd"] = tempOutNames;
+ outputTypes["rjsd"] = tempOutNames;
//if the user changes the input directory command factory will send this info to us in the output parameter
}else if (Estimators[i] == "jsd") {
cDisplays.push_back(new CollectDisplay(new JSD(), new SharedOneColumnFile(getOutputFileName("jsd", variables))));
outputNames.push_back(getOutputFileName("jsd", variables)); outputTypes["jsd"].push_back(getOutputFileName("jsd", variables));
+ }else if (Estimators[i] == "rjsd") {
+ cDisplays.push_back(new CollectDisplay(new RJSD(), new SharedOneColumnFile(getOutputFileName("rjsd", variables))));
+ outputNames.push_back(getOutputFileName("rjsd", variables)); outputTypes["rjsd"].push_back(getOutputFileName("rjsd", variables));
}
+
}
}
CommandParameter pshared("shared", "InputTypes", "", "", "none", "none", "none","outputType",false,true); parameters.push_back(pshared);
CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups);
CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
- CommandParameter pcalc("calc", "Multiple", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-whittaker-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-hamming-structchi2-gower-memchi2-memchord-memeuclidean-mempearson-jsd", "jsd", "", "", "","",false,false,true); parameters.push_back(pcalc);
+ CommandParameter pcalc("calc", "Multiple", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-whittaker-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-hamming-structchi2-gower-memchi2-memchord-memeuclidean-mempearson-jsd-rjsd", "rjsd", "", "", "","",false,false,true); parameters.push_back(pcalc);
CommandParameter psubsample("subsample", "String", "", "", "", "", "","",false,false); parameters.push_back(psubsample);
CommandParameter piters("iters", "Number", "", "1000", "", "", "","",false,false); parameters.push_back(piters);
CommandParameter pminpartitions("minpartitions", "Number", "", "5", "", "", "","",false,false,true); parameters.push_back(pminpartitions);
else { m->mothurOut("[ERROR]: " + method + " is not a valid method. Valid algorithms are dmm, kmeans and pam."); m->mothurOutEndLine(); abort = true; }
calc = validParameter.validFile(parameters, "calc", false);
- if (calc == "not found") { calc = "jsd"; }
+ if (calc == "not found") { calc = "rjsd"; }
else {
- if (calc == "default") { calc = "jsd"; }
+ if (calc == "default") { calc = "rjsd"; }
}
m->splitAtDash(calc, Estimators);
if (m->inUsersGroups("citation", Estimators)) {
matrixCalculator = new MemPearson();
}else if (Estimators[i] == "jsd") {
matrixCalculator = new JSD();
+ }else if (Estimators[i] == "rjsd") {
+ matrixCalculator = new RJSD();
}else {
m->mothurOut("[ERROR]: " + Estimators[i] + " is not a valid calculator, please correct.\n"); m->control_pressed = true; return results;
}
#include "memeuclidean.h"
#include "mempearson.h"
#include "sharedjsd.h"
+#include "sharedrjsd.h"
/**************************************************************************************************/
CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
CommandParameter psubsample("subsample", "String", "", "", "", "", "","",false,false); parameters.push_back(psubsample);
CommandParameter pgroups("groups", "String", "", "", "", "", "","",false,false); parameters.push_back(pgroups);
- CommandParameter pcalc("calc", "Multiple", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-whittaker-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-hamming-structchi2-gower-memchi2-memchord-memeuclidean-mempearson-jsd", "jclass-thetayc", "", "", "","",true,false,true); parameters.push_back(pcalc);
+ CommandParameter pcalc("calc", "Multiple", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-whittaker-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-hamming-structchi2-gower-memchi2-memchord-memeuclidean-mempearson-jsd-rjsd", "jclass-thetayc", "", "", "","",true,false,true); parameters.push_back(pcalc);
CommandParameter poutput("output", "Multiple", "lt-square-column", "lt", "", "", "","",false,false); parameters.push_back(poutput);
CommandParameter pmode("mode", "Multiple", "average-median", "average", "", "", "","",false,false); parameters.push_back(pmode);
CommandParameter pprocessors("processors", "Number", "", "1", "", "", "","",false,false,true); parameters.push_back(pprocessors);
matrixCalculators.push_back(new MemPearson());
}else if (Estimators[i] == "jsd") {
matrixCalculators.push_back(new JSD());
-
+ }else if (Estimators[i] == "rjsd") {
+ matrixCalculators.push_back(new RJSD());
}
}
}
#include "memeuclidean.h"
#include "mempearson.h"
#include "sharedjsd.h"
+#include "sharedrjsd.h"
// aka. dist.shared()
matrixCalculators.push_back(new MemPearson());
}else if (pDataArray->Estimators[i] == "jsd") {
matrixCalculators.push_back(new JSD());
+ }else if (pDataArray->Estimators[i] == "rjsd") {
+ matrixCalculators.push_back(new RJSD());
}
}
else if (numGroups < 2) { m->mothurOut("Not enough sets, I need at least 2 valid sets. Unable to complete command."); m->mothurOutEndLine(); m->control_pressed = true; }
if(processors != 1){
- int numPairs = namesOfGroupCombos.size();
- int numPairsPerProcessor = numPairs / processors;
-
- for (int i = 0; i < processors; i++) {
- int startPos = i * numPairsPerProcessor;
- if(i == processors - 1){
- numPairsPerProcessor = numPairs - i * numPairsPerProcessor;
- }
- lines.push_back(linePair(startPos, numPairsPerProcessor));
+ int remainingPairs = namesOfGroupCombos.size();
+ int startIndex = 0;
+ for (int remainingProcessors = processors; remainingProcessors > 0; remainingProcessors--) {
+ int numPairs = remainingPairs; //case for last processor
+ if (remainingProcessors != 1) { numPairs = ceil(remainingPairs / remainingProcessors); }
+ lines.push_back(linePair(startIndex, numPairs)); //startIndex, numPairs
+ startIndex = startIndex + numPairs;
+ remainingPairs = remainingPairs - numPairs;
}
}
}
lines.clear();
- int numPairs = namesOfGroupCombos.size();
- int numPairsPerProcessor = numPairs / processors;
-
- for (int i = 0; i < processors; i++) {
- int startPos = i * numPairsPerProcessor;
- if(i == processors - 1){ numPairsPerProcessor = numPairs - i * numPairsPerProcessor; }
- lines.push_back(linePair(startPos, numPairsPerProcessor));
+ int remainingPairs = namesOfGroupCombos.size();
+ int startIndex = 0;
+ for (int remainingProcessors = processors; remainingProcessors > 0; remainingProcessors--) {
+ int numPairs = remainingPairs; //case for last processor
+ if (remainingProcessors != 1) { numPairs = ceil(remainingPairs / remainingProcessors); }
+ lines.push_back(linePair(startIndex, numPairs)); //startIndex, numPairs
+ startIndex = startIndex + numPairs;
+ remainingPairs = remainingPairs - numPairs;
}
data = createProcesses(t, namesOfGroupCombos, ct);
//divide the groups between the processors
vector<linePair> lines;
- int numGroupsPerProcessor = groups.size() / processors;
- for (int i = 0; i < processors; i++) {
- int startIndex = i * numGroupsPerProcessor;
- int endIndex = (i+1) * numGroupsPerProcessor;
- if(i == (processors - 1)){ endIndex = groups.size(); }
- lines.push_back(linePair(startIndex, endIndex));
- }
+ int remainingPairs = groups.size();
+ int startIndex = 0;
+ for (int remainingProcessors = processors; remainingProcessors > 0; remainingProcessors--) {
+ int numPairs = remainingPairs; //case for last processor
+ if (remainingProcessors != 1) { numPairs = ceil(remainingPairs / remainingProcessors); }
+ lines.push_back(linePair(startIndex, (startIndex+numPairs))); //startIndex, endIndex
+ startIndex = startIndex + numPairs;
+ remainingPairs = remainingPairs - numPairs;
+ }
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
--- /dev/null
+//
+// sharedrjsd.cpp
+// Mothur
+//
+// Created by Sarah Westcott on 1/21/14.
+// Copyright (c) 2014 Schloss Lab. All rights reserved.
+//
+
+#include "sharedrjsd.h"
+
+/***********************************************************************/
+//KLD <- function(x,y) sum(x *log(x/y))
+//JSD<- function(x,y) sqrt(0.5 * KLD(x, (x+y)/2) + 0.5 * KLD(y, (x+y)/2))
+EstOutput RJSD::getValues(vector<SharedRAbundVector*> shared) {
+ try {
+
+ data.resize(1,0);
+
+ double KLD1 = 0.0;
+ double KLD2 = 0.0;
+
+ vector<int> countA = shared[0]->getAbundances();
+ vector<int> countB = shared[1]->getAbundances();
+ double totalA = 0;
+ double totalB = 0;
+
+ for (int i = 0; i < shared[0]->getNumBins(); i++) {
+ totalA += countA[i];
+ totalB += countB[i];
+ }
+
+ for (int i = 0; i < shared[0]->getNumBins(); i++) {
+ double tempA = countA[i] / totalA;
+ double tempB = countB[i] / totalB;
+
+ tempA = countA[i] / totalA;
+ tempB = countB[i] / totalB;
+
+ if (tempA == 0) { tempA = 0.000001; }
+ if (tempB == 0) { tempB = 0.000001; }
+
+ double denom = (tempA+tempB)/(double)2.0;
+
+ if (tempA != 0) { KLD1 += tempA * log(tempA/denom); } //KLD(x,m)
+ if (tempB != 0) { KLD2 += tempB * log(tempB/denom); } //KLD(y,m)
+
+ }
+
+ data[0] = sqrt((0.5*KLD1) + (0.5*KLD2));
+
+ if (isnan(data[0]) || isinf(data[0])) { data[0] = 0; }
+
+ return data;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "RJSD", "getValues");
+ exit(1);
+ }
+}
--- /dev/null
+//
+// sharedrjsd.h
+// Mothur
+//
+// Created by Sarah Westcott on 1/21/14.
+// Copyright (c) 2014 Schloss Lab. All rights reserved.
+//
+
+#ifndef Mothur_sharedrjsd_h
+#define Mothur_sharedrjsd_h
+
+#include "calculator.h"
+
+/***********************************************************************/
+//Jensen-Shannon divergence (JSD)
+class RJSD : public Calculator {
+
+public:
+ RJSD() : Calculator("rjsd", 1, false) {};
+ EstOutput getValues(SAbundVector*) {return data;};
+ EstOutput getValues(vector<SharedRAbundVector*>);
+ string getCitation() { return "http://www.mothur.org/wiki/RJSD"; }
+private:
+
+};
+
+/***********************************************************************/
+
+
+
+#endif
//divide the groups between the processors
vector<linePair> lines;
- int numGroupsPerProcessor = groups.size() / processors;
- for (int i = 0; i < processors; i++) {
- int startIndex = i * numGroupsPerProcessor;
- int endIndex = (i+1) * numGroupsPerProcessor;
- if(i == (processors - 1)){ endIndex = groups.size(); }
- lines.push_back(linePair(startIndex, endIndex));
- }
+ int remainingPairs = groups.size();
+ int startIndex = 0;
+ for (int remainingProcessors = processors; remainingProcessors > 0; remainingProcessors--) {
+ int numPairs = remainingPairs; //case for last processor
+ if (remainingProcessors != 1) { numPairs = ceil(remainingPairs / remainingProcessors); }
+ lines.push_back(linePair(startIndex, (startIndex+numPairs))); //startIndex, endIndex
+ startIndex = startIndex + numPairs;
+ remainingPairs = remainingPairs - numPairs;
+ }
+
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
CommandParameter plabel("label", "String", "", "", "", "", "","",false,false); parameters.push_back(plabel);
CommandParameter psubsample("subsample", "String", "", "", "", "", "","phylip",false,false); parameters.push_back(psubsample);
CommandParameter pdistance("distance", "Boolean", "", "F", "", "", "","phylip",false,false); parameters.push_back(pdistance);
- CommandParameter pcalc("calc", "Multiple", "sharedchao-sharedsobs-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-whittaker-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-structchi2-hamming-gower-memchi2-memchord-memeuclidean-mempearson-jsd", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan", "", "", "","",true,false,true); parameters.push_back(pcalc);
+ CommandParameter pcalc("calc", "Multiple", "sharedchao-sharedsobs-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan-kstest-whittaker-sharednseqs-ochiai-anderberg-kulczynski-kulczynskicody-lennon-morisitahorn-braycurtis-odum-canberra-structeuclidean-structchord-hellinger-manhattan-structpearson-soergel-spearman-structkulczynski-speciesprofile-structchi2-hamming-gower-memchi2-memchord-memeuclidean-mempearson-jsd-rjsd", "sharedsobs-sharedchao-sharedace-jabund-sorabund-jclass-sorclass-jest-sorest-thetayc-thetan", "", "", "","",true,false,true); parameters.push_back(pcalc);
CommandParameter poutput("output", "Multiple", "lt-square", "lt", "", "", "","",false,false); parameters.push_back(poutput);
CommandParameter pall("all", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(pall);
CommandParameter piters("iters", "Number", "", "1000", "", "", "","",false,false); parameters.push_back(piters);
sumCalculators.push_back(new MemPearson());
}else if (Estimators[i] == "jsd") {
sumCalculators.push_back(new JSD());
+ }else if (Estimators[i] == "rjsd") {
+ sumCalculators.push_back(new RJSD());
}
}
}
#include "memeuclidean.h"
#include "mempearson.h"
#include "sharedjsd.h"
+#include "sharedrjsd.h"
class SummarySharedCommand : public Command {
sumCalculators.push_back(new MemPearson());
}else if (pDataArray->Estimators[i] == "jsd") {
sumCalculators.push_back(new JSD());
+ }else if (pDataArray->Estimators[i] == "rjsd") {
+ sumCalculators.push_back(new RJSD());
}
}
}
lines.clear();
//breakdown work between processors
- int numPairs = namesOfGroupCombos.size();
- int numPairsPerProcessor = numPairs / processors;
-
- for (int i = 0; i < processors; i++) {
- int startPos = i * numPairsPerProcessor;
- if(i == processors - 1){ numPairsPerProcessor = numPairs - i * numPairsPerProcessor; }
- lines.push_back(linePair(startPos, numPairsPerProcessor));
+ int remainingPairs = namesOfGroupCombos.size();
+ int startIndex = 0;
+ for (int remainingProcessors = processors; remainingProcessors > 0; remainingProcessors--) {
+ int numPairs = remainingPairs; //case for last processor
+ if (remainingProcessors != 1) { numPairs = ceil(remainingPairs / remainingProcessors); }
+ lines.push_back(linePair(startIndex, numPairs)); //startIndex, numPairs
+ startIndex = startIndex + numPairs;
+ remainingPairs = remainingPairs - numPairs;
}
+
//get scores for random trees
}
lines.clear();
- int numPairs = namesOfGroupCombos.size();
- int numPairsPerProcessor = numPairs / processors;
-
- for (int i = 0; i < processors; i++) {
- int startPos = i * numPairsPerProcessor;
- if(i == processors - 1){ numPairsPerProcessor = numPairs - i * numPairsPerProcessor; }
- lines.push_back(linePair(startPos, numPairsPerProcessor));
+ int remainingPairs = namesOfGroupCombos.size();
+ int startIndex = 0;
+ for (int remainingProcessors = processors; remainingProcessors > 0; remainingProcessors--) {
+ int numPairs = remainingPairs; //case for last processor
+ if (remainingProcessors != 1) { numPairs = ceil(remainingPairs / remainingProcessors); }
+ lines.push_back(linePair(startIndex, numPairs)); //startIndex, numPairs
+ startIndex = startIndex + numPairs;
+ remainingPairs = remainingPairs - numPairs;
}
data = createProcesses(t, namesOfGroupCombos, ct);
lines.clear();
int numPairs = namesOfGroupCombos.size();
- int numPairsPerProcessor = numPairs / processors;
+ int numPairsPerProcessor = ceil(numPairs / processors);
for (int i = 0; i < processors; i++) {
int startPos = i * numPairsPerProcessor;
#include "sharedsobs.h"
#include "sharednseqs.h"
#include "sharedjsd.h"
+#include "sharedrjsd.h"
/********************************************************************/
}else if (Estimators[i] == "sharedobserved") { Calculator* temp = new SharedSobs(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
}else if (Estimators[i] == "kulczynski") { Calculator* temp = new Kulczynski(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
}else if (Estimators[i] == "jsd") { Calculator* temp = new JSD(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
+ }else if (Estimators[i] == "rjsd") { Calculator* temp = new RJSD(); m->mothurOut(temp->getName() + ": "); temp->citation(); delete temp;
}else { m->mothurOut("[ERROR]: Missing else if for " + Estimators[i] + " in printCitations."); m->mothurOutEndLine(); }
}else { m->mothurOut(Estimators[i] + " is not a valid calculator, no citation will be given."); m->mothurOutEndLine(); }
}
shared["memchord"] = "memchord";
shared["memeuclidean"] = "memeuclidean";
shared["mempearson"] = "mempearson";
- shared["jsd"] = "jsd";
+ shared["jsd"] = "jsd";
+ shared["rjsd"] = "rjsd";
shared["default"] = "default";
}
catch(exception& e) {
sharedsummary["memchord"] = "memchord";
sharedsummary["memeuclidean"] = "memeuclidean";
sharedsummary["mempearson"] = "mempearson";
- sharedsummary["jsd"] = "jsd";
+ sharedsummary["jsd"] = "jsd";
+ sharedsummary["rjsd"] = "rjsd";
sharedsummary["default"] = "default";
}
catch(exception& e) {
matrix["structchi2"] = "structchi2";
matrix["soergel"] = "soergel";
matrix["spearman"] = "spearman";
- matrix["speciesprofile"] = "speciesprofile";
+ matrix["speciesprofile"] = "speciesprofile";
matrix["hamming"] = "hamming";
matrix["gower"] = "gower";
matrix["memchi2"] = "memchi2";
matrix["memchord"] = "memchord";
matrix["memeuclidean"] = "memeuclidean";
- matrix["mempearson"] = "mempearson";
- matrix["jsd"] = "jsd";
+ matrix["mempearson"] = "mempearson";
+ matrix["rjsd"] = "rjsd";
+ matrix["jsd"] = "jsd";
}
catch(exception& e) {
}
}
- int numPairs = namesOfGroupCombos.size();
- int numPairsPerProcessor = numPairs / processors;
-
- for (int i = 0; i < processors; i++) {
- int startPos = i * numPairsPerProcessor;
- if(i == processors - 1){ numPairsPerProcessor = numPairs - i * numPairsPerProcessor; }
- lines.push_back(linePair(startPos, numPairsPerProcessor));
+ int remainingPairs = namesOfGroupCombos.size();
+ int startIndex = 0;
+ for (int remainingProcessors = processors; remainingProcessors > 0; remainingProcessors--) {
+ int numPairs = remainingPairs; //case for last processor
+ if (remainingProcessors != 1) { numPairs = ceil(remainingPairs / remainingProcessors); }
+ lines.push_back(linePair(startIndex, numPairs)); //startIndex, numPairs
+ startIndex = startIndex + numPairs;
+ remainingPairs = remainingPairs - numPairs;
}
data = createProcesses(t, namesOfGroupCombos, ct);