00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
00079 _transl=NULL;_sizecode=0;_nmodal=0;_obs=NULL;_length=0;_ipos=0;
00080 }
00081
00083 virtual ~PrimarySequence() = 0;
00084
00085
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
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