Version 4.1.5
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 & operator() ( unsigned long pos ) const{  
00139     return(_obs[pos]);
00140   }
00141 
00143   long tell_code() const{
00144     return(_obs[_ipos]);
00145   }
00146 
00147   
00148   // Return the complementary code on position t    
00149   //Beware the complexity of this calculus !*/
00150   //    int tell_code_compl( long pos ) const{
00151   // return this->code_compl( _obs[pos] );
00152   //  }    
00153   //Return the complementary code on position t    
00154   //Beware the complexity of this calculus !*/
00155   //int tell_code_compl( )const{
00156   //  return this->code_compl( _obs[_ipos] );
00157   //}
00158   
00159   
00161   const long * seq( ) const{
00162     return _obs;
00163   }
00165   const long * get_code( ) const{
00166     return _obs;
00167   }  
00168   
00169  
00170   //--------------------------------------------
00172   /*
00173     \param m_trans markovian transition matrix
00174     \param v_init initial law
00175     \param r gsl random generator
00176     <br>GSL use exple:<br>
00177     \code
00178     const gsl_rng_type * T;
00179     // Choice a default generator and seed
00180     // from environment variables
00181     gsl_rng_env_setup();
00182     // New created instance of the generator
00183     T = gsl_rng_default;
00184     gsl_rng * r = gsl_rng_alloc (T);
00185     // Initialize/Seeds the random number generator
00186     gsl_rng_set( r, (long)getpid() );
00187     \endcode
00188   */
00189   void simule( const double * m_trans,
00190                const double * v_init,
00191                const gsl_rng * r );
00192 
00194   /*
00195     \param m_trans markovian transition matrix    
00196     \param r gsl random generator 
00197   */
00198   void simule( const double * m_trans,
00199                const gsl_rng * r ){
00200     simule( m_trans, NULL, r );
00201   }
00202 
00203   /*
00204     void simule( const Markov& m,
00205     const gsl_rng * r ){
00206     simule( m->getPi(), m->getMu(), r );
00207     }
00208   */
00209 
00211   void simule_phased(  short phase, 
00212                        const double ** m_trans,
00213                        const double * v_init,                 
00214                        const gsl_rng * r );
00215 
00216 
00218   void simule( unsigned long position, 
00219                double * proba, 
00220                const gsl_rng * r );
00221 
00222 
00223   //---------------------------------------------
00224  
00225 };
00226 
00227 int Multinomial_1_Draw ( int dim, 
00228                          const double * param, const gsl_rng * r );
00229 int Multinomial_1_Draw ( int dim, const gsl_rng * r );
00230 
00231 #endif /* SEQPP_CSEQUENCE_H */



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


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