X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=blobdiff_plain;f=alg%2Fsequence.cpp;h=608ddd3b2059ba808c283e7726b181bfb27e0ce2;hp=68fa01460542956a6dabf5864786a50f47080737;hb=f3e6762bedaf3775619a36f4103c8cf35d2ca887;hpb=a5fdb434dd0e6d18fe98e9ee57cb5169ce4c5842 diff --git a/alg/sequence.cpp b/alg/sequence.cpp index 68fa014..608ddd3 100644 --- a/alg/sequence.cpp +++ b/alg/sequence.cpp @@ -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;