Change Eclipse configuration
[jabaws.git] / website / archive / binaries / mac / src / muscle / profile.h
1 #ifndef FastProf2_h\r
2 #define FastProf2_h\r
3 \r
4 #include "msa.h"\r
5 #include "pwpath.h"\r
6 #include <math.h>       // for log function\r
7 \r
8 class DiagList;\r
9 class WeightList;\r
10 \r
11 struct ProfPos\r
12         {\r
13         bool m_bAllGaps;\r
14         unsigned m_uSortOrder[21];\r
15         FCOUNT m_fcCounts[20];\r
16         FCOUNT m_LL;\r
17         FCOUNT m_LG;\r
18         FCOUNT m_GL;\r
19         FCOUNT m_GG;\r
20         SCORE m_AAScores[20];\r
21         unsigned m_uResidueGroup;\r
22         FCOUNT m_fOcc;\r
23         FCOUNT m_fcStartOcc;\r
24         FCOUNT m_fcEndOcc;\r
25         SCORE m_scoreGapOpen;\r
26         SCORE m_scoreGapClose;\r
27 #if     DOUBLE_AFFINE\r
28         SCORE m_scoreGapOpen2;\r
29         SCORE m_scoreGapClose2;\r
30 #endif\r
31 //      SCORE m_scoreGapExtend;\r
32         };\r
33 \r
34 struct ProgNode\r
35         {\r
36         ProgNode()\r
37                 {\r
38                 m_Prof = 0;\r
39                 m_EstringL = 0;\r
40                 m_EstringR = 0;\r
41                 }\r
42         MSA m_MSA;\r
43         ProfPos *m_Prof;\r
44         PWPath m_Path;\r
45         short *m_EstringL;\r
46         short *m_EstringR;\r
47         unsigned m_uLength;\r
48         WEIGHT m_Weight;\r
49         };\r
50 \r
51 extern unsigned ResidueGroup[];\r
52 const unsigned RESIDUE_GROUP_MULTIPLE = (unsigned) ~0;\r
53 \r
54 extern PTR_SCOREMATRIX g_ptrScoreMatrix;\r
55 \r
56 ProfPos *ProfileFromMSA(const MSA &a);\r
57 \r
58 SCORE TraceBack(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,\r
59   unsigned uLengthB, const SCORE *DPM_, const SCORE *DPD_, const SCORE *DPI_,\r
60   PWPath &Path);\r
61 SCORE GlobalAlign(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,\r
62   unsigned uLengthB, PWPath &Path);\r
63 void ProgressiveAlign(const SeqVect &v, const Tree &tree, MSA &a);\r
64 SCORE MSAPairSP(const MSA &msa1, const MSA &msa2);\r
65 \r
66 void AlignTwoMSAsGivenPath(const PWPath &Path, const MSA &msaA, const MSA &msaB,\r
67   MSA &msaCombined);\r
68 \r
69 void ListProfile(const ProfPos *Prof, unsigned uLength, const MSA *ptrMSA = 0);\r
70 SCORE ScoreProfPos2(const ProfPos &PPA, const ProfPos &PPB);\r
71 SCORE FastScorePath2(const ProfPos *PA, unsigned uLengthA,\r
72   const ProfPos *PB, unsigned uLengthB, const PWPath &Path);\r
73 bool IsHydrophilic(const FCOUNT fcCounts[]);\r
74 int PAM200_Letter(unsigned uLetter1, unsigned uLetter2);\r
75 SCORE AverageMatchScore(const PWPath &Path, unsigned uEdgeIndex,\r
76   unsigned uWindowLength);\r
77 void WindowSmooth(const SCORE Score[], unsigned uCount, unsigned uWindowLength,\r
78   SCORE SmoothScore[], double dCeil = 9e29);\r
79 SCORE FastScoreMSA_LA(const MSA &msa, SCORE MatchScore[] = 0);\r
80 SCORE FastScoreMSA_NS(const MSA &msa, SCORE MatchScore[] = 0);\r
81 SCORE FastScoreMSA_SP(const MSA &msa, SCORE MatchScore[] = 0);\r
82 bool RefineMSA(MSA &msa, const Tree &tree);\r
83 SCORE MSAQScore(const MSA &msa, SCORE MatchScore[] = 0);\r
84 bool RefineBiParts(MSA &msa, const Tree &tree, bool R);\r
85 void FindAnchorCols(const MSA &msa, unsigned AnchorCols[],\r
86   unsigned *ptruAnchorColCount);\r
87 double PctIdToHeight(double dPctId);\r
88 double PctIdToHeightKimura(double dPctId);\r
89 double PctIdToHeightMAFFT(double dPctId);\r
90 double PctIdToMAFFTDist(double dPctId);\r
91 bool RefineBlocks(MSA &msa, const Tree &tree);\r
92 bool RefineSubfams(MSA &msaIn, const Tree &tree, unsigned uIters);\r
93 void SetMuscleTree(const Tree &tree);\r
94 void CalcClustalWWeights(const Tree &tree, WEIGHT Weights[]);\r
95 void RealignDiffs(const MSA &msaIn, const Tree &Diffs,\r
96   const unsigned IdToDiffsTreeNodeIndex[], MSA &msaOut);\r
97 void RealignDiffsE(const MSA &msaIn, const SeqVect &v,\r
98   const Tree &NewTree, const Tree &OldTree,\r
99   const unsigned uNewNodeIndexToOldNodeIndex[],\r
100   MSA &msaOut, ProgNode *OldProgNodes);\r
101 void RefineTree(MSA &msa, Tree &tree);\r
102 void RefineTreeE(MSA &msa, const SeqVect &v, Tree &tree, ProgNode *ProgNodes);\r
103 bool IsHydrophobic(const FCOUNT fcCounts[]);\r
104 void Hydro(ProfPos *Prof, unsigned uLength);\r
105 void SetTermGaps(const ProfPos *Prof, unsigned uLength);\r
106 \r
107 // Macros to simulate 2D matrices\r
108 #define DPL(PLA, PLB)   DPL_[(PLB)*uPrefixCountA + (PLA)]\r
109 #define DPM(PLA, PLB)   DPM_[(PLB)*uPrefixCountA + (PLA)]\r
110 #define DPD(PLA, PLB)   DPD_[(PLB)*uPrefixCountA + (PLA)]\r
111 #define DPE(PLA, PLB)   DPE_[(PLB)*uPrefixCountA + (PLA)]\r
112 #define DPI(PLA, PLB)   DPI_[(PLB)*uPrefixCountA + (PLA)]\r
113 #define DPJ(PLA, PLB)   DPJ_[(PLB)*uPrefixCountA + (PLA)]\r
114 #define DPU(PLA, PLB)   DPU_[(PLB)*uPrefixCountA + (PLA)]\r
115 #define TBM(PLA, PLB)   TBM_[(PLB)*uPrefixCountA + (PLA)]\r
116 #define TBD(PLA, PLB)   TBD_[(PLB)*uPrefixCountA + (PLA)]\r
117 #define TBE(PLA, PLB)   TBE_[(PLB)*uPrefixCountA + (PLA)]\r
118 #define TBI(PLA, PLB)   TBI_[(PLB)*uPrefixCountA + (PLA)]\r
119 #define TBJ(PLA, PLB)   TBJ_[(PLB)*uPrefixCountA + (PLA)]\r
120 \r
121 SCORE ScoreProfPos2LA(const ProfPos &PPA, const ProfPos &PPB);\r
122 SCORE ScoreProfPos2NS(const ProfPos &PPA, const ProfPos &PPB);\r
123 SCORE ScoreProfPos2SP(const ProfPos &PPA, const ProfPos &PPB);\r
124 SCORE ScoreProfPos2SPN(const ProfPos &PPA, const ProfPos &PPB);\r
125 \r
126 #endif // FastProf_h\r