]> git.donarmstrong.com Git - mothur.git/commitdiff
fixed bug in sharedcommand and parselistcommand and changed file extension of sorenso...
authorwestcott <westcott>
Fri, 23 Jan 2009 13:06:57 +0000 (13:06 +0000)
committerwestcott <westcott>
Fri, 23 Jan 2009 13:06:57 +0000 (13:06 +0000)
14 files changed:
Mothur.xcodeproj/project.pbxproj
collectsharedcommand.cpp
parselistcommand.cpp
parselistcommand.h
readtree.cpp [new file with mode: 0644]
readtree.h [new file with mode: 0644]
shared.cpp
shared.h
sharedcommand.cpp
sharedcommand.h
sharedlistvector.cpp
sharedlistvector.h
tree.cpp [new file with mode: 0644]
tree.h [new file with mode: 0644]

index a3ed9b84ea9c8a47b5640a9eaa09d4bf44bb0773..e8d32aa4a491d48e11ae83d223138908708d34ab 100644 (file)
@@ -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 */; };
                372E12EC0F264D320095CF7E /* commandfactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = commandfactory.cpp; sourceTree = "<group>"; };
                37AD4CE20F28AEA300AA2D49 /* sharedlistvector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sharedlistvector.h; sourceTree = "<group>"; };
                37AD4CE30F28AEA300AA2D49 /* sharedlistvector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sharedlistvector.cpp; sourceTree = "<group>"; };
+               37AD4DB90F28E2FE00AA2D49 /* tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tree.h; sourceTree = "<group>"; };
+               37AD4DBA0F28E2FE00AA2D49 /* tree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tree.cpp; sourceTree = "<group>"; };
+               37AD4DC80F28F3DD00AA2D49 /* readtree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = readtree.h; sourceTree = "<group>"; };
+               37AD4DC90F28F3DD00AA2D49 /* readtree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = readtree.cpp; sourceTree = "<group>"; };
                37B28F660F27590100808A62 /* deconvolutecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = deconvolutecommand.h; sourceTree = "<group>"; };
                37B28F670F27590100808A62 /* deconvolutecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = deconvolutecommand.cpp; sourceTree = "<group>"; };
                37D927B80F21331F001D4494 /* ace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ace.cpp; sourceTree = "<group>"; };
                                37D928090F21331F001D4494 /* rarefactioncurvedata.h */,
                                37D928130F21331F001D4494 /* readmatrix.hpp */,
                                37D928120F21331F001D4494 /* readmatrix.cpp */,
+                               37AD4DC80F28F3DD00AA2D49 /* readtree.h */,
+                               37AD4DC90F28F3DD00AA2D49 /* readtree.cpp */,
                                37D9281D0F21331F001D4494 /* sequence.hpp */,
                                37D9281C0F21331F001D4494 /* sequence.cpp */,
                                37D928210F21331F001D4494 /* shared.h */,
                                37D928300F21331F001D4494 /* sharedrabundvector.cpp */,
                                37D928330F21331F001D4494 /* sharedsabundvector.h */,
                                37D928320F21331F001D4494 /* sharedsabundvector.cpp */,
+                               37AD4DB90F28E2FE00AA2D49 /* tree.h */,
+                               37AD4DBA0F28E2FE00AA2D49 /* tree.cpp */,
                        );
                        name = containers;
                        sourceTree = "<group>";
                                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;
                };
index 76f7abb5682661620f958b66c84637f0add5c54d..434d4a44311f57300c42623c0b052cff012d9e10 100644 (file)
@@ -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") { 
index 451a375d4d705d2831f790fc259a28882e52c393..5379052d6dd4f1bbfe51b3b346874def78a7b841 100644 (file)
@@ -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; i<groupMap->getNumGroups(); 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
index c986e4f812d4b97882c47bd772813cfd0bc4a4cb..73c1070a7ca371cbbea5aa7495814c49146b5d82 100644 (file)
@@ -15,7 +15,7 @@
 #include <map>
 #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<string, ofstream*> filehandles;
-       map<string, ListVector*> groupOfLists;
-       ListVector* list;
+       map<string, SharedListVector*> groupOfLists;
+       SharedListVector* list;
        map<string, string> listGroups; //maps group name to sequences from that group in a specific OTU
        map<string, string>::iterator it;
-       map<string, ListVector*>::iterator it2;
+       map<string, SharedListVector*>::iterator it2;
        map<string, ofstream*>::iterator it3;
        void parse(int);
        string fileroot;
diff --git a/readtree.cpp b/readtree.cpp
new file mode 100644 (file)
index 0000000..3a9aa51
--- /dev/null
@@ -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 (file)
index 0000000..41d0305
--- /dev/null
@@ -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 <string>
+#include <iostream>
+
+
+class ReadTree {
+       public:
+               ReadTree();
+               ~ReadTree();
+               
+       
+       private:
+       
+
+};
+
+
+#endif
\ No newline at end of file
index 3208156547aa4fcc83d6c5e6d293fb34f378b3e0..c8a1d5e8e6a061edf8cdf00a6f2025b6b8a8c53c 100644 (file)
@@ -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);
index d4086a562ca7047c8142c0c7783a0641c874a4d0..0607c13974f4a089505f1bca7221413305e504f6 100644 (file)
--- a/shared.h
+++ b/shared.h
@@ -21,19 +21,19 @@ using namespace std;
 #include <sstream>
 #include <map>
 #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<string, SharedRAbundVector*> sharedGroups; //string is groupname, SharedVector* is out info for that group
                
        private:
                GlobalData* globaldata;
-               void parse(int, ListVector*);
+               void parse(int, SharedListVector*);
                vector< map<string, SharedRAbundVector*> > sharedRAbund;  //contains all the info needed to create the .shared file not sure if we will need 
 };
 
index 6c4c8ac9afbda821c545ab3a48d60a993e290620..0cc1e22f2d9067fb7fcad21b6cff5c456f5e7049 100644 (file)
@@ -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++;
                }
index 1b1df17e65a5f34acd1a0cc6c912fc6c92dd84bb..318fe9820e0444c444cd0bcb73f1e1559e763a37 100644 (file)
@@ -14,7 +14,7 @@
 #include <fstream>
 #include <map>
 #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<string, SharedRAbundVector*>::iterator it;
index 2bceace2565f404a08b85e5af59cf18e295bd41a..62e37885d165c0abcd800f189c656664acb3f63b 100644 (file)
@@ -20,6 +20,9 @@ using namespace std;
 #include "sharedlistvector.h"
 #include "sharedordervector.h"
 
+/***********************************************************************/
+
+SharedListVector::SharedListVector() : DataVector(), maxRank(0), numBins(0), numSeqs(0){};
 
 /***********************************************************************/
 
index 228ccf1865888664396aa08bf94bc9fc2dd2eddd..492997eee0ea238a1909c44baf262950442d0d95 100644 (file)
@@ -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 (file)
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 (file)
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 <string>
+#include <iostream>
+#include <vector>
+
+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<Node> leaves;            //gives you easy access to the leaves of the tree to generate the parsimony score
+               
+       private:
+};
+
+
+
+
+#endif
\ No newline at end of file