]> git.donarmstrong.com Git - mothur.git/blob - chimera.h
fixes while testing 1.12.0
[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                 string leftParent; //keep the name of closest left 
21                 string rightParent; //keep the name of closest 
22                 float score;  //preference score
23                 float closestLeft;  //keep the closest left 
24                 float closestRight; //keep the closest right 
25                 int midpoint;
26                 Preference() { name = ""; leftParent = ""; rightParent = ""; score = 0.0; closestLeft = 10000.0; closestRight = 10000.0; midpoint = 0;  }
27                 ~Preference() {}
28 };
29 /***********************************************************************/
30 struct score_struct {
31         int prev;
32         int score;
33         int row;
34         int col;
35 };
36 /***********************************************************************/
37 struct trace_struct {
38         int col;
39         int oldCol;
40         int row;
41 };
42 /***********************************************************************/
43 struct results {
44         int regionStart;
45         int regionEnd;
46         int nastRegionStart;
47         int nastRegionEnd;
48         string parent;
49         string parentAligned;
50         float queryToParent;
51         float queryToParentLocal;
52         float divR;
53 };
54 /***********************************************************************/
55 struct SeqDist {
56         Sequence* seq;
57         float dist;
58         int index;
59 };
60 //********************************************************************************************************************
61 //sorts lowest to highest
62 inline bool compareRegionStart(results left, results right){
63         return (left.nastRegionStart < right.nastRegionStart);  
64
65 //********************************************************************************************************************
66 //sorts lowest to highest
67 inline bool compareSeqDist(SeqDist left, SeqDist right){
68         return (left.dist < right.dist);        
69
70 //********************************************************************************************************************
71
72 struct sim {
73                 string leftParent;
74                 string rightParent; 
75                 float score;  
76                 int midpoint;
77 };
78
79 struct linePair {
80                         unsigned long int start;
81                         unsigned long int end;
82                         linePair(unsigned long int i, unsigned long int j) : start(i), end(j) {}
83                         linePair(){}
84 };
85
86 /***********************************************************************/
87
88 class Chimera {
89
90         public:
91         
92                 Chimera(){ m = MothurOut::getInstance(); length = 0; unaligned = false; }
93                 virtual ~Chimera(){     for (int i = 0; i < templateSeqs.size(); i++) { delete templateSeqs[i];  } };
94                 virtual bool getUnaligned()                             {       return unaligned;                       }
95                 virtual int getLength()                                 {   return length;      }
96                 virtual vector<Sequence*> readSeqs(string);
97                 virtual void setMask(string);
98                 virtual map<int, int> runFilter(Sequence*);
99                 virtual string createFilter(vector<Sequence*>, float);
100                 virtual void printHeader(ostream&){};
101                 virtual int getChimeras(Sequence*){ return 0; }
102                 virtual int getChimeras(){ return 0; }
103                 virtual int print(ostream&, ostream&){  return 0; }
104                 
105                 #ifdef USE_MPI
106                 virtual int print(MPI_File&, MPI_File&){  return 0; }
107                 #endif
108                 
109                 
110         protected:
111                 
112                 vector<Sequence*> templateSeqs;
113                 bool filter, unaligned; 
114                 int length; 
115                 string seqMask, filterString, outputDir, templateFileName; 
116                 Sequence* getSequence(string);  //find sequence from name       
117                 MothurOut* m;
118 };
119
120 /***********************************************************************/
121
122 #endif
123