incorporate drawable and annotations
[mussa.git] / alg / sequence.cpp
index 68fa01460542956a6dabf5864786a50f47080737..608ddd3b2059ba808c283e7726b181bfb27e0ce2 100644 (file)
@@ -122,6 +122,15 @@ Sequence::Sequence(const Sequence* o)
 {
 }
 
+Sequence::Sequence(const SequenceRef o)
+  : seq(new SeqSpan(o->seq)),
+    header(o->header),
+    species(o->species),
+    annots(o->annots),
+    motif_list(o->motif_list)
+{
+}
+
 Sequence::Sequence(const SeqSpanRef& seq_ref)
   : seq(seq_ref),
     header(""),
@@ -538,8 +547,8 @@ void Sequence::copy_children(Sequence &new_seq, size_type start, size_type count
       new_seq.annots.push_back(new_annot);
     }
   }
-  
 }
+
 Sequence
 Sequence::subseq(size_type start, size_type count, SeqSpan::strand_type strand) const
 {
@@ -551,7 +560,10 @@ Sequence::subseq(size_type start, size_type count, SeqSpan::strand_type strand)
 
   Sequence new_seq = *this;
   new_seq.seq = seq->subseq(start, count, strand);
-
+  if (seq->annotations()) {
+    AnnotationsRef a(new Annotations(*(seq->annotations())));
+    new_seq.seq->setAnnotations(a);
+  }
   copy_children(new_seq, start, count);
   
   return new_seq;