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

PhasedVLMarkov.h

Go to the documentation of this file.
00001 /* seqpp/PhasedVLMarkov.h
00002  *
00003  * Copyright (C) 2003 Laboratoire Statistique & Génome
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or (at
00008  * your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful, but
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  */
00019 
00028 #ifndef SEQPP_PHASEDVLMARKOV_H
00029 #define SEQPP_PHASEDVLMARKOV_H
00030 
00031 #include <seqpp/PhasedMarkov.h>
00032 #include <seqpp/vlm_tree.h>
00033 
00034 
00048 class PhasedVLMarkov : public PhasedMarkov
00049 {
00050  protected :
00052   vlm_tree * _vlmtree;
00053 
00054  public: 
00056 
00063   template <class TSeq>
00064     PhasedVLMarkov( const TSeq & tseq,
00065                     vector<double> & init, double cutoff,
00066                     short phase, short initial_phase = 0 )
00067     :  PhasedMarkov(  tseq.tell_alphabet_size(), tseq.tell_order(), phase )
00068   {
00069     _vlmtree = new vlm_tree( tseq.get_coder(),
00070                             _size,                          
00071                             _order,
00072                             init );
00073     tseq.count_p_occurencies( phase, initial_phase );
00074     _nb_param = 0;
00075     for (int i=0; i<phase; i++){
00076       _vlmtree->estimate_context( tseq.get_count(i),
00077                                   cutoff );
00078       _vlmtree->tree_to_matrix( _Pis[i] );
00079       _nb_param += _vlmtree->nb_leaves() * (_size-1); 
00080     }
00081     delete _vlmtree;
00082   }
00083   
00085 
00091   template <class TSeq>
00092     PhasedVLMarkov( const TSeq & tseq,
00093                     double cutoff,
00094                     short phase, short initial_phase = 0 )
00095     :  PhasedMarkov(  tseq.tell_alphabet_size(), tseq.tell_order(), phase )
00096   {
00097     vector<double> init;
00098     for (short i = 0; i<_size; i++)
00099       init.push_back( 1./_size );
00100     
00101     _vlmtree = new vlm_tree( tseq.get_coder(),
00102                              _size,                         
00103                             _order,
00104                             init );
00105     tseq.count_p_occurencies( phase, initial_phase );
00106     _nb_param = 0;
00107     for (int i=0; i<phase; i++){
00108       _vlmtree->estimate_context( tseq.get_count(i),
00109                                   cutoff );
00110       _vlmtree->tree_to_matrix( _Pis[i] );
00111       _nb_param += _vlmtree->nb_leaves() * (_size-1);  
00112     }
00113     
00114     delete _vlmtree;
00115   }
00116 
00118   ~PhasedVLMarkov(){};
00119 };
00120 #endif



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


Generated on Thu Aug 4 20:33:12 2005 for seqpp by doxygen 1.3.9.1