From: westcott Date: Fri, 23 Jan 2009 13:06:57 +0000 (+0000) Subject: fixed bug in sharedcommand and parselistcommand and changed file extension of sorenso... X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=commitdiff_plain;h=4761e165b4a196fefa57755d3176d9ced19df6b1 fixed bug in sharedcommand and parselistcommand and changed file extension of sorensonabund. --- diff --git a/Mothur.xcodeproj/project.pbxproj b/Mothur.xcodeproj/project.pbxproj index a3ed9b8..e8d32aa 100644 --- a/Mothur.xcodeproj/project.pbxproj +++ b/Mothur.xcodeproj/project.pbxproj @@ -11,6 +11,8 @@ 372E12960F263D5A0095CF7E /* readdistcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E12950F263D5A0095CF7E /* readdistcommand.cpp */; }; 372E12ED0F264D320095CF7E /* commandfactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 372E12EC0F264D320095CF7E /* commandfactory.cpp */; }; 37AD4CE40F28AEA300AA2D49 /* sharedlistvector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AD4CE30F28AEA300AA2D49 /* sharedlistvector.cpp */; }; + 37AD4DBB0F28E2FE00AA2D49 /* tree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AD4DBA0F28E2FE00AA2D49 /* tree.cpp */; }; + 37AD4DCA0F28F3DD00AA2D49 /* readtree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37AD4DC90F28F3DD00AA2D49 /* readtree.cpp */; }; 37B28F680F27590100808A62 /* deconvolutecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37B28F670F27590100808A62 /* deconvolutecommand.cpp */; }; 37D928550F21331F001D4494 /* ace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927B80F21331F001D4494 /* ace.cpp */; }; 37D928560F21331F001D4494 /* averagelinkage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37D927BA0F21331F001D4494 /* averagelinkage.cpp */; }; @@ -104,6 +106,10 @@ 372E12EC0F264D320095CF7E /* commandfactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = commandfactory.cpp; sourceTree = ""; }; 37AD4CE20F28AEA300AA2D49 /* sharedlistvector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedlistvector.h; sourceTree = ""; }; 37AD4CE30F28AEA300AA2D49 /* sharedlistvector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedlistvector.cpp; sourceTree = ""; }; + 37AD4DB90F28E2FE00AA2D49 /* tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tree.h; sourceTree = ""; }; + 37AD4DBA0F28E2FE00AA2D49 /* tree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tree.cpp; sourceTree = ""; }; + 37AD4DC80F28F3DD00AA2D49 /* readtree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readtree.h; sourceTree = ""; }; + 37AD4DC90F28F3DD00AA2D49 /* readtree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readtree.cpp; sourceTree = ""; }; 37B28F660F27590100808A62 /* deconvolutecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = deconvolutecommand.h; sourceTree = ""; }; 37B28F670F27590100808A62 /* deconvolutecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = deconvolutecommand.cpp; sourceTree = ""; }; 37D927B80F21331F001D4494 /* ace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ace.cpp; sourceTree = ""; }; @@ -322,6 +328,8 @@ 37D928090F21331F001D4494 /* rarefactioncurvedata.h */, 37D928130F21331F001D4494 /* readmatrix.hpp */, 37D928120F21331F001D4494 /* readmatrix.cpp */, + 37AD4DC80F28F3DD00AA2D49 /* readtree.h */, + 37AD4DC90F28F3DD00AA2D49 /* readtree.cpp */, 37D9281D0F21331F001D4494 /* sequence.hpp */, 37D9281C0F21331F001D4494 /* sequence.cpp */, 37D928210F21331F001D4494 /* shared.h */, @@ -456,6 +464,8 @@ 37D928300F21331F001D4494 /* sharedrabundvector.cpp */, 37D928330F21331F001D4494 /* sharedsabundvector.h */, 37D928320F21331F001D4494 /* sharedsabundvector.cpp */, + 37AD4DB90F28E2FE00AA2D49 /* tree.h */, + 37AD4DBA0F28E2FE00AA2D49 /* tree.cpp */, ); name = containers; sourceTree = ""; @@ -599,6 +609,8 @@ 372E12ED0F264D320095CF7E /* commandfactory.cpp in Sources */, 37B28F680F27590100808A62 /* deconvolutecommand.cpp in Sources */, 37AD4CE40F28AEA300AA2D49 /* sharedlistvector.cpp in Sources */, + 37AD4DBB0F28E2FE00AA2D49 /* tree.cpp in Sources */, + 37AD4DCA0F28F3DD00AA2D49 /* readtree.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/collectsharedcommand.cpp b/collectsharedcommand.cpp index 76f7abb..434d4a4 100644 --- a/collectsharedcommand.cpp +++ b/collectsharedcommand.cpp @@ -41,7 +41,7 @@ CollectSharedCommand::CollectSharedCommand(){ }else if (globaldata->sharedEstimators[i] == "sharedJabund") { cDisplays.push_back(new CollectDisplay(new SharedJAbund(), new SharedOneColumnFile(fileNameRoot+"shared.jabund", groupmap->namesOfGroups))); }else if (globaldata->sharedEstimators[i] == "sharedSorensonAbund") { - cDisplays.push_back(new CollectDisplay(new SharedSorAbund(), new SharedOneColumnFile(fileNameRoot+"shared.sorensonabund", groupmap->namesOfGroups))); + cDisplays.push_back(new CollectDisplay(new SharedSorAbund(), new SharedOneColumnFile(fileNameRoot+"shared.sorabund", groupmap->namesOfGroups))); }else if (globaldata->sharedEstimators[i] == "sharedJclass") { cDisplays.push_back(new CollectDisplay(new SharedJclass(), new SharedOneColumnFile(fileNameRoot+"shared.jclass", groupmap->namesOfGroups))); }else if (globaldata->sharedEstimators[i] == "sharedSorClass") { diff --git a/parselistcommand.cpp b/parselistcommand.cpp index 451a375..5379052 100644 --- a/parselistcommand.cpp +++ b/parselistcommand.cpp @@ -91,8 +91,7 @@ int ParseListCommand::execute(){ read = new ReadPhilFile(globaldata->inputFileName); read->read(&*globaldata); input = globaldata->ginput; - //list = input->getListVector(); - list = globaldata->glist; + list = globaldata->gSharedList; //read in group map info. groupMap = new GroupMap(globaldata->getGroupFile()); @@ -102,7 +101,7 @@ int ParseListCommand::execute(){ int i; //create new list vectors to fill with parsed data for (i=0; igetNumGroups(); i++) { - groupOfLists[groupMap->namesOfGroups[i]] = new ListVector(); + groupOfLists[groupMap->namesOfGroups[i]] = new SharedListVector(); } //parses and sets each groups listvector @@ -123,7 +122,7 @@ int ParseListCommand::execute(){ groupOfLists[groupMap->namesOfGroups[i]]->print(*(filehandles[groupMap->namesOfGroups[i]])); groupOfLists[groupMap->namesOfGroups[i]]->clear(); } - list = input->getListVector(); + list = input->getSharedListVector(); } //set groupmap for .shared commands diff --git a/parselistcommand.h b/parselistcommand.h index c986e4f..73c1070 100644 --- a/parselistcommand.h +++ b/parselistcommand.h @@ -15,7 +15,7 @@ #include #include "command.hpp" #include "rabundvector.hpp" -#include "listvector.hpp" +#include "sharedlistvector.h" #include "inputdata.h" #include "groupmap.h" #include "readmatrix.hpp" @@ -43,11 +43,11 @@ private: InputData* input; ReadMatrix* read; map filehandles; - map groupOfLists; - ListVector* list; + map groupOfLists; + SharedListVector* list; map listGroups; //maps group name to sequences from that group in a specific OTU map::iterator it; - map::iterator it2; + map::iterator it2; map::iterator it3; void parse(int); string fileroot; diff --git a/readtree.cpp b/readtree.cpp new file mode 100644 index 0000000..3a9aa51 --- /dev/null +++ b/readtree.cpp @@ -0,0 +1,11 @@ +/* + * readtree.cpp + * Mothur + * + * Created by Sarah Westcott on 1/22/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + +#include "readtree.h" + diff --git a/readtree.h b/readtree.h new file mode 100644 index 0000000..41d0305 --- /dev/null +++ b/readtree.h @@ -0,0 +1,30 @@ +#ifndef READTREE_H +#define READTREE_H +/* + * readtree.h + * Mothur + * + * Created by Sarah Westcott on 1/22/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + +using namespace std; + +#include +#include + + +class ReadTree { + public: + ReadTree(); + ~ReadTree(); + + + private: + + +}; + + +#endif \ No newline at end of file diff --git a/shared.cpp b/shared.cpp index 3208156..c8a1d5e 100644 --- a/shared.cpp +++ b/shared.cpp @@ -16,7 +16,7 @@ Shared::Shared(){ } /**************************************************************************************************/ -void Shared::getSharedVectors(int index, ListVector* list) { +void Shared::getSharedVectors(int index, SharedListVector* list) { string label, group; int i,j; label = list->getLabel(); @@ -45,7 +45,7 @@ void Shared::getSharedVectors(int index, ListVector* list) { /***********************************************************************/ -void Shared::parse(int index, ListVector* list) { +void Shared::parse(int index, SharedListVector* list) { string prefix, suffix, groupsName; suffix = list->get(index); diff --git a/shared.h b/shared.h index d4086a5..0607c13 100644 --- a/shared.h +++ b/shared.h @@ -21,19 +21,19 @@ using namespace std; #include #include #include "sharedrabundvector.h" -#include "listvector.hpp" +#include "sharedlistvector.h" #include "globaldata.hpp" class Shared { public: Shared(); ~Shared(); - void getSharedVectors(int, ListVector*); + void getSharedVectors(int, SharedListVector*); map sharedGroups; //string is groupname, SharedVector* is out info for that group private: GlobalData* globaldata; - void parse(int, ListVector*); + void parse(int, SharedListVector*); vector< map > sharedRAbund; //contains all the info needed to create the .shared file not sure if we will need }; diff --git a/sharedcommand.cpp b/sharedcommand.cpp index 6c4c8ac..0cc1e22 100644 --- a/sharedcommand.cpp +++ b/sharedcommand.cpp @@ -41,13 +41,13 @@ int SharedCommand::execute(){ read = new ReadPhilFile(globaldata->inputFileName); read->read(&*globaldata); input = globaldata->ginput; - list = globaldata->glist; + SharedList = globaldata->gSharedList; shared = new Shared(); int i = 0; - while(list != NULL){ - shared->getSharedVectors(i, list); //fills sharedGroups with new info and updates sharedVector - list = input->getListVector(); //get new list vector to process + while(SharedList != NULL){ + shared->getSharedVectors(i, SharedList); //fills sharedGroups with new info and updates sharedVector + SharedList = input->getSharedListVector(); //get new list vector to process printSharedData(); //prints info to the .shared file i++; } diff --git a/sharedcommand.h b/sharedcommand.h index 1b1df17..318fe98 100644 --- a/sharedcommand.h +++ b/sharedcommand.h @@ -14,7 +14,7 @@ #include #include #include "command.hpp" -#include "listvector.hpp" +#include "sharedlistvector.h" #include "inputdata.h" #include "shared.h" #include "readmatrix.hpp" @@ -39,7 +39,7 @@ private: void printSharedData(); GlobalData* globaldata; ReadMatrix* read; - ListVector* list; + SharedListVector* SharedList; InputData* input; Shared* shared; map::iterator it; diff --git a/sharedlistvector.cpp b/sharedlistvector.cpp index 2bceace..62e3788 100644 --- a/sharedlistvector.cpp +++ b/sharedlistvector.cpp @@ -20,6 +20,9 @@ using namespace std; #include "sharedlistvector.h" #include "sharedordervector.h" +/***********************************************************************/ + +SharedListVector::SharedListVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0){}; /***********************************************************************/ diff --git a/sharedlistvector.h b/sharedlistvector.h index 228ccf1..492997e 100644 --- a/sharedlistvector.h +++ b/sharedlistvector.h @@ -33,6 +33,7 @@ class SharedListVector : public DataVector { public: + SharedListVector(); SharedListVector(int); SharedListVector(ifstream&); SharedListVector(const SharedListVector& lv) : DataVector(lv.label), data(lv.data), maxRank(lv.maxRank), numBins(lv.numBins), numSeqs(lv.numSeqs){}; diff --git a/tree.cpp b/tree.cpp new file mode 100644 index 0000000..1aba4ed --- /dev/null +++ b/tree.cpp @@ -0,0 +1,11 @@ +/* + * tree.cpp + * Mothur + * + * Created by Sarah Westcott on 1/22/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + +#include "tree.h" + diff --git a/tree.h b/tree.h new file mode 100644 index 0000000..9dee24d --- /dev/null +++ b/tree.h @@ -0,0 +1,54 @@ +#ifndef TREE_H +#define TREE_H + +/* + * tree.h + * Mothur + * + * Created by Sarah Westcott on 1/22/09. + * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved. + * + */ + +using namespace std; + +#include +#include +#include + +struct Node { + string name; + string group; + float branchLength; + Node* parent; + Node* lchild; + Node* rchild; +}; + + + +class Tree { + public: + Tree(); + ~Tree(); + + Node* getParent(Node); + Node* getLChild(Node); + Node* getRChild(Node); + + void setParent(Node); + void setLChild(Node); + void setRChild(Node); + + + Tree generateRandomTree(); + + vector leaves; //gives you easy access to the leaves of the tree to generate the parsimony score + + private: +}; + + + + +#endif \ No newline at end of file