show where the Ns are
[mussa.git] / alg / sequence.cpp
index 55ff5bf91bb575f9322102fafc78d4259ac1bd62..05ec0a928dfc63390421f87927444b4179332063 100644 (file)
@@ -123,9 +123,22 @@ Sequence::Sequence(const SequenceRef o)
   : seq(new SeqSpan(o->seq)),
     header(o->header),
     species(o->species),
-    annotation_list(o->annotation_list),
+    annotation_list(new SeqSpanRefList),
     motif_list(o->motif_list)
 {
+  // copy over the annotations in the other sequence ref, 
+  // attaching them to our current sequence ref
+  for(SeqSpanRefList::const_iterator annot_i = o->annotation_list->begin();
+      annot_i != o->annotation_list->end();
+      ++annot_i)
+  {
+    size_type annot_begin= (*annot_i)->start();
+    size_type annot_count = (*annot_i)->size();
+    
+    SeqSpanRef new_annot(seq->subseq(annot_begin, annot_count));
+    new_annot->setAnnotations((*annot_i)->annotations());
+    annotation_list->push_back(new_annot);
+  }  
 }
 
 Sequence::Sequence(const SeqSpanRef& seq_ref)
@@ -566,8 +579,7 @@ void Sequence::copy_children(Sequence &new_seq, size_type start, size_type count
       } else {
         annot_end = count;
       }
-
-      SeqSpanRef new_annot(seq->subseq(annot_begin, annot_end));
+      SeqSpanRef new_annot(new_seq.seq->subseq(annot_begin, annot_end));
       new_annot->setAnnotations((*annot_i)->annotations());
       new_seq.annotation_list->push_back(new_annot);
     }