source: branches/profile/DIST/di_protdist.hxx

Last change on this file was 11005, checked in by westram, 10 years ago
  • fixed unused private members reported by clang
  • turned off 'unused private members'-warnings (2 of 3 were false positives)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1// =============================================================== //
2//                                                                 //
3//   File      : di_protdist.hxx                                   //
4//   Purpose   :                                                   //
5//                                                                 //
6//   Institute of Microbiology (Technical University Munich)       //
7//   http://www.arb-home.de/                                       //
8//                                                                 //
9// =============================================================== //
10
11#ifndef DI_PROTDIST_HXX
12#define DI_PROTDIST_HXX
13
14#ifndef AP_SEQ_SIMPLE_PRO_HXX
15#include <AP_seq_simple_pro.hxx>
16#endif
17
18const int DI_MAX_AA     = STOP; // must be 20
19const int DI_MAX_PAA    = UNK;  // includes virtual aa
20const int DI_RESOLUTION = 1000; // max res
21const int DI_MAX_DIST   = 10;   // max dist
22
23// stop is first non real AA == 20
24
25enum di_codetype { UNIVERSAL, CILIATE, MITO, VERTMITO, FLYMITO, YEASTMITO };
26enum di_cattype { NONE, SIMILARITY, KIMURA, PAM, CHEMICAL, HALL, GEORGE };
27
28typedef double di_aa_matrix[DI_MAX_AA][DI_MAX_AA];
29typedef double di_paa_matrix[DI_MAX_PAA][DI_MAX_PAA];
30typedef char   di_bool_matrix[DI_MAX_PAA][DI_MAX_PAA];
31
32class DI_ENTRY;
33class AP_smatrix;
34
35class di_protdist : virtual Noncopyable {
36    static double pameigs[20];
37    static double pamprobs[20][20];
38    di_codetype   whichcode;
39    di_cattype    whichcat;
40
41    long spp;                   // number of species
42    long chars;                 // number of characters
43
44    // spp = number of species chars = number of sites in actual sequences
45
46    double         freqa, freqc, freqg, freqt, ttratio, xi, xv, ease, fracchange;
47    DI_ENTRY      **entries;                                                        // link to entries
48    aas            trans[4][4][4];
49    double         pi[20];
50    long           cat[DI_MAX_AA];
51    double         eig[DI_MAX_AA];
52    double         exptteig[DI_MAX_AA];
53    di_aa_matrix   prob, eigvecs;
54
55    di_paa_matrix   *(slopes[DI_RESOLUTION*DI_MAX_DIST]);
56    // huge cash for many slopes
57    di_paa_matrix   *(curves[DI_RESOLUTION*DI_MAX_DIST]);
58    di_bool_matrix  *(infs[DI_RESOLUTION*DI_MAX_DIST]);
59
60    di_paa_matrix  *akt_slopes;
61    di_paa_matrix  *akt_curves;
62    di_bool_matrix *akt_infs;
63    AP_smatrix     *matrix;     // link to output matrix
64
65    // Local variables for makedists, propagated globally for c version:
66    double p, dp, d2p;
67
68
69    void cats(di_cattype wcat);
70    void maketrans();
71    void code();
72    void transition();
73    void givens(di_aa_matrix a, long i, long j, long n, double ctheta, double stheta, bool left);
74    void coeffs(double x, double y, double *c, double *s, double accuracy);
75    void tridiag(di_aa_matrix a, long n, double accuracy);
76    void shiftqr(di_aa_matrix a, long n, double accuracy);
77    void qreigen(di_aa_matrix prob, long n);
78    void pameigen();
79
80    void predict(double tt, long nb1, long  nb2);
81    int tt_2_pos(double tt);        // double to cash index
82    double pos_2_tt(int pos);       // cash index to pos
83    void build_exptteig(double tt);
84    void build_predikt_table(int pos);      // build akt_slopes akt_curves
85    void build_akt_predikt(double tt);      // build akt_slopes akt_curves
86
87    double predict_slope(int b1, int b2) { return akt_slopes[0][b1][b2]; }
88    double predict_curve(int b1, int b2) { return akt_curves[0][b1][b2]; }
89    char predict_infinity(int b1, int b2) { return akt_infs[0][b1][b2]; }
90
91    void clean_slopes();
92
93public:
94    di_protdist(di_codetype codei, di_cattype cati, long nentries, DI_ENTRY  **entries, long seq_len, AP_smatrix *matrixi);
95    ~di_protdist();
96
97    GB_ERROR makedists(bool *aborted_flag);    // calculate the distance matrix
98};
99
100#else
101#error di_protdist.hxx included twice
102#endif // DI_PROTDIST_HXX
Note: See TracBrowser for help on using the repository browser.