X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=blobdiff_plain;f=alg%2Fsequence.cpp;h=05ec0a928dfc63390421f87927444b4179332063;hp=55ff5bf91bb575f9322102fafc78d4259ac1bd62;hb=15f9eb9d7ba5ffe32cbe7bc67a9d85b714c27871;hpb=9d76ff624ae315a1262d6ceba1faeb68484ebd85 diff --git a/alg/sequence.cpp b/alg/sequence.cpp index 55ff5bf..05ec0a9 100644 --- a/alg/sequence.cpp +++ b/alg/sequence.cpp @@ -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); }