X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=blobdiff_plain;f=alg%2Fseq.hpp;h=5ac42a2bb220ec58630ec4c1138ca6c9ee8c422b;hp=b102a00767b7356849abebbe2d235812cad03186;hb=f1724abab87d2e5b160620b10cb81eabf56aadeb;hpb=7d4fbcb6060a60a8ea25ca1303fcaaaf8574f24a diff --git a/alg/seq.hpp b/alg/seq.hpp index b102a00..5ac42a2 100644 --- a/alg/seq.hpp +++ b/alg/seq.hpp @@ -15,11 +15,13 @@ #include +#include "alphabet.hpp" //! These classes provide for the internal implementation for the Sequence class /** the only purpose of this class is that the shared_ptr template * functions need the serialization support to be in-class. */ + class SeqString : public std::string { public: @@ -34,17 +36,29 @@ public: typedef std::string::value_type value_type; static const size_type npos = std::string::npos; - SeqString() : std::string() {}; - SeqString(const std::string &s) : std::string(s) {}; + SeqString(AlphabetRef a=reduced_nucleic_alphabet) : + std::string(), + alphabet(a) + {} + SeqString(const std::string &s, AlphabetRef a=reduced_nucleic_alphabet) : + std::string(s), + alphabet(a) + {} + + AlphabetRef get_alphabet_ref() { return alphabet; } + const Alphabet& get_alphabet() const; + std::string create_reverse_complement_map() const; private: + AlphabetRef alphabet; friend class boost::serialization::access; template void serialize(Archive& ar, const unsigned int /*version*/) { //ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(std::string); ar & boost::serialization::make_nvp("bases", - boost::serialization::base_object(*this) + boost::serialization::base_object(*this) ); + ar & BOOST_SERIALIZATION_NVP(alphabet); } }; typedef boost::shared_ptr SeqStringRef;