+
+ // blech this strand logic is too long
+ switch(strand_) {
+ case UnknownStrand:
+ case PlusStrand:
+ case MinusStrand:
+ case BothStrand:
+ seq_strand = strand_;
+ break;
+ case SameStrand:
+ if (parent) {
+ seq_strand = parent->strand();
+ } else {
+ throw sequence_invalid_strand("SameStrand is undefined with no parent");
+ }
+ break;
+ case OppositeStrand:
+ if (parent) {
+ switch (parent->strand()) {
+ case PlusStrand:
+ seq_strand = MinusStrand;
+ break;
+ case MinusStrand:
+ seq_strand = PlusStrand;
+ break;
+ case UnknownStrand:
+ case BothStrand:
+ seq_strand = parent->strand();
+ break;
+ case SingleStrand:
+ throw sequence_invalid_strand(
+ "OppositeStrand is undefined with SingleStrands"
+ );
+ break;
+ default:
+ throw sequence_invalid_strand("Parent has an invalid strand type");
+ }
+ } else {
+ throw sequence_invalid_strand("SameStrand is undefined with no parent");
+ }
+ break;
+ case SingleStrand:
+ if (parent) {
+ if (parent->strand() == SingleStrand) {
+ seq_strand = SingleStrand;
+ } else {
+ throw sequence_invalid_strand("Can't change single strandedness");
+ }
+ } else {
+ seq_strand = SingleStrand;
+ }
+ break;
+ default:
+ throw sequence_invalid_strand("unrecognized strand identifier");
+ break;
+ }