本文整理汇总了C++中TopSegmentIteratorConstPtr::getParentIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ TopSegmentIteratorConstPtr::getParentIndex方法的具体用法?C++ TopSegmentIteratorConstPtr::getParentIndex怎么用?C++ TopSegmentIteratorConstPtr::getParentIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopSegmentIteratorConstPtr
的用法示例。
在下文中一共展示了TopSegmentIteratorConstPtr::getParentIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: copyTopSegments
void Genome::copyTopSegments(Genome *dest) const
{
const Genome *inParent = getParent();
const Genome *outParent = dest->getParent();
TopSegmentIteratorConstPtr inTop = getTopSegmentIterator();
TopSegmentIteratorPtr outTop = dest->getTopSegmentIterator();
hal_size_t n = dest->getNumTopSegments();
assert(n == 0 || n == getNumTopSegments());
if (n == 0) {
// Nothing to do if there are no top segments.
return;
}
BottomSegmentIteratorConstPtr inParentBottomSegIt = inParent->getBottomSegmentIterator();
BottomSegmentIteratorConstPtr outParentBottomSegIt = outParent->getBottomSegmentIterator();
for (; (hal_size_t)inTop->getArrayIndex() < n; inTop->toRight(),
outTop->toRight())
{
hal_index_t genomePos = inTop->getStartPosition();
assert(genomePos != NULL_INDEX);
string inSeqName = getSequenceBySite(genomePos)->getName();
string outSeqName = dest->getSequenceBySite(genomePos)->getName();
// if (inSeqName != outSeqName) {
// stringstream ss;
// ss << "When copying top segments from " << getName() << " to " << dest->getName() << ": sequence " << inSeqName << " != " << outSeqName << " at site " << genomePos;
// throw hal_exception(ss.str());
// }
outTop->setCoordinates(inTop->getStartPosition(), inTop->getLength());
outTop->setParentIndex(inTop->getParentIndex());
outTop->setParentReversed(inTop->getParentReversed());
outTop->setBottomParseIndex(inTop->getBottomParseIndex());
outTop->setNextParalogyIndex(inTop->getNextParalogyIndex());
// Check that the sequences from the bottom segments we point to are the same. If not, correct the indices so that they are.
if (inTop->getParentIndex() != NULL_INDEX) {
inParentBottomSegIt->toParent(inTop);
const Sequence *inParentSequence = inParentBottomSegIt->getSequence();
const Sequence *outParentSequence = outParent->getSequence(inParentSequence->getName());
hal_index_t inParentSegmentOffset = inTop->getParentIndex() - inParentSequence->getBottomSegmentArrayIndex();
hal_index_t outParentSegmentIndex = inParentSegmentOffset + outParentSequence->getBottomSegmentArrayIndex();
outTop->setParentIndex(outParentSegmentIndex);
}
}
}