]> git.donarmstrong.com Git - mothur.git/blob - chimera.h
working on chimeras
[mothur.git] / chimera.h
1 #ifndef CHIMERA_H
2 #define CHIMERA_H
3
4 /*
5  *  chimera.h
6  *  Mothur
7  *
8  *  Created by Sarah Westcott on 7/9/09.
9  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10  *
11  */
12
13
14 #include "mothur.h"
15 #include "sequence.hpp"
16
17 /***********************************************************************/
18 struct Preference {
19                 string name;
20                 vector<string> leftParent; //keep the name of closest left associated with the two scores
21                 vector<string> rightParent; //keep the name of closest right associated with the two scores
22                 vector<float> score;  //so you can keep last score and calc this score and keep whichever is bigger.
23                 vector<float> closestLeft;  //keep the closest left associated with the two scores
24                 vector<float> closestRight; //keep the closest right associated with the two scores
25                 int midpoint;
26
27 };
28 /***********************************************************************/
29 struct score_struct {
30         int prev;
31         int score;
32         int row;
33         int col;
34 };
35 /***********************************************************************/
36 struct trace_struct {
37         int col;
38         int oldCol;
39         int row;
40 };
41 /***********************************************************************/
42 struct results {
43         int regionStart;
44         int regionEnd;
45         int nastRegionStart;
46         int nastRegionEnd;
47         string parent;
48         float queryToParent;
49         float queryToParentLocal;
50         float divR;
51 };
52 /***********************************************************************/
53 struct rank {
54                 int num;
55                 float score;
56                 rank(int n, float s) : num(n), score(s) {}
57 };
58 /***********************************************************************/
59
60 struct SeqDist {
61         Sequence* seq;
62         float dist;
63 };
64 //********************************************************************************************************************
65 //sorts highest to lowest
66 inline bool compareMembers(rank left, rank right){
67         return (left.score > right.score);      
68
69 //********************************************************************************************************************
70 //sorts lowest to highest
71 inline bool compareRegionStart(results left, results right){
72         return (left.nastRegionStart < right.nastRegionStart);  
73
74 //********************************************************************************************************************
75 //sorts lowest to highest
76 inline bool compareSeqDist(SeqDist left, SeqDist right){
77         return (left.dist < right.dist);        
78
79 //********************************************************************************************************************
80
81 struct sim {
82                 string leftParent;
83                 string rightParent; 
84                 float score;  
85                 int midpoint;
86 };
87
88 struct linePair {
89                         int start;
90                         int end;
91                         linePair(int i, int j) : start(i), end(j) {}
92                         linePair(){}
93 };
94
95 /***********************************************************************/
96
97 class Chimera {
98
99         public:
100         
101                 Chimera(){};
102                 Chimera(string);
103                 Chimera(string, string);
104                 virtual ~Chimera(){};
105                 virtual void setFilter(bool f)                  {       filter = f;                     }
106                 virtual void setCorrection(bool c)              {       correction = c;         }
107                 virtual void setProcessors(int p)               {       processors = p;         }
108                 virtual void setWindow(int w)                   {       window = w;                     }
109                 virtual void setIncrement(int i)                {       increment = i;          }
110                 virtual void setNumWanted(int n)                {       numWanted = n;          }
111                 virtual void setKmerSize(int k)                 {       kmerSize = k;           }
112                 virtual void setSVG(int s)                              {       svg = s;                        }
113                 virtual void setName(string n)                  {       name = n;                       }
114                 virtual void setMatch(int m)                    {       match = m;                      }
115                 virtual void setMisMatch(int m)                 {       misMatch = m;           }
116                 virtual void setDivR(float d)                   {       divR = d;                       }
117                 virtual void setParents(int p)                  {       parents = p;            }
118                 virtual void setMinSim(int s)                   {       minSim = s;                     }
119                 virtual void setMinCoverage(int c)              {       minCov = c;                     }
120                 virtual void setMinBS(int b)                    {       minBS = b;                      }
121                 virtual void setMinSNP(int s)                   {       minSNP = s;                     }
122                 virtual void setIters(int i)                    {       iters = i;                      }
123                 virtual void setTemplateSeqs(vector<Sequence*> t)       {       templateSeqs = t;       }
124                 virtual bool getUnaligned()                             {       return unaligned;                       }
125                 virtual void setTemplateFile(string t)  {   templateFileName = t;       }
126                 
127                 virtual void setCons(string){};
128                 virtual void setQuantiles(string){};
129                 virtual void doPrep(){};
130                 virtual vector<Sequence*> readSeqs(string);
131                 virtual vector< vector<float> > readQuantiles();
132                 virtual void setMask(string);
133                 virtual void runFilter(Sequence*);
134                 virtual void createFilter(vector<Sequence*>);
135                 
136                 virtual void printHeader(ostream&){};
137                 virtual int getChimeras(Sequence*){ return 0; }
138                 virtual int getChimeras(){ return 0; }
139                 virtual void print(ostream&){}; 
140                 
141                 
142         protected:
143                 
144                 vector<Sequence*> templateSeqs;
145                 bool filter, correction, svg, unaligned;
146                 int processors, window, increment, numWanted, kmerSize, match, misMatch, minSim, minCov, minBS, minSNP, parents, iters;
147                 float divR;
148                 string seqMask, quanfile, filterString, name, outputDir, templateFileName;
149                 Sequence* getSequence(string);  //find sequence from name       
150 };
151
152 /***********************************************************************/
153
154 #endif
155