]> git.donarmstrong.com Git - mothur.git/blob - pintail.h
fixed bugs in venn and aligner
[mothur.git] / pintail.h
1 #ifndef PINTAIL_H
2 #define PINTAIL_H
3
4 /*
5  *  pintail.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 #include "chimera.h"
14 #include "dist.h"
15
16 //This class was created using the algorythms described in the 
17 // "At Least 1 in 20 16S rRNA Sequence Records Currently Held in the Public Repositories is Estimated To Contain Substantial Anomalies" paper 
18 //by Kevin E. Ashelford 1, Nadia A. Chuzhanova 3, John C. Fry 1, Antonia J. Jones 2 and Andrew J. Weightman 1.
19
20 /***********************************************************/
21
22 class Pintail : public Chimera {
23         
24         public:
25                 Pintail(string, string);        
26                 ~Pintail();
27                 
28                 void getChimeras();
29                 void print(ostream&);
30                 
31                 void setCons(string c) { consfile = c;  }
32                 
33                 
34         private:
35         
36                 struct linePair {
37                         int start;
38                         int end;
39                         linePair(int i, int j) : start(i), end(j) {}
40                 };
41
42                 Dist* distcalculator;
43                 int iters;
44                 string fastafile, templateFile, consfile;
45                 vector<linePair*> lines;
46                 vector<Sequence*> querySeqs;
47                 vector<Sequence*> templateSeqs;
48                 
49                 vector<Sequence> bestfit;  //bestfit[0] matches queryseqs[0]...
50                 
51                 vector< vector<float> > obsDistance;  //obsDistance[0] is the vector of observed distances for queryseqs[0]... 
52                 vector< vector<float> > expectedDistance;  //expectedDistance[0] is the vector of expected distances for queryseqs[0]... 
53                 vector<float> deviation;  //deviation[0] is the percentage of mismatched pairs over the whole seq between querySeqs[0] and its best match.
54                 vector< vector<int> > windows;  // windows[0] is a vector containing the starting spot in queryseqs[0] aligned sequence for each window.
55                                                                                 //this is needed so you can move by bases and not just spots in the alignment
56                 vector< map<int, int> >  trim;  //trim[0] is the start and end position of trimmed querySeqs[0].  Used to find the variability over each sequence window.
57                                                                                 
58                 vector<int> windowSizes;    //windowSizes[0] = window size of querySeqs[0]
59                 
60                 vector< vector<float> > Qav;    //Qav[0] is the vector of average variablility for queryseqs[0]... 
61                 vector<float>  seqCoef;                         //seqCoef[0] is the coeff for queryseqs[0]...
62                 vector<float> DE;                                       //DE[0] is the deviaation for queryseqs[0]...
63                 vector<float> probabilityProfile;
64                 
65                 vector<Sequence*> readSeqs(string);
66                 void trimSeqs(Sequence*, Sequence&, int);
67                 vector<float> readFreq();
68                 vector< vector<float> > findQav(int, int);  
69                 vector<float> calcFreq(vector<Sequence*>);
70                 vector<float> getCoef(int, int);
71                 
72                 vector<Sequence> findPairs(int, int);
73                 vector< vector<int> > findWindows(int, int);
74                 vector< vector<float> > calcObserved(int, int);
75                 vector< vector<float> > calcExpected(int, int);
76                 vector<float> calcDE(int, int);
77                 vector<float> calcDist(int, int);
78         
79                 void createProcessesSpots();
80                 void createProcesses();
81                 
82                 
83                 
84 };
85
86 /***********************************************************/
87
88 #endif
89