X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=blobdiff_plain;f=alg%2Fseq_span.cpp;h=bd34e991cb03d9e6c7be488cc56eb8d99966bdc0;hp=581ef830c43711e0ca5423502eb50faac791bb07;hb=15f9eb9d7ba5ffe32cbe7bc67a9d85b714c27871;hpb=9d76ff624ae315a1262d6ceba1faeb68484ebd85 diff --git a/alg/seq_span.cpp b/alg/seq_span.cpp index 581ef83..bd34e99 100644 --- a/alg/seq_span.cpp +++ b/alg/seq_span.cpp @@ -9,7 +9,7 @@ SeqSpan::SeqSpan(const SeqSpan &o) : seq(o.seq), seq_start(o.seq_start), seq_count(o.seq_count), - parent(o.parent), + parent_seq(o.parent_seq), rc_seq(o.rc_seq), seq_annotations(o.seq_annotations), seq_drawable(o.seq_drawable) @@ -20,7 +20,7 @@ SeqSpan::SeqSpan(const SeqSpan *p) : seq(p->seq), seq_start(p->seq_start), seq_count(p->seq_count), - parent(p->parent), + parent_seq(p->parent_seq), rc_seq(p->rc_seq), seq_annotations(p->seq_annotations), seq_drawable(p->seq_drawable) @@ -32,7 +32,7 @@ SeqSpan::SeqSpan(const std::string &seq_, strand_type strand_) : seq_start(0), seq_count(seq_.length()), - parent() + parent_seq() { switch (strand_) { case PlusStrand: @@ -55,7 +55,7 @@ SeqSpan::SeqSpan(const SeqSpanRef parent_, strand_type strand_) : seq(parent_->seq), seq_start(parent_->seq_start + start_), - parent(parent_) + parent_seq(parent_) { if (count_ == npos) seq_count = parent_->seq_count; @@ -71,15 +71,15 @@ SeqSpan::SeqSpan(const SeqSpanRef parent_, seq_strand = strand_; break; case SameStrand: - if (parent) { - seq_strand = parent->strand(); + if (parent_seq) { + seq_strand = parent_seq->strand(); } else { throw sequence_invalid_strand("SameStrand is undefined with no parent"); } break; case OppositeStrand: - if (parent) { - switch (parent->strand()) { + if (parent_seq) { + switch (parent_seq->strand()) { case PlusStrand: seq_strand = MinusStrand; break; @@ -88,7 +88,7 @@ SeqSpan::SeqSpan(const SeqSpanRef parent_, break; case UnknownStrand: case BothStrand: - seq_strand = parent->strand(); + seq_strand = parent_seq->strand(); break; case SingleStrand: throw sequence_invalid_strand( @@ -103,8 +103,8 @@ SeqSpan::SeqSpan(const SeqSpanRef parent_, } break; case SingleStrand: - if (parent) { - if (parent->strand() == SingleStrand) { + if (parent_seq) { + if (parent_seq->strand() == SingleStrand) { seq_strand = SingleStrand; } else { throw sequence_invalid_strand("Can't change single strandedness"); @@ -122,8 +122,8 @@ SeqSpan::SeqSpan(const SeqSpanRef parent_, // 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); + if (parent_seq and parent_seq->strand() == MinusStrand) { + seq_start = parent_seq->start() + parent_seq->size() - (start_ + seq_count); } } @@ -135,7 +135,7 @@ SeqSpan &SeqSpan::operator=(const SeqSpan& s) seq = s.seq; seq_start = s.seq_start; seq_count = s.seq_count; - parent = s.parent; + parent_seq = s.parent_seq; rc_seq = s.rc_seq; //seq_annotations.reset(s.seq_annotations); //seq_drawable.reset(s.seq_drawable); @@ -326,32 +326,32 @@ void SeqSpan::setStop(SeqSpan::size_type v) SeqSpan::size_type SeqSpan::parentStart() const { - if (!parent) { + if (!parent_seq) { // no parent return start(); } else { - return start() - parent->start(); + return start() - parent_seq->start(); } } void SeqSpan::setParentStart(SeqSpan::size_type v) { - setStart(parent->start() + v); + setStart(parent_seq->start() + v); } SeqSpan::size_type SeqSpan::parentStop() const { - if (!parent) { + if (!parent_seq) { // no parent return stop(); } else { - return stop() - parent->start(); + return stop() - parent_seq->start(); } } void SeqSpan::setParentStop(SeqSpan::size_type v) { - setStop(parent->start() + v); + setStop(parent_seq->start() + v); } SeqSpanRef SeqSpan::subseq(size_type start, size_type count, strand_type strand)