]> git.donarmstrong.com Git - mothur.git/blob - maligner.h
started adding chimeraslayer method and fixed minor bug in treegroupscommand deconstr...
[mothur.git] / maligner.h
1 #ifndef MALIGNER_H
2 #define MALIGNER_H
3 /*
4  *  maligner.h
5  *  Mothur
6  *
7  *  Created by westcott on 9/23/09.
8  *  Copyright 2009 Schloss Lab. All rights reserved.
9  *
10  */
11  
12 #include "decalc.h"
13
14 /***********************************************************************/
15 //This class was modeled after the chimeraMaligner written by the Broad Institute
16 /***********************************************************************/
17 struct score_struct {
18         int prev;
19         int score;
20         int row;
21         int col;
22 };
23 /***********************************************************************/
24 struct trace_struct {
25         int col;
26         int oldCol;
27         int row;
28 };
29 /***********************************************************************/
30 struct results {
31         int regionStart;
32         int regionEnd;
33         string parent;
34         float queryToParent;
35         float queryToParentLocal;
36         float divR;
37 };
38
39 /**********************************************************************/
40 class Maligner {
41
42         public:
43                 
44                 Maligner(vector<Sequence*>, int, int, int, float, int);
45                 ~Maligner() {};
46                 
47                 string getResults(Sequence*);
48                 float getPercentID() {  return percentIdenticalQueryChimera;    }
49                 vector<results> getOutput()  {  return outputResults;                   }
50                 
51                                 
52         private:
53                 DeCalculator* decalc;
54                 Sequence* query;
55                 vector<Sequence*> refSeqs;
56                 vector<Sequence*> db;
57                 int numWanted, matchScore, misMatchPenalty, minCoverage;
58                 float minDivR, percentIdenticalQueryChimera;
59                 vector<results> outputResults;
60                 
61                 vector<Sequence*> minCoverageFilter(vector<Sequence*>);  //removes top matches that do not have minimum coverage with query.
62                 int computeChimeraPenalty();
63                 void verticalFilter(vector<Sequence*>);
64                 
65                 vector< vector<score_struct> > buildScoreMatrix(int, int);
66                 void fillScoreMatrix(vector<vector<score_struct> >&, vector<Sequence*>, int);
67                 vector<score_struct> extractHighestPath(vector<vector<score_struct> >);
68                 vector<trace_struct> mapTraceRegionsToAlignment(vector<score_struct>, vector<Sequence*>);
69                 string constructChimericSeq(vector<trace_struct>, vector<Sequence*>);
70                 float computePercentID(string, string);
71                 
72 };
73
74 /***********************************************************************/
75
76 #endif
77