Debian Codegraph @

easel/esl_hmm.h

raw symbols SCIP
1 /* General hidden Markov models (discrete; of alphabetic strings)
2 *
3 * SRE, Fri Jul 18 08:54:41 2008 [Janelia]
4 */
5 #ifndef eslHMM_INCLUDED
6 #define eslHMM_INCLUDED
7 #include <esl_config.h>
8
9 #include "esl_alphabet.h"
10 #include "esl_random.h"
11
12
13 typedef struct {
14 int M; /* number of states in the model */
15 int K; /* size of alphabet (redundant w/ abc->K) */
16 float *pi; /* initial (begin) distribution (0..M) */
17 float **t; /* Mx(M+1) state transition probabilities */
18 float **e; /* MxK emission probabilities */
19
20 float **eo; /* K'xM emission odds ratios */
21 const ESL_ALPHABET *abc; /* ptr to alphabet */
22 } ESL_HMM;
23
24 typedef struct {
25 float **dp; /* [0..L][0..M-1] DP matrix */
26 float *sc; /* [0..L+1] scale factors (log probs) */
27 int M; /* actual model dimension (0..M-1) */
28 int L; /* actual sequence dimension (1..L) */
29
30 float *dp_mem; /* memory allocated for the resizable DP matrix */
31 int allocR; /* current allocated # of rows: L+1 <= validR <= allocR */
32 int validR; /* # of dp rows actually pointing at DP memory */
33 int allocM; /* current set row width; M <= allocM */
34 uint64_t ncells; /* total allocation of dp_mem; ncells >= (validR)(allocM)*/
35 } ESL_HMX;
36
37
38
39 extern ESL_HMM *esl_hmm_Create(const ESL_ALPHABET *abc, int M);
40 extern ESL_HMM *esl_hmm_Clone(const ESL_HMM *hmm);
41 extern int esl_hmm_Configure(ESL_HMM *hmm, float *fq);
42 extern int esl_hmm_SetDegeneracies(ESL_HMM *hmm);
43 extern void esl_hmm_Destroy(ESL_HMM *hmm);
44
45 extern ESL_HMX *esl_hmx_Create(int allocL, int allocM);
46 extern int esl_hmx_GrowTo (ESL_HMX *mx, int L, int M);
47 extern void esl_hmx_Destroy(ESL_HMX *mx);
48
49 extern int esl_hmm_Emit(ESL_RANDOMNESS *r, const ESL_HMM *hmm, ESL_DSQ **opt_dsq, int **opt_path, int *opt_L);
50 extern int esl_hmm_Forward(const ESL_DSQ *dsq, int L, const ESL_HMM *hmm, ESL_HMX *fwd, float *opt_sc);
51 extern int esl_hmm_Backward(const ESL_DSQ *dsq, int L, const ESL_HMM *hmm, ESL_HMX *bck, float *opt_sc);
52
53
54 #endif /*eslHMM_INCLUDED*/