show where the Ns are
[mussa.git] / alg / seq_span.hpp
index 5a2da1268d3a62cf807f323d7e39bb450fea5841..cf2723ea928d7bfc80034bba4d3d811940b226bb 100644 (file)
@@ -2,6 +2,8 @@
 #define SEQ_SPAN_HPP_
 
 #include <string>
+#include <map>
+#include <list>
 
 #include <boost/serialization/base_object.hpp>
 #include <boost/serialization/export.hpp>
 
 //! These classes provide for the internal implementation for the Sequence class
 #include "seq.hpp"
+#include "annotations.hpp"
+#include "drawable.hpp"
 
 class SeqSpan;
 typedef boost::shared_ptr<SeqSpan> SeqSpanRef;
+typedef std::list<SeqSpanRef> SeqSpanRefList;
+typedef boost::shared_ptr<SeqSpanRefList> SeqSpanRefListRef; 
 
 //! Track what segment of a sequence we're looking at
 class SeqSpan : public boost::enable_shared_from_this<SeqSpan> {
@@ -117,7 +123,8 @@ public:
   size_type parentStop() const;
   //! set stop position relative to parent sequence
   void setParentStop(size_type);
-  size_type parentSize() const { return (parent) ? parent->size() : size(); }
+  size_type parentSize() const { return (parent_seq) ? parent_seq->size() : size(); }
+  SeqSpanRef parent() { return parent_seq; }
   
 
   //! return a subsequence, copying over any appropriate annotation
@@ -128,11 +135,16 @@ public:
   std::string sequence() const; 
   //! are both sequences derived from the same sequence tree?
   static bool isFamily(const SeqSpan& a, const SeqSpan& b);
+
+  //! access annotations dictionary
+  AnnotationsRef annotations() const { return seq_annotations; }
+  //! set annotations dictionary
+  void setAnnotations(AnnotationsRef a) { seq_annotations = a; }
+  //! get data for drawing
+  DrawableRef drawable() const { return seq_drawable; }
+  //! store drawing data
+  void setDrawable(DrawableRef d) { seq_drawable = d; }
   
-  //! fill in our rc_seq variable 
-  void initialize_rc_seq() const;
-  
-  friend class Sequence;
 private:
   //! do not statically initialize, only create with new
   SeqSpan() {};
@@ -147,11 +159,19 @@ protected:
   strand_type seq_strand;
   
   //! keep a reference to who our parent span is 
-  SeqSpanRef parent;
-
+  SeqSpanRef parent_seq;
+  
   //! hold a reverse complement version of our sequence if needed
-  SeqStringRef rc_seq;
+  SeqStringRef rc_seq;  
+  //! fill in our rc_seq variable 
+  void initialize_rc_seq() const;
   
+  //! annotations provides a python-dictionary like place for metadata
+  AnnotationsRef seq_annotations;
+  //! store information needed for drawing
+  DrawableRef seq_drawable;
+  
+  friend class Sequence;
   // boost::serialization support
   friend class boost::serialization::access;
   template<class Archive>
@@ -160,7 +180,7 @@ protected:
     ar & BOOST_SERIALIZATION_NVP(seq_start);
     ar & BOOST_SERIALIZATION_NVP(seq_count);
     ar & BOOST_SERIALIZATION_NVP(seq_strand);
-    ar & BOOST_SERIALIZATION_NVP(parent);
+    ar & BOOST_SERIALIZATION_NVP(parent_seq);
   }
 };
 #endif /*SEQ_SPAN_HPP_*/