File: contentmodel.hh

package info (click to toggle)
augustus 3.2.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 289,676 kB
  • sloc: cpp: 48,711; perl: 13,339; ansic: 1,251; makefile: 859; sh: 58
file content (73 lines) | stat: -rw-r--r-- 2,026 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*****************************************************************************\
 * Filename : ContentModel.hh
 * Author   : Mario Stanke
 * Project  : HMM
 * Version  : 0.2
 *
 *
 * Description: Model typical sequences by pattern frequencies
 *
 *
 * Date                |   Author              |  Changes
 *---------------------|-----------------------|---------------------------------
 * Die Jun 25 2002     | Mario Stanke          | creation of the file
\******************************************************************************/

#ifndef __CONTENTMODEL_HH
#define __CONTENTMODEL_HH

// project includes
#include "types.hh"
#include "motif.hh"

// standard C/C++ includes
#include <string>
#include <iostream>
#include <iomanip>

using namespace std;

class ContentModel {
public:
    /*
     * default contructor
     */
    ContentModel(){}
    
    /*
     * contructor
     */
    ContentModel(int k, int f = 1){
	init(k,f);
    };

     void init(int k, int f){
	this->k = k;
	patprob.assign(f, POWER4TOTHE(k+1));
    }
 
    void setRandomPatProbs();
    string generateRandSeq(int n, int startFrame = 0) const;
    static int randomIndex(const Double* p, int count);
    Double seqProbUnderModel(const char *seq, int len, int frame) const;
    BaseCount getMeanContent();
    Double getPatProb(int f, int pn) const{ return patprob[f][pn]; }
//     const Double* getPatProb(int f) const {return (*patprob)[f];}
    vector<Double> copyPatProb(int f) const {return patprob.getRow(f);}
    void setPatProb(const Matrix<Double>& newpatprob);
    void setPatProb(int frame, const vector<Double>& newRow);
//     void setPatProbClone(const Matrix<Double>& newpatprob);
    int getNumFrames() const { return patprob.getColSize(); }
    int getNumPatterns() const { return patprob.getRowSize(); }
    void print();
    static double DiscrimDifference(const ContentModel *a, const ContentModel *b, 
				    int n, int fa=0, int fb=0);

private:
    int k;
    Matrix<Double> patprob;
};



#endif    //__CONTENTMODEL_HH