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

Sequence.h

Go to the documentation of this file.
00001 /* seqpp/Sequence.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 
00029 #ifndef SEQPP_SEQUENCE_H
00030 #define SEQPP_SEQUENCE_H
00031 
00032 #include <seqpp/PrimarySequence.h>
00033 #include <seqpp/PrimaryCount.h>
00034 #include <seqpp/Coder.h>
00035 #include <set>
00036 
00037 #include <gsl/gsl_rng.h>
00038 #include <gsl/gsl_randist.h>
00060 class Sequence : public PrimarySequence, public PrimaryCount
00061 {
00062  protected :
00063  
00064   short tell_int_speed( unsigned long pos ) const{
00065     return _obs[pos]%_nmodal;
00066   }
00068   virtual unsigned long tell_max_count() const{
00069     return _length;
00070   }
00071   virtual void compute_count( unsigned long * * extern_count, 
00072                               short phase,
00073                               short initial_phase,
00074                               unsigned long beg,
00075                               unsigned long end ) const;
00076  public :
00089   Sequence( ifstream & ifile,
00090             short order,
00091             const Translator & transl,
00092             Coder & coder,
00093             const string & name_file = "noname" );
00094 
00095   // Constructors-destructor -------------
00097 
00102   Sequence( short order, unsigned long length,
00103             const Translator & transl );
00104   
00106 
00111   Sequence(  const  string &  name_file, short order,
00112              const Translator & transl );
00113      
00115   Sequence( const Sequence & seq );
00116   
00118   /*
00119     \param seq order 0-sequence
00120     \param order new markovian order
00121   */
00122   Sequence( const Sequence & seq, short order );
00123   
00125   virtual ~Sequence();
00126 
00127   //Methods --------------------------------
00129   short tell_int(unsigned long pos) const;
00130 
00131   //---------------------------------------------
00133   long tell_code( unsigned long pos ) const{  
00134     return(_obs[pos]);
00135   }
00136   
00138   long tell_code() const{
00139     return(_obs[_ipos]);
00140   }
00141 
00142   
00143   // Return the complementary code on position t    
00144   //Beware the complexity of this calculus !*/
00145   //    int tell_code_compl( long pos ) const{
00146   // return this->code_compl( _obs[pos] );
00147   //  }    
00148   //Return the complementary code on position t    
00149   //Beware the complexity of this calculus !*/
00150   //int tell_code_compl( )const{
00151   //  return this->code_compl( _obs[_ipos] );
00152   //}
00153   
00154   
00156   const long * seq( ) const{
00157     return _obs;
00158   } 
00160   const long * get_code( ) const{
00161     return _obs;
00162   } 
00163  
00164   //--------------------------------------------
00166   /*
00167     \param m_trans markovian transition matrix
00168     \param v_init initial law
00169     \param r gsl random generator
00170     <br>GSL use exple:<br>
00171     \code
00172     const gsl_rng_type * T;
00173     // Choice a default generator and seed
00174     // from environment variables
00175     gsl_rng_env_setup();
00176     // New created instance of the generator
00177     T = gsl_rng_default;
00178     gsl_rng * r = gsl_rng_alloc (T);
00179     // Initialize/Seeds the random number generator
00180     gsl_rng_set( r, (long)(time( NULL )) );
00181     \endcode
00182   */
00183   void simule( const double * m_trans,
00184                const double * v_init,
00185                const gsl_rng * r );
00186 
00188   /*
00189     \param m_trans markovian transition matrix    
00190     \param r gsl random generator 
00191   */
00192   void simule( const double * m_trans,
00193                const gsl_rng * r ){
00194     simule( m_trans, NULL, r );
00195   }
00196 
00197   /*
00198     void simule( const Markov& m,
00199     const gsl_rng * r ){
00200     simule( m->getPi(), m->getMu(), r );
00201     }
00202   */
00203 
00205   void simule_phased(  short phase, 
00206                        const double ** m_trans,
00207                        const double * v_init,                 
00208                        const gsl_rng * r );
00209 
00210 
00212   void simule( unsigned long position, 
00213                double * proba, 
00214                const gsl_rng * r );
00215 
00216 
00217   //---------------------------------------------
00218  
00219 };
00220 
00221 int Multinomial_1_Draw ( int dim, 
00222                          const double * param, const gsl_rng * r );
00223 int Multinomial_1_Draw ( int dim, const gsl_rng * r );
00224 
00225 #endif /* SEQPP_CSEQUENCE_H */



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


Generated on Wed Mar 23 09:25:58 2005 for seqpp by doxygen 1.3.9.1