4 #include <boost/serialization/export.hpp>
5 #include <boost/serialization/nvp.hpp>
6 #include <boost/serialization/string.hpp>
7 #include <boost/serialization/utility.hpp>
8 #include <boost/serialization/version.hpp>
12 //! this is a helper class for sequence
14 friend class Sequence;
16 typedef std::string::const_iterator const_iterator;
18 //! return reference to the characters in our alphabet
19 const char *c_str() const;
20 //! case-insensitive test to check a character for existence in our alphabet
21 bool exists(const char) const;
23 // note, if you want to define an alphabet for a sequence, you probably want
24 // to update the enumeration in Sequence, and Sequence::get_sequence
25 //! The standard DNA alphabet, with unique, and unknown characters
26 static const Alphabet reduced_dna_alphabet;
27 //! The standard RNA alphabet, with unique, and unknown characters
28 static const Alphabet reduced_rna_alphabet;
29 //! The standard DNA/RNA alphabet, with unique, and unknown characters
30 static const Alphabet reduced_nucleic_alphabet;
31 //! this is the general IUPAC alphabet for nucleotides
32 static const Alphabet nucleic_alphabet;
33 //! the protein alphabet
34 static const Alphabet protein_alphabet;
37 //! what are allowable symbols in our alphabet
39 //! internal variable to make exists() faster
40 std::set<std::string::value_type> alphabet_set;
42 //! some necessary string api access
43 Alphabet(const char *a);
44 //! allow sequence to copy one alphabet to another (needed when unserializing)
45 void assign(const Alphabet& a);
46 const_iterator begin() const { return alphabet.begin(); }
47 const_iterator end() const { return alphabet.end(); }
50 friend class boost::serialization::access;
51 template<class Archive>
52 void serialize(Archive& ar, const unsigned int /*version*/) {
53 ar & BOOST_SERIALIZATION_NVP(alphabet);
55 alphabet_set.insert(alphabet.begin(), alphabet.end());