]> git.donarmstrong.com Git - mothur.git/blob - slayer.h
working on chimeraslayer and found bug in shared command.
[mothur.git] / slayer.h
1 #ifndef SLAYER_H
2 #define SLAYER_H
3 /*
4  *  slayer.h
5  *  Mothur
6  *
7  *  Created by westcott on 9/25/09.
8  *  Copyright 2009 Schloss Lab. All rights reserved.
9  *
10  */
11
12  
13 #include "sequence.hpp"
14
15 /***********************************************************************/
16 //This class was modeled after the chimeraSlayer written by the Broad Institute
17 /***********************************************************************/
18 struct data_struct { //this is crazy big...but follow original.
19         float divr_qla_qrb;
20         float divr_qlb_qra;
21         float qla_qrb;
22         float qlb_qra;
23         float qla;
24         float qrb;
25         float ab; 
26         float qa;
27         float qb; 
28         float lab; 
29         float rab; 
30         float qra; 
31         float qlb; 
32         int winLStart;
33         int winLEnd; 
34         int winRStart; 
35         int winREnd; 
36         Sequence querySeq; 
37         Sequence parentA;
38         Sequence parentB;
39         float bsa;
40         float bsb;
41         float bsMax;
42         float chimeraMax;
43         
44 };
45 /***********************************************************************/
46 //sorts lowest to highest first by bsMax, then if tie by chimeraMax
47 inline bool compareDataStruct(data_struct left, data_struct right){
48         if (left.bsMax < right.bsMax) { return true; }
49         else if (left.bsMax == right.bsMax) {
50                 return (left.chimeraMax < right.chimeraMax);
51         }else { return false;   }
52
53 /***********************************************************************/
54 struct snps { 
55         char queryChar;
56         char parentAChar;
57         char parentBChar;
58 };
59
60 /***********************************************************************/
61
62
63 class Slayer {
64
65         public:
66                 
67                 Slayer(int, int, int, float);
68                 ~Slayer() {};
69                 
70                 string getResults(Sequence*, vector<Sequence*>);
71                 vector<data_struct> getOutput()  {      return outputResults;                   }
72                 
73                                 
74         private:
75                 
76                 int windowSize, windowStep, parentFragmentThreshold;
77                 float divRThreshold; 
78                 vector<data_struct>  outputResults;
79                 
80                 void verticalFilter(vector<Sequence*>);
81                 float computePercentID(string, string, int, int);
82                 
83                 vector<data_struct> runBellerophon(Sequence*, Sequence*, Sequence*);
84                 vector<snps> getSNPS(string, string, string, int, int);
85                 void bootstrapSNPS(vector<snps>, vector<snps>, float&, float&);
86                 float snpQA(vector<snps>);
87                 float snpQB(vector<snps>);
88                 float snpAB(vector<snps>);
89                                 
90 };
91
92 /***********************************************************************/
93
94 #endif
95
96