File: contentmodel.hh

package info (click to toggle)
augustus 3.4.0%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 758,480 kB
  • sloc: cpp: 65,451; perl: 21,436; python: 3,927; ansic: 1,240; makefile: 1,032; sh: 189; javascript: 32
file content (71 lines) | stat: -rw-r--r-- 1,745 bytes parent folder | download | duplicates (3)
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
/*
 * contentmodel.hh
 *
 * License: Artistic License, see file LICENSE.TXT or 
 *          https://opensource.org/licenses/artistic-license-1.0
 */

#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;

/**
 * @brief Model typical sequences by pattern frequencies
 * 
 * @author Mario Stanke
 * @version 0.2
 */
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