00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef SEQ_H
00025 #define SEQ_H
00026
00041 #include <iosfwd>
00042 #include <string>
00043 #include <exception>
00044 #include <utility>
00045 #include <Sequence/SeqExceptions.hpp>
00046
00047 namespace Sequence
00048 {
00049 class Seq : public std::pair<std::string,std::string>
00050 {
00051 typedef std::pair<std::string,std::string> SeqBase;
00052 public:
00053 Seq (void);
00054 Seq (const char *name, const char *seq);
00055 Seq (const Seq & seq);
00056 virtual ~ Seq (){}
00057 std::string GetName (void) const;
00058 std::string GetSeq (void) const;
00059 std::string substr(unsigned beg, unsigned len) const;
00060 std::string substr(unsigned beg) const;
00066 typedef std::string::iterator iterator;
00072 typedef std::string::const_iterator const_iterator;
00073 typedef std::string::reference reference;
00074 typedef std::string::const_reference const_reference;
00075 typedef std::string::size_type size_type;
00076 iterator begin();
00077 iterator end();
00078 const_iterator begin() const;
00079 const_iterator end() const;
00080 void Revcom (void);
00081 void Subseq (unsigned,unsigned);
00082 void Complement(void);
00083 size_type length (void) const;
00084 size_type UngappedLength (void) const;
00085 bool IsGapped (void) const;
00086 reference operator[] (const size_type & i);
00087 const_reference operator[] (const size_type & i) const;
00088 bool operator==(const Seq & rhs) const;
00089 bool operator!=(const Seq & rhs) const;
00090 operator std::string() const;
00091 const char *c_str(void) const;
00095 virtual std::istream & read (std::istream & s)
00096 throw (Sequence::badFormat,std::exception) = 0;
00100 virtual std::ostream & print (std::ostream & s) const = 0;
00101 };
00102
00103 inline std::ostream &
00104 operator<< (std::ostream & s, const Seq & c)
00111 {
00112 return c.print (s);
00113 }
00114
00115 inline std::istream &
00116 operator>> (std::istream & s, Seq &c)
00123 {
00124 return c.read (s);
00125 }
00126 }
00127 #endif