3746107E0F4064D100460C57 /* weighted.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3746107D0F4064D100460C57 /* weighted.cpp */; };
374610830F40652400460C57 /* unweighted.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 374610820F40652400460C57 /* unweighted.cpp */; };
3746109D0F40657600460C57 /* unifracunweightedcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3746109C0F40657600460C57 /* unifracunweightedcommand.cpp */; };
+ 37519A6B0F80E6EB00FED5E8 /* sharedanderbergs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37519A6A0F80E6EB00FED5E8 /* sharedanderbergs.cpp */; };
375873E70F7D63E90040F377 /* coverage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 375873E50F7D63E90040F377 /* coverage.cpp */; };
375873EC0F7D64520040F377 /* fullmatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 375873EB0F7D64520040F377 /* fullmatrix.cpp */; };
375873EF0F7D646F0040F377 /* heatmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 375873EE0F7D646F0040F377 /* heatmap.cpp */; };
374610820F40652400460C57 /* unweighted.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = unweighted.cpp; sourceTree = "<group>"; };
3746109B0F40657600460C57 /* unifracunweightedcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unifracunweightedcommand.h; sourceTree = "<group>"; };
3746109C0F40657600460C57 /* unifracunweightedcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = unifracunweightedcommand.cpp; sourceTree = "<group>"; };
+ 37519A690F80E6EB00FED5E8 /* sharedanderbergs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedanderbergs.h; sourceTree = "<group>"; };
+ 37519A6A0F80E6EB00FED5E8 /* sharedanderbergs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedanderbergs.cpp; sourceTree = "<group>"; };
375873E50F7D63E90040F377 /* coverage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = coverage.cpp; sourceTree = "<group>"; };
375873E60F7D63E90040F377 /* coverage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = coverage.h; sourceTree = "<group>"; };
375873EA0F7D64520040F377 /* fullmatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fullmatrix.h; sourceTree = "<group>"; };
37D9281E0F21331F001D4494 /* shannon.cpp */,
37D928230F21331F001D4494 /* sharedace.h */,
37D928220F21331F001D4494 /* sharedace.cpp */,
+ 37519A690F80E6EB00FED5E8 /* sharedanderbergs.h */,
+ 37519A6A0F80E6EB00FED5E8 /* sharedanderbergs.cpp */,
375873FB0F7D64DA0040F377 /* sharedbraycurtis.h */,
375873FC0F7D64DA0040F377 /* sharedbraycurtis.cpp */,
EB6F01590F6AC1670048081A /* sharedbdiversity.h */,
375874060F7D64EF0040F377 /* sharedkulczynskicody.cpp in Sources */,
3758740C0F7D64FC0040F377 /* sharedmorisitahorn.cpp in Sources */,
3758740D0F7D64FC0040F377 /* sharedochiai.cpp in Sources */,
+ 37519A6B0F80E6EB00FED5E8 /* sharedanderbergs.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
#include "sharedbdiversity.h"
#include "sharednseqs.h"
#include "sharedochiai.h"
-//#include "sharedanderberg.h"
+#include "sharedanderbergs.h"
#include "sharedkulczynski.h"
#include "sharedkulczynskicody.h"
#include "sharedlennon.h"
cDisplays.push_back(new CollectDisplay(new SharedNSeqs(), new SharedOneColumnFile(fileNameRoot+"shared.nseqs")));
}else if (globaldata->Estimators[i] == "sharedochiai") {
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] == "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") {
//fills vector of sharedsabunds - lookup
getSharedVectors(sharedorder);
+ //sort lookup so shared bins are on top
+ sortSharedVectors();
+
//get maxBin
for (int i = 0; i < lookup.size(); i++) {
for (int j = 0; j < lookup[i]->size(); j++) {
//**********************************************************************************************************************
void HeatMap::getSharedVectors(SharedOrderVector* order){
try {
+
+ //delete lookup
+ for (int j = 0; j < lookup.size(); j++) {
+ delete lookup[j];
+ }
+
lookup.clear();
groupComb = "";
}
+
+//**********************************************************************************************************************
+void HeatMap::sortSharedVectors(){
+ try {
+ //copy lookup and then clear it to refill with sorted.
+ //loop though lookup and determine if they are shared
+ //if they are then insert in the front
+ //if not push to back
+
+ bool shared;
+ vector<SharedRAbundVector*> looktemp;
+
+ //create and initialize looktemp as a copy of lookup
+ for (int i = 0; i < lookup.size(); i++) {
+ SharedRAbundVector* temp = new SharedRAbundVector(lookup[i]->getNumBins());
+ temp->setLabel(lookup[i]->getLabel());
+ temp->setGroup(lookup[i]->getGroup());
+ //copy lookup i's info
+ for (int j = 0; j < lookup[i]->size(); j++) {
+ temp->set(j, lookup[i]->getAbundance(j), lookup[i]->getGroup());
+ }
+ looktemp.push_back(temp);
+ }
+
+ //clear out lookup to create sorted lookup
+ lookup.clear();
+
+ //create and initialize lookup to empty vectors
+ for (int i = 0; i < looktemp.size(); i++) {
+ SharedRAbundVector* temp = new SharedRAbundVector();
+ lookup.push_back(temp);
+ }
+
+ //for each bin
+ for (int i = 0; i < looktemp[0]->size(); i++) {
+ shared = true;
+ //for each group
+ for (int j = 0; j < looktemp.size(); j++) {
+ if (looktemp[j]->getAbundance(i) == 0) { shared = false; }
+ }
+
+ //fill lookup
+ for (int j = 0; j < looktemp.size(); j++) {
+ //if they are not shared then push to back, if they are not insert in front
+ if (shared == false) { lookup[j]->push_back(looktemp[j]->getAbundance(i), i, looktemp[j]->getGroup()); }
+ else { lookup[j]->push_front(looktemp[j]->getAbundance(i), i, looktemp[j]->getGroup()); }
+ }
+ }
+
+ //delete looktemp
+ for (int j = 0; j < looktemp.size(); j++) {
+ delete looktemp[j];
+ }
+
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the HeatMap class Function sortSharedVectors. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the HeatMap class function sortSharedVectors. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+
+}
+
//**********************************************************************************************************************
+
+
private:
void getSharedVectors(SharedOrderVector*);
-
+ void sortSharedVectors();
+
GlobalData* globaldata;
vector<SharedRAbundVector*> lookup;
RAbundVector rabund;
cout << "The default value for groups is all the groups in your groupfile, iters is 10000, cutoff is 1.0, form is integral and step is 0.01." << "\n";
cout << "The libshuff command output two files: .coverage and .slsummary their descriptions are in the manual." << "\n";
cout << "Note: No spaces between parameter labels (i.e. iters), '=' and parameters (i.e.yourIters)." << "\n" << "\n";
+ }else if (globaldata->helpRequest == "heatmap") {
+ cout << "The heatmap command can only be executed after a successful read.otu command." << "\n";
+ cout << "The heatmap command parameters are groups, line and label. No parameters are required, but you may not use line and label at the same time." << "\n";
+ cout << "The groups parameter allows you to specify which of the groups in your groupfile you would like included in your heatmap." << "\n";
+ cout << "The group names are separated by dashes. The line and label allow you to select what distance levels you would like a heatmap created for, and are also separated by dashes." << "\n";
+ cout << "The heatmap command should be in the following format: heatmap(groups=yourGroups, line=yourLines, label=yourLabels)." << "\n";
+ cout << "Example heatmap(groups=A-B-C, line=1-3-5)." << "\n";
+ cout << "The default value for groups is all the groups in your groupfile, and all lines in your inputfile will be used." << "\n";
+ cout << "The heatmap command outputs a .svg file for each line or label you specify." << "\n";
+ cout << "Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups)." << "\n" << "\n";
}else if (globaldata->helpRequest == "quit") {
cout << "The quit command will terminate Dotur and should be in the following format: " << "\n";
cout << "quit()" << "\n" << "\n";
--- /dev/null
+/*
+ * sharedanderberg.cpp
+ * Mothur
+ *
+ * Created by Sarah Westcott on 3/23/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include "sharedanderbergs.h"
+
+/***********************************************************************/
+
+EstOutput SharedAnderberg::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)((2 * S1) + (2 * S2) - (3 * 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 SharedAnderberg class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the SharedAnderberg class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/***********************************************************************/
--- /dev/null
+#ifndef SHAREDANDERBERG_H
+#define SHAREDANDERBERG_H
+/*
+ * sharedanderberg.h
+ * Mothur
+ *
+ * Created by Sarah Westcott on 3/23/09.
+ * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
+ *
+ */
+
+#include "calculator.h"
+
+/***********************************************************************/
+
+class SharedAnderberg : public Calculator {
+
+ public:
+ SharedAnderberg() : Calculator("SharedAnderberg", 1) {};
+ EstOutput getValues(SAbundVector*) {return data;};
+ EstOutput getValues(SharedRAbundVector*, SharedRAbundVector*);
+ private:
+
+};
+
+/***********************************************************************/
+
+
+
+#endif
\ No newline at end of file
}
}
+
/***********************************************************************/
+void SharedRAbundVector::push_front(int binSize, int otu, string groupName){
+ try {
+ individual newGuy;
+ newGuy.abundance = binSize;
+ newGuy.group = groupName;
+ newGuy.bin = otu;
+
+ data.insert(data.begin(), newGuy);
+ numBins++;
+
+ if(binSize > maxRank){
+ maxRank = binSize;
+ }
+
+ numSeqs += binSize;
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the SharedRAbundVector class Function push_front. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the SharedRAbundVector class function push_front. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+}
+
+/***********************************************************************/
void SharedRAbundVector::pop_back(){
return data.pop_back();
int getAbundance(int);
int numNZ();
void sortD(); //Sorts the data in descending order.
- void push_back(int, int, string); //abundance, OTU, groupname
+ void push_front(int, int, string); //abundance, otu, groupname
+ void push_back(int, int, string); //abundance, otu, groupname
void pop_back();
void resize(int);
int size();
#include "sharedkstest.h"
#include "sharedbdiversity.h"
#include "sharedochiai.h"
-//#include "sharedanderberg.h"
+#include "sharedanderbergs.h"
#include "sharedkulczynski.h"
#include "sharedkulczynskicody.h"
#include "sharedlennon.h"
sumCalculators.push_back(new SharedNSeqs());
}else if (globaldata->Estimators[i] == "sharedochiai") {
sumCalculators.push_back(new SharedOchiai());
- //}else if (globaldata->Estimators[i] == "sharedanderberg") {
- //sumCalculators.push_back(new SharedAnderberg());
+ }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") {
try {
//{"parameter1","parameter2",...,"last parameter"};
- string readdistArray[] = {"phylip","name","cutoff","precision"};
+ string readdistArray[] = {"phylip","column", "name","cutoff","precision"};
commandParameters["read.dist"] = addParameters(readdistArray, sizeof(readdistArray)/sizeof(string));
- string readotuArray[] = {"list","order","group","shared", "sabund"};
+ string readotuArray[] = {"list","order","shared", "line", "label","group","shared", "sabund", "rabund"};
commandParameters["read.otu"] = addParameters(readotuArray, sizeof(readotuArray)/sizeof(string));
+ string readtreeArray[] = {"tree","group"};
+ commandParameters["read.tree"] = addParameters(readtreeArray, sizeof(readtreeArray)/sizeof(string));
+
string clusterArray[] = {"cutoff","precision","method"};
commandParameters["cluster"] = addParameters(clusterArray, sizeof(clusterArray)/sizeof(string));
string deconvoluteArray[] = {"fasta"};
commandParameters["deconvolute"] = addParameters(deconvoluteArray, sizeof(deconvoluteArray)/sizeof(string));
- string collectsingleArray[] = {"freq","line","label","single","precision","abund"};
+ string collectsingleArray[] = {"freq","line","label","calc","precision","abund"};
commandParameters["collect.single"] = addParameters(collectsingleArray, sizeof(collectsingleArray)/sizeof(string));
- string collectsharedArray[] = {"jumble","freq","line","label","shared","groups"};
+ string collectsharedArray[] = {"jumble","freq","line","label","calc","groups"};
commandParameters["collect.shared"] = addParameters(collectsharedArray, sizeof(collectsharedArray)/sizeof(string));
string getgroupArray[] = {};
string getlineArray[] = {};
commandParameters["get.line"] = addParameters(getlineArray, sizeof(getlineArray)/sizeof(string));
- string rarefactionsingleArray[] = {"iters","freq","line","label","rarefaction","abund"};
+ string rarefactionsingleArray[] = {"iters","freq","line","label","calc","abund"};
commandParameters["rarefaction.single"] = addParameters(rarefactionsingleArray, sizeof(rarefactionsingleArray)/sizeof(string));
- string rarefactionsharedArray[] = {"iters","jumble","line","label","sharedrarefaction"};
+ string rarefactionsharedArray[] = {"iters","jumble","line","label","calc"};
commandParameters["rarefaction.shared"] = addParameters(rarefactionsharedArray, sizeof(rarefactionsharedArray)/sizeof(string));
string libshuffArray[] = {"iters","groups","step","form","cutoff"};
commandParameters["libshuff"] = addParameters(libshuffArray, sizeof(libshuffArray)/sizeof(string));
- string summarysingleArray[] = {"line","label","summary","abund"};
+ string summarysingleArray[] = {"line","label","calc","abund"};
commandParameters["summary.single"] = addParameters(summarysingleArray, sizeof(summarysingleArray)/sizeof(string));
- string summarysharedArray[] = {"jumble","line","label","sharedsummary"};
+ string summarysharedArray[] = {"jumble","line","label","calc"};
commandParameters["summary.shared"] = addParameters(summarysharedArray, sizeof(summarysharedArray)/sizeof(string));
+ string parsimonyArray[] = {"random","group","iters"};
+ commandParameters["parsimony"] = addParameters(parsimonyArray, sizeof(parsimonyArray)/sizeof(string));
+
+ string unifracWeightedArray[] = {"group","iters"};
+ commandParameters["unifrac.weighted"] = addParameters(unifracWeightedArray, sizeof(unifracWeightedArray)/sizeof(string));
+
+ string unifracUnweightedArray[] = {"group","iters"};
+ commandParameters["unifrac.unweighted"] = addParameters(unifracUnweightedArray, sizeof(unifracUnweightedArray)/sizeof(string));
+
+ string heatmapArray[] = {"group","line","label"};
+ commandParameters["heatmap"] = addParameters(heatmapArray, sizeof(heatmapArray)/sizeof(string));
+
string quitArray[] = {};
commandParameters["quit"] = addParameters(quitArray, sizeof(quitArray)/sizeof(string));