Version 4.1.5
Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

Markov Class Reference

Markov modelling, estimation and simulation. More...

#include <seqpp/Markov.h>

Inheritance diagram for Markov:

PhasedMarkov MTDMarkov PMarkov VLMarkov List of all members.

Public Member Functions

 Markov (const char *ConfFile, bool calc_rank=false)
 Constructor 1 : read a configuration file.
 Markov (const SequenceSet &seqset, bool calc_rank=false, const string &prior_alpha_file=string())
 Constructor 2 : Estimate the transition matrices on the sequences of seqset.
 Markov (const Sequence &seq, bool calc_rank=false, const string &prior_alpha_file=string())
 Constructor 3 : Estimate the transition matrices on the sequence seq.
 Markov (const Markov &)
 Constructor 4 : Copy constructor.
 Markov ()
 Constructor 5 : Default constructor.
 Markov (short size, short order, bool alloc=true, const string &prior_alpha_file=string())
 Constructor 6 : Minimal Constructor.
 Markov (const Markov &M1, const Markov &M2, const float p)
 Constructor 7 : Creation of a "mixed" Markov chain M = p*M1 + (1-p)*M2 */.
 Markov (const gsl_rng *r, short size, short order, bool calc_rank=false)
 Constructor 8 : random markov matrices.
 Markov (unsigned long *count, short size, short order, const string &prior_alpha_file=string(), bool calc_rank=false)
 Constructor 9 : Estimate the transition matrices on a word-count.
virtual ~Markov ()
 Destructor.
template<class TSeq>
void estimate (const TSeq &tseq, unsigned long beg, unsigned long end, bool calc_rank)
 Estimate the transition matrices on the sequence/sequenceset tseq.
void estimate (unsigned long *count, bool decal_required, bool calc_rank=false)
 Estimate the transition matrices from a word count.
void estimate (const string &count_file, bool calc_rank=false)
 Estimate the transition matrices from a file containing the count.
const double * markov_matrix () const
 access to the markov matrix
void draw_markov_matrix (const gsl_rng *r)
 draw at random the markov matrix
void free_markov_matrix ()
 free the memory allocated for markov matrix
void compute_stat_law (bool force=false)
 Compute the stationnary laws.
void free_stat_law ()
 free the memory allocated for stationnary law
const double * stat_law () const
 access to the stationnary distrib
virtual int compute_rank ()
 Computes the rank of convergence of the Markov Chain.
void compute_power ()
 Initialisation the _rank powers of the markov matrix.
int free_power ()
 free the memory allocated for the power
double proba_step (long w1, long w2, int step)
 transition from word w1 to word w2 in step steps
bool isPi () const
bool isPow () const
bool isMu () const
double & operator() (int index)
 () operator for Markov matrix Pi elements
double Mu (int index) const
 Access to stationnary vector Mu elements.

Protected Attributes

double * _Pi
 Pointer to "Matrix" (in a vector format) of transition probabilities (=_Pis[0]).
double * _container
 Container of "Matrix" (in a vector format) of transition probabilities (=_containers[0]).
double * _Mu
 Vector of stationnary probabilities (=_Mus[0]).
double *** _PowPi
 Power of the _Pi matrix.

Detailed Description

Markov modelling, estimation and simulation.

This is a special case of a phased Markov [PhasedMarkov] model when only one phase is considered.


Constructor & Destructor Documentation

Markov::Markov const SequenceSet seqset,
bool  calc_rank = false,
const string &  prior_alpha_file = string()
 

Constructor 2 : Estimate the transition matrices on the sequences of seqset.

Parameters:
seqset set of sequences for estimation
calc_rank calculus of the convergence rank if true
prior_alpha_file file containing the alpha for the a priori law, one value per alphabet element

Markov::Markov const Sequence seq,
bool  calc_rank = false,
const string &  prior_alpha_file = string()
 

Constructor 3 : Estimate the transition matrices on the sequence seq.

Parameters:
seq sequence for estimation
calc_rank calculus of the convergence rank if true
prior_alpha_file file containing the alpha for the a priori law, one value per alphabet element

Markov::Markov short  size,
short  order,
bool  alloc = true,
const string &  prior_alpha_file = string()
[inline]
 

Constructor 6 : Minimal Constructor.

Initialises the constants of the model but not the matrix nor the stat law

Parameters:
size alphabet size
order markovian order
alloc true for matrices memory allocation
prior_alpha_file file containing the alpha for the a priori law, one value per alphabet element

Markov::Markov const Markov M1,
const Markov M2,
const float  p
 

Constructor 7 : Creation of a "mixed" Markov chain M = p*M1 + (1-p)*M2 */.

Parameters:
M1 first Markov chain object
M2 second Markov chain object
p weight of M1 in the resulting M(with 0<=p<=1)

Markov::Markov const gsl_rng *  r,
short  size,
short  order,
bool  calc_rank = false
[inline]
 

Constructor 8 : random markov matrices.

Parameters:
r gsl random generator
size alphabet size
order markovian order
calc_rank calculus of the convergence rank if true
GSL use exple:
    const gsl_rng_type * T;
    // Choice a default generator and seed
    // from environment variables
    gsl_rng_env_setup();
    // New created instance of the generator
    T = gsl_rng_default;
    gsl_rng * r = gsl_rng_alloc (T);
    // Initialize/Seeds the random number generator
    gsl_rng_set( r, (long)getpid() );

Markov::Markov unsigned long *  count,
short  size,
short  order,
const string &  prior_alpha_file = string(),
bool  calc_rank = false
 

Constructor 9 : Estimate the transition matrices on a word-count.

Parameters:
count count of all the coded word(base size) of size order+1 for estimation
size alphabet size
order markovian order
calc_rank calculus of the convergence rank if true
prior_alpha_file file containing the alpha for the a priori law, one value per alphabet element


Member Function Documentation

void Markov::draw_markov_matrix const gsl_rng *  r  )  [inline]
 

draw at random the markov matrix

Parameters:
r gsl random generator
GSL use exple:
    const gsl_rng_type * T;
    // Choice a default generator and seed
    // from environment variables
    gsl_rng_env_setup();
    // New created instance of the generator
    T = gsl_rng_default;
    gsl_rng * r = gsl_rng_alloc (T);
    // Initialize/Seeds the random number generator
    gsl_rng_set( r, (long)(time( NULL )) );
    ...
    ...
    gsl_rng_free( r );

void Markov::estimate const string &  count_file,
bool  calc_rank = false
[inline]
 

Estimate the transition matrices from a file containing the count.

Parameters:
count_file file containing the count in the adapted format
calc_rank calculus of the convergence rank if true

Reimplemented from PhasedMarkov.

void Markov::estimate unsigned long *  count,
bool  decal_required,
bool  calc_rank = false
[inline]
 

Estimate the transition matrices from a word count.

Parameters:
count count of all the coded word(base size) of size order+1, for estimation
decal_required necessary when using a count of word from 1-word to (_order+1)-word
calc_rank calculus of the convergence rank if true

template<class TSeq>
void Markov::estimate const TSeq &  tseq,
unsigned long  beg,
unsigned long  end,
bool  calc_rank
[inline]
 

Estimate the transition matrices on the sequence/sequenceset tseq.

Parameters:
tseq sequence/sequenceset for estimation
beg begin position in sequence(s) if subsequences
end end position in sequence(s) if subsequences
calc_rank calculus of the convergence rank if true

bool Markov::isMu  )  const [inline]
 

_Mu == NULL ?

bool Markov::isPi  )  const [inline]
 

_Pi == NULL ?

bool Markov::isPow  )  const [inline]
 

_PowPi == NULL ?

double Markov::Mu int  index  )  const [inline]
 

Access to stationnary vector Mu elements.

Parameters:
index index of the word

double& Markov::operator() int  index  )  [inline]
 

() operator for Markov matrix Pi elements

Parameters:
index index of the word

double Markov::proba_step long  w1,
long  w2,
int  step
[inline]
 

transition from word w1 to word w2 in step steps

if step > _rank, give stat_law(w2). You must have w1-jump, w2-jump < _nMu

Parameters:
w1 first word (of length order) as a Sequence-coded-like integer (see Sequence)
w2 second word (of length order) as a Sequence-coded-like integer (see Sequence)
step number of steps between w1 and w2


The documentation for this class was generated from the following files:



Download seq++ 4.1.5
Download previous versions
Statistique & Genome Home


Generated on Thu Aug 4 18:34:05 2005 for seqpp by doxygen 1.3.9.1