]> git.donarmstrong.com Git - mothur.git/blob - decalc.h
sffinfo bug with flow grams right index when clipQualRight=0
[mothur.git] / decalc.h
1 #ifndef DECALC_H
2 #define DECALC_H
3 /*
4  *  decalc.h
5  *  Mothur
6  *
7  *  Created by Sarah Westcott on 7/22/09.
8  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
9  *
10  */
11
12 #include "mothur.h"
13 #include "sequence.hpp"
14
15 /***********************************************************************/
16
17 //This class was created using the algorythms described in the 
18 // "At Least 1 in 20 16S rRNA Sequence Records Currently Held in the Public Repositories is Estimated To Contain Substantial Anomalies" paper 
19 //by Kevin E. Ashelford 1, Nadia A. Chuzhanova 3, John C. Fry 1, Antonia J. Jones 2 and Andrew J. Weightman 1.
20
21 /***********************************************************************/
22
23 //this structure is necessary to determine the sequence that contributed to the outliers when we remove them
24 //this way we can remove all scores that are contributed by outlier sequences.
25 struct quanMember {
26         float score;
27         int member1;
28         int member2;
29         quanMember (float s, int m, int n) : score(s), member1(m),  member2(n) {}
30         quanMember() {}
31         
32 };
33                 
34 //********************************************************************************************************************
35 class DeCalculator {
36
37         public:
38                 
39                 DeCalculator() { m = MothurOut::getInstance(); }
40                 ~DeCalculator() {};
41                 
42                 vector<Sequence> findClosest(Sequence, vector<Sequence*>&, vector<Sequence*>&, int, int);  //takes querySeq, a reference db, filteredRefDB, numWanted, minSim 
43                 Sequence* findClosest(Sequence*, vector<Sequence*>);
44                 set<int> getPos() {  return h;  }
45                 void setMask(string); 
46                 void setAlignmentLength(int l) {  alignLength = l;  }
47                 void runMask(Sequence*);
48                 void trimSeqs(Sequence*, Sequence*, map<int, int>&);
49                 map<int, int> trimSeqs(Sequence&, vector<Sequence>&);
50                 void removeObviousOutliers(vector< vector<float> >&, int);
51                 vector<float> calcFreq(vector<Sequence*>, string);
52                 vector<int> findWindows(Sequence*, int, int, int&, int);
53                 vector<float> calcObserved(Sequence*, Sequence*, vector<int>, int);
54                 vector<float>  calcExpected(vector<float>, float);
55                 vector<float>  findQav(vector<int>, int, vector<float>);  
56                 float calcDE(vector<float>, vector<float>);
57                 float calcDist(Sequence*, Sequence*, int, int);
58                 float getCoef(vector<float>, vector<float>);
59                 vector< vector<float> > getQuantiles(vector<Sequence*>, vector<int>, int, vector<float>, int, int, int);
60                 
61                 vector<int> returnObviousOutliers(vector< vector<quanMember> >, int);
62                 
63                 map<int, int> getMaskMap() { return maskMap; }
64                 
65         private:
66                 //vector<quanMember> sortContrib(map<quanMember*, float>);  //used by mallard
67                 float findAverage(vector<float>);
68                 //int findLargestContrib(vector<int>);
69                 //void removeContrib(int, vector<quanMember>&);
70                 string seqMask;
71                 set<int> h;
72                 int alignLength;
73                 map<int, int> maskMap;
74                 MothurOut* m;
75
76 };
77
78 /***********************************************************************/
79
80 #endif