use an enum instead of a bool for strandedness
[mussa.git] / alg / sequence.hpp
index aa1460fcb1152201ab527b2c032a6b53b497a77a..6ad83206b994f9b8e51d3da2b30063984b3a5055 100644 (file)
@@ -109,6 +109,7 @@ public:
   typedef std::string::const_reference const_reference;
   typedef std::string::size_type size_type;
   static const size_type npos = std::string::npos;
+  enum strand_type { UnknownStrand, PlusStrand, MinusStrand, BothStrand };
 
   // some standard dna alphabets 
   // Include nl (\012), and cr (\015) to make sequence parsing eol 
@@ -136,8 +137,9 @@ public:
 
   //! set sequence to a (sub)string containing nothing but AGCTN
   void set_filtered_sequence(const std::string& seq, 
-                            std::string::size_type start=0, 
-                            std::string::size_type count=0);
+                            size_type start=0,
+                            size_type count=npos,
+                             strand_type strand=UnknownStrand);
 
   //! retrive element at specific position
   const_reference at(size_type n) const;
@@ -158,7 +160,7 @@ public:
 
   //! return a subsequence, copying over any appropriate annotation
   Sequence subseq(int start=0, int count = std::string::npos) const;
-  //! return a reverse compliment
+  //! return a reverse compliment (this needs to be improved?)
   std::string rev_comp() const;
 
   //! set sequence (filtered)
@@ -229,6 +231,8 @@ private:
   size_type seq_start;
   //! number of basepairs of the shared sequence we represent
   size_type seq_count;
+  //! strand orientation
+  strand_type strand;
   //! fasta header
   std::string header;
   //! species name
@@ -251,6 +255,7 @@ private:
     ar & BOOST_SERIALIZATION_NVP(seq);
     ar & BOOST_SERIALIZATION_NVP(seq_start);
     ar & BOOST_SERIALIZATION_NVP(seq_count);
+    ar & BOOST_SERIALIZATION_NVP(strand);
     ar & BOOST_SERIALIZATION_NVP(header);
     ar & BOOST_SERIALIZATION_NVP(species);
     ar & BOOST_SERIALIZATION_NVP(annots);