]> git.donarmstrong.com Git - mothur.git/blob - slayer.h
added checks for ^C to quit command instead of program
[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, int, int);
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, iters, percentSNPSample;
77                 float divRThreshold; 
78                 vector<data_struct>  outputResults;
79                 vector< map<int, int> > baseSpots;
80                 
81                 map<int, int> verticalFilter(vector<Sequence*>);
82                 float computePercentID(string, string, int, int);
83                 
84                 vector<data_struct> runBellerophon(Sequence*, Sequence*, Sequence*, map<int, int>&);
85                 vector<snps> getSNPS(string, string, string, int, int);
86                 int bootstrapSNPS(vector<snps>, vector<snps>, float&, float&);
87                 float snpQA(vector<snps>);
88                 float snpQB(vector<snps>);
89                 float snpAB(vector<snps>);
90                 MothurOut* m;
91                                 
92 };
93
94 /***********************************************************************/
95
96 #endif
97
98