void Genome::fixParseInfo() { if (getParent() == NULL || getNumChildren() == 0) { return; } // copied from CactusHalConverter::updateRootParseInfo() in // cactus2hal/src/cactusHalConverter.cpp BottomSegmentIteratorPtr bottomIterator = getBottomSegmentIterator(); TopSegmentIteratorPtr topIterator = getTopSegmentIterator(); BottomSegmentIteratorConstPtr bend = getBottomSegmentEndIterator(); TopSegmentIteratorConstPtr tend = getTopSegmentEndIterator(); int top = 0, bot = 0; while (bottomIterator != bend && topIterator != tend) { bool bright = false; bool tright = false; BottomSegment* bseg = bottomIterator->getBottomSegment(); TopSegment* tseg = topIterator->getTopSegment(); hal_index_t bstart = bseg->getStartPosition(); hal_index_t bendidx = bstart + (hal_index_t)bseg->getLength(); hal_index_t tstart = tseg->getStartPosition(); hal_index_t tendidx = tstart + (hal_index_t)tseg->getLength(); if (bstart >= tstart && bstart < tendidx) { bseg->setTopParseIndex(tseg->getArrayIndex()); } if (bendidx <= tendidx || bstart == bendidx) { bright = true; } if (tstart >= bstart && tstart < bendidx) { tseg->setBottomParseIndex(bseg->getArrayIndex()); } if (tendidx <= bendidx || tstart == tendidx) { tright = true; } assert(bright || tright); if (bright == true) { bot += 1; bottomIterator->toRight(); } if (tright == true) { top += 1; topIterator->toRight(); } } }
void TopSegmentStruct::applyTo(TopSegmentIteratorPtr it) const { TopSegment *seg = it->getTopSegment(); seg->setCoordinates(_startPosition, _length); seg->setNextParalogyIndex(_nextParalogyIndex); seg->setParentIndex(_parentIndex); seg->setParentReversed(_parentReversed); seg->setBottomParseIndex(_bottomParseIndex); }