incorporate drawable and annotations
[mussa.git] / alg / seq_span.cpp
index bf9a3dc3664bb72d40a613a28521795db1265402..581ef830c43711e0ca5423502eb50faac791bb07 100644 (file)
@@ -10,7 +10,9 @@ SeqSpan::SeqSpan(const SeqSpan &o)
     seq_start(o.seq_start),
     seq_count(o.seq_count),
     parent(o.parent),
-    rc_seq(o.rc_seq)
+    rc_seq(o.rc_seq),
+    seq_annotations(o.seq_annotations),
+    seq_drawable(o.seq_drawable)
 {
 }
 
@@ -19,7 +21,9 @@ SeqSpan::SeqSpan(const SeqSpan *p)
     seq_start(p->seq_start),
     seq_count(p->seq_count),
     parent(p->parent),
-    rc_seq(p->rc_seq) 
+    rc_seq(p->rc_seq),
+    seq_annotations(p->seq_annotations),
+    seq_drawable(p->seq_drawable) 
 {
 }
 
@@ -113,6 +117,14 @@ SeqSpan::SeqSpan(const SeqSpanRef parent_,
     throw sequence_invalid_strand("unrecognized strand identifier");
     break;
   }
+  
+  // Ack the complexity increases!
+  // If our parent is on the minus strand, we need to adjust the start
+  // and count to look like we're selecting from the right side of the 
+  // parent sequence (AKA the start of the minus strand)
+  if (parent and parent->strand() == MinusStrand) {
+    seq_start = parent->start() + parent->size() - (start_ + seq_count);
+  }
 }
 
 //////
@@ -125,6 +137,8 @@ SeqSpan &SeqSpan::operator=(const SeqSpan& s)
     seq_count = s.seq_count;
     parent = s.parent;
     rc_seq = s.rc_seq;
+    //seq_annotations.reset(s.seq_annotations);
+    //seq_drawable.reset(s.seq_drawable);
   }
   return *this;
 }