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

PrimarySequence.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 
00028 #ifndef SEQPP_PRIMARYSEQUENCE_H
00029 #define SEQPP_PRIMARYSEQUENCE_H
00030 
00031 #include <seqpp/Translator.h>
00032 #include <fstream>
00033 #include <iostream>
00034 #include <string>
00035 using namespace std;
00036 
00047 class PrimarySequence
00048 {
00049   protected :
00050     
00052   const Translator * _transl;
00054   short _sizecode;  
00055 
00057   short _nmodal;
00058 
00060   long * _obs;
00061 
00063   unsigned long _length;
00065   unsigned long _ipos;
00066 
00067 
00069   string _name;
00071   string _name_file;
00072 
00073 
00074   virtual short tell_int_speed( unsigned long pos ) const = 0;
00075 
00076   public :
00077   PrimarySequence(){
00078     //cout<<"default pr.seq constr"<<endl;
00079     _transl=NULL;_sizecode=0;_nmodal=0;_obs=NULL;_length=0;_ipos=0;
00080   }
00081 
00083   virtual ~PrimarySequence() = 0;
00084   
00085   // Methods ----------------------
00086 
00088   const Translator &  ref_translator() const{
00089     return *_transl;
00090   }
00091 
00093   short tell_alphabet_size () const{
00094     return _transl->tell_alphabet_size();
00095   }
00096 
00098   short tell_nb_inv () const{
00099     return (*_transl).tell_nb_inv();
00100   }
00101 
00102   //--------------------------------------------
00104   virtual  unsigned long tell_length () const{
00105     return(_length);
00106   }
00107  
00109   string  tell_seq_name ( ) const{
00110     return _name;
00111   }
00113   string  tell_file_name ( ) const{
00114     return _name_file;
00115   }
00116 
00117   //--------------------------------------------
00119   void set_pos(unsigned long t){
00120     _ipos = t;
00121   }
00122 
00124   unsigned long tell_pos(){
00125     return(_ipos);
00126   }
00127   //--------------------------------------------
00128   // INTERFACE//////////////////////////////////
00129 
00131   virtual short tell_int( unsigned long pos ) const = 0;
00132 
00134   short tell_int() {
00135     return tell_int(_ipos++);
00136   }
00137 
00139   short tell_int_compl (unsigned long pos) const{
00140     return _transl->complementary_int(this->tell_int(pos));
00141   } 
00142 
00144   short tell_int_compl () const{
00145     return _transl->complementary_int(this->tell_int(_ipos));
00146   } 
00147   //----------------------
00148 
00150   string tell_pattern( unsigned long pos ) const{   
00151     return _transl->int_to_str( tell_int(pos) );
00152   }
00153   
00155   string tell_pattern_compl ( unsigned long pos ){
00156     return _transl->complementary_int_to_str( tell_int(pos) );
00157   }
00158   
00160   string tell_patterns( unsigned long beg, unsigned long stop ) const;
00161   
00162   //----------------------
00164   string tell_label( unsigned long pos ) const{
00165     return _transl->int_to_label( tell_int(pos) );
00166   }
00167   
00169   string tell_labels( unsigned long beg, unsigned long stop ) const;
00170 
00171 
00172   //-----------------------
00174   void print( const string& file ) const;
00175 };
00176 
00177 #endif /*SEQPP_PRIMARYSEQUENCE_H*/



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


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