37D9289F0F21331F001D4494 /* validparameter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D928530F21331F001D4494 /* validparameter.cpp */; };
37E5F3E30F29FD4200F8D827 /* treenode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37E5F3E20F29FD4200F8D827 /* treenode.cpp */; };
37E5F4920F2A3DA800F8D827 /* readtreecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */; };
- 7E44EBD10F3235D900B0D45D /* makefile in Sources */ = {isa = PBXBuildFile; fileRef = 7E44EBD00F32358B00B0D45D /* makefile */; };
8DD76F6A0486A84900D96B5E /* Mothur.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859E8B029090EE04C91782 /* Mothur.1 */; };
EBA52D2C0F378B0F00122C15 /* getgroupcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBA52D2B0F378B0F00122C15 /* getgroupcommand.cpp */; };
EBFD67840F33876C00883537 /* getlabelcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBFD67830F33876C00883537 /* getlabelcommand.cpp */; };
37E5F3E20F29FD4200F8D827 /* treenode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = treenode.cpp; sourceTree = SOURCE_ROOT; };
37E5F4900F2A3DA800F8D827 /* readtreecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readtreecommand.h; sourceTree = SOURCE_ROOT; };
37E5F4910F2A3DA800F8D827 /* readtreecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readtreecommand.cpp; sourceTree = SOURCE_ROOT; };
- 7E44EBD00F32358B00B0D45D /* makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = makefile; sourceTree = "<group>"; };
8DD76F6C0486A84900D96B5E /* mothur */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = mothur; sourceTree = BUILT_PRODUCTS_DIR; };
C6859E8B029090EE04C91782 /* Mothur.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = Mothur.1; sourceTree = "<group>"; };
EBA52D2A0F378B0F00122C15 /* getgroupcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = getgroupcommand.h; sourceTree = "<group>"; };
37D927D60F21331F001D4494 /* display.h */,
37D927D80F21331F001D4494 /* engine.hpp */,
37D927D70F21331F001D4494 /* engine.cpp */,
- 7E44EBD00F32358B00B0D45D /* makefile */,
37D928B10F213472001D4494 /* errorcheckor */,
37D927DE0F21331F001D4494 /* fileoutput.h */,
37D927DD0F21331F001D4494 /* fileoutput.cpp */,
37E5F3E30F29FD4200F8D827 /* treenode.cpp in Sources */,
37E5F4920F2A3DA800F8D827 /* readtreecommand.cpp in Sources */,
379293C30F2DE73400B9034A /* treemap.cpp in Sources */,
- 7E44EBD10F3235D900B0D45D /* makefile in Sources */,
EBFD67840F33876C00883537 /* getlabelcommand.cpp in Sources */,
EBFD67E80F339AAA00883537 /* getlinecommand.cpp in Sources */,
EBA52D2C0F378B0F00122C15 /* getgroupcommand.cpp in Sources */,
/***********************************************************************/
void Collect::getCurve(int increment = 1){
- try {
- RAbundVector* lookup = new RAbundVector(order->getNumBins());
- SAbundVector* rank = new SAbundVector(order->getMaxRank()+1);
-
- CollectorsCurveData* ccd = new CollectorsCurveData();
-
- for(int i=0;i<displays.size();i++){
- ccd->registerDisplay(displays[i]); //adds a display[i] to cdd
- displays[i]->init(label); //sets displays label
- }
- for(int i=0;i<numSeqs;i++){
-
- int binNumber = order->get(i);
- int abundance = lookup->get(binNumber);
-
- rank->set(abundance, rank->get(abundance)-1);
-
- abundance++;
-
- lookup->set(binNumber, abundance);
- rank->set(abundance, rank->get(abundance)+1); //increment rank(abundance)
-
- if((i == 0) || (i+1) % increment == 0){
- ccd->updateRankData(rank);
- }
- }
-
- if(numSeqs % increment != 0){
- ccd->updateRankData(rank);
- }
-
- for(int i=0;i<displays.size();i++){
- displays[i]->reset();
- }
- }
- catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the Collect class Function getCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the Collect class function getCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
+ try {
+ RAbundVector* lookup = new RAbundVector(order->getNumBins());
+ SAbundVector* rank = new SAbundVector(order->getMaxRank()+1);
+
+ CollectorsCurveData* ccd = new CollectorsCurveData();
+
+ for(int i=0;i<displays.size();i++){
+ ccd->registerDisplay(displays[i]); //adds a display[i] to cdd
+ displays[i]->init(label); //sets displays label
+ }
+ for(int i=0;i<numSeqs;i++){
+
+ int binNumber = order->get(i);
+ int abundance = lookup->get(binNumber);
+
+ rank->set(abundance, rank->get(abundance)-1);
+
+ abundance++;
+
+ lookup->set(binNumber, abundance);
+ rank->set(abundance, rank->get(abundance)+1); //increment rank(abundance)
+
+ if((i == 0) || (i+1) % increment == 0){
+ ccd->updateRankData(rank);
+ }
+ }
+
+ if(numSeqs % increment != 0){
+ ccd->updateRankData(rank);
+ }
+
+ for(int i=0;i<displays.size();i++){
+ displays[i]->reset();
+ }
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the Collect class Function getCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the Collect class function getCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
}
/***********************************************************************/
void Collect::getSharedCurve(int increment = 1){
try {
- globaldata = GlobalData::getInstance();
- vector<SharedRAbundVector*> lookup;
- vector<string> chosenGroups = globaldata->sharedGroups;
-
- //create and initialize vector of sharedvectors, one for each group
- for (int i = 0; i < globaldata->gGroupmap->getNumGroups(); i++) {
- SharedRAbundVector* temp = new SharedRAbundVector(sharedorder->getNumBins());
- temp->setLabel(sharedorder->getLabel());
- temp->setGroup(globaldata->gGroupmap->namesOfGroups[i]);
- temp->setGroupIndex(globaldata->gGroupmap->groupIndex[globaldata->gGroupmap->namesOfGroups[i]]);
- lookup.push_back(temp);
- }
-
- SharedCollectorsCurveData* ccd = new SharedCollectorsCurveData();
-
- //initialize labels for output
- //makes 'uniqueAB uniqueAC uniqueBC' if your groups are A, B, C
- getGroupComb(chosenGroups);
- groupLabel = "";
- for (int s = 0; s < groupComb.size(); s++) {
- groupLabel = groupLabel + label + groupComb[s] + "\t";
- }
-
- for(int i=0;i<displays.size();i++){
- ccd->registerDisplay(displays[i]); //adds a display[i] to cdd
- displays[i]->init(groupLabel);
- }
-
- //sample all the members
- for(int i=0;i<numSeqs;i++){
- //get first sample
- individual chosen = sharedorder->get(i);
- int abundance;
- //set info for sharedvector in chosens group
- for (int j = 0; j < lookup.size(); j++) {
- if (chosen.group == lookup[j]->getGroup()) {
- abundance = lookup[j]->getAbundance(chosen.bin);
- lookup[j]->set(chosen.bin, (abundance + 1), chosen.group);
- break;
- }
- }
-
- //calculate at 0 and the given increment
- if((i == 0) || (i+1) % increment == 0){
- //randomize group order
- if (globaldata->getJumble() == "1") { random_shuffle(lookup.begin(), lookup.end()); }
- //how many comparisons to make i.e. for group a, b, c = ab, ac, bc.
- int n = 1;
- for (int k = 0; k < (lookup.size() - 1); k++) { // pass cdd each set of groups to commpare
- for (int l = n; l < lookup.size(); l++) {
- ccd->updateSharedData(lookup[k], lookup[l], i+1, globaldata->gGroupmap->namesOfGroups.size());
- }
- n++;
- }
- totalNumSeq = i+1;
- }
- }
-
- //calculate last line if you haven't already
- if(numSeqs % increment != 0){
- //how many comparisons to make i.e. for group a, b, c = ab, ac, bc.
- int n = 1;
- for (int k = 0; k < (lookup.size() - 1); k++) { // pass cdd each set of groups to commpare
- for (int l = n; l < lookup.size(); l++) {
- ccd->updateSharedData(lookup[k], lookup[l], totalNumSeq, globaldata->gGroupmap->namesOfGroups.size());
- }
- n++;
- }
- }
-
- //resets output files
- for(int i=0;i<displays.size();i++){
- displays[i]->reset();
- }
- }
- catch(exception& e) {
- cout << "Standard Error: " << e.what() << " has occurred in the Collect class Function getSharedCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
- catch(...) {
- cout << "An unknown error has occurred in the Collect class function getSharedCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
- exit(1);
- }
+ globaldata = GlobalData::getInstance();
+ vector<SharedRAbundVector*> lookup;
+
+ //create and initialize vector of sharedvectors, one for each group
+ for (int i = 0; i < globaldata->gGroupmap->getNumGroups(); i++) {
+ SharedRAbundVector* temp = new SharedRAbundVector(sharedorder->getNumBins());
+ temp->setLabel(sharedorder->getLabel());
+ temp->setGroup(globaldata->gGroupmap->namesOfGroups[i]);
+ temp->setGroupIndex(globaldata->gGroupmap->groupIndex[globaldata->gGroupmap->namesOfGroups[i]]);
+ lookup.push_back(temp);
+ }
+
+ SharedCollectorsCurveData* ccd = new SharedCollectorsCurveData();
+
+ //initialize labels for output
+ //makes 'uniqueAB uniqueAC uniqueBC' if your groups are A, B, C
+ getGroupComb();
+ groupLabel = "";
+ for (int s = 0; s < groupComb.size(); s++) {
+ groupLabel = groupLabel + label + groupComb[s] + "\t";
+ }
+
+ for(int i=0;i<displays.size();i++){
+ ccd->registerDisplay(displays[i]); //adds a display[i] to cdd
+ displays[i]->init(groupLabel);
+ }
+
+ //sample all the members
+ for(int i=0;i<numSeqs;i++){
+ //get first sample
+ individual chosen = sharedorder->get(i);
+ int abundance;
+
+ //set info for sharedvector in chosens group
+ for (int j = 0; j < lookup.size(); j++) {
+ if (chosen.group == lookup[j]->getGroup()) {
+ abundance = lookup[j]->getAbundance(chosen.bin);
+ lookup[j]->set(chosen.bin, (abundance + 1), chosen.group);
+ break;
+ }
+ }
+
+ //calculate at 0 and the given increment
+ if((i == 0) || (i+1) % increment == 0){
+ //randomize group order
+ if (globaldata->getJumble() == "1") { random_shuffle(lookup.begin(), lookup.end()); }
+ //how many comparisons to make i.e. for group a, b, c = ab, ac, bc.
+ int n = 1;
+ for (int k = 0; k < (lookup.size() - 1); k++) { // pass cdd each set of groups to commpare
+ for (int l = n; l < lookup.size(); l++) {
+ ccd->updateSharedData(lookup[k], lookup[l], i+1, globaldata->gGroupmap->namesOfGroups.size());
+ }
+ n++;
+ }
+ }
+ totalNumSeq = i+1;
+ }
+
+ //calculate last line if you haven't already
+ if(numSeqs % increment != 0){
+ //how many comparisons to make i.e. for group a, b, c = ab, ac, bc.
+ int n = 1;
+ for (int k = 0; k < (lookup.size() - 1); k++) { // pass cdd each set of groups to commpare
+ for (int l = n; l < lookup.size(); l++) {
+ ccd->updateSharedData(lookup[k], lookup[l], totalNumSeq, globaldata->gGroupmap->namesOfGroups.size());
+ }
+ n++;
+ }
+ }
+
+ //resets output files
+ for(int i=0;i<displays.size();i++){
+ displays[i]->reset();
+ }
+ }
+ catch(exception& e) {
+ cout << "Standard Error: " << e.what() << " has occurred in the Collect class Function getSharedCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
+ catch(...) {
+ cout << "An unknown error has occurred in the Collect class function getSharedCurve. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
+ exit(1);
+ }
}
/**************************************************************************************/
-void Collect::getGroupComb(vector<string> chosen) {
- string group;
-
- numGroupComb = 0;
-
- int n = 1;
- for (int i = 0; i < (globaldata->gGroupmap->getNumGroups() - 1); i++) {
- for (int l = n; l < globaldata->gGroupmap->getNumGroups(); l++) {
- string g1 = globaldata->gGroupmap->namesOfGroups[i];
- string g2 = globaldata->gGroupmap->namesOfGroups[l];
- if(validGroup(chosen, g1) && validGroup(chosen, g2)) {
- group = g1 + g2;
- groupComb.push_back(group);
- numGroupComb++;
- }
- }
- n++;
- }
-}
-
-/**************************************************************************************/
+void Collect::getGroupComb() {
+ string group;
+
+ numGroupComb = 0;
+
+ int n = 1;
+ for (int i = 0; i < (globaldata->gGroupmap->getNumGroups() - 1); i++) {
+ for (int l = n; l < globaldata->gGroupmap->getNumGroups(); l++) {
+ group = globaldata->gGroupmap->namesOfGroups[i] + globaldata->gGroupmap->namesOfGroups[l];
+ groupComb.push_back(group);
+ numGroupComb++;
+ }
+ n++;
+ }
-bool Collect::validGroup(vector<string> chosen, string group) {
- if(chosen.size() == 0)
- return true;
- for(int i = 0; i < chosen.size(); i++)
- if(chosen.at(i).compare(group) == 0)
- return true;
- return false;
}
-
-
+/**************************************************************************************/
\ No newline at end of file