本文整理汇总了C++中BottomSegmentIteratorPtr::setChildReversed方法的典型用法代码示例。如果您正苦于以下问题:C++ BottomSegmentIteratorPtr::setChildReversed方法的具体用法?C++ BottomSegmentIteratorPtr::setChildReversed怎么用?C++ BottomSegmentIteratorPtr::setChildReversed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BottomSegmentIteratorPtr
的用法示例。
在下文中一共展示了BottomSegmentIteratorPtr::setChildReversed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeUnsampledSequence
void LodExtract::writeUnsampledSequence(const Sequence* outSequence,
SegmentIteratorPtr outSegment)
{
outSegment->setCoordinates(outSequence->getStartPosition(),
outSequence->getSequenceLength());
if (outSegment->isTop())
{
assert(outSequence->getNumTopSegments() == 1);
TopSegmentIteratorPtr top = outSegment.downCast<TopSegmentIteratorPtr>();
top->setParentIndex(NULL_INDEX);
top->setParentReversed(false);
top->setNextParalogyIndex(NULL_INDEX);
top->setBottomParseIndex(NULL_INDEX);
}
else
{
assert(outSequence->getNumBottomSegments() == 1);
BottomSegmentIteratorPtr bottom =
outSegment.downCast<BottomSegmentIteratorPtr>();
hal_size_t numChildren = bottom->getNumChildren();
for (hal_size_t childNum = 0; childNum < numChildren; ++childNum)
{
bottom->setChildIndex(childNum, NULL_INDEX);
bottom->setChildReversed(childNum, false);
}
bottom->setTopParseIndex(NULL_INDEX);
}
}
示例2: updateBlockEdges
void LodExtract::updateBlockEdges(const Genome* inParentGenome,
SegmentMap& segMap,
const LodBlock* block,
BottomSegmentIteratorPtr bottom,
TopSegmentIteratorPtr top)
{
Genome* outParentGenome = bottom->getGenome();
const LodSegment* rootSeg = NULL;
SegmentSet* segSet;
SegmentSet::iterator setIt;
// Zap all segments in parent genome
SegmentMap::iterator mapIt = segMap.find(inParentGenome);
if (mapIt != segMap.end())
{
segSet = mapIt->second;
assert(segSet != NULL);
setIt = segSet->begin();
for (; setIt != segSet->end(); ++setIt)
{
bottom->setArrayIndex(outParentGenome, (*setIt)->getArrayIndex());
for (hal_size_t i = 0; i < bottom->getNumChildren(); ++i)
{
bottom->setChildIndex(i, NULL_INDEX);
bottom->setTopParseIndex(NULL_INDEX);
}
}
// Choose first segment as parent to all segments in the child genome
setIt = segSet->begin();
rootSeg = *(setIt);
bottom->setArrayIndex(outParentGenome, (*setIt)->getArrayIndex());
}
// Do the child genomes
const Genome* inGrandParentGenome = inParentGenome->getParent();
SegmentSet::iterator nextIt;
for (mapIt = segMap.begin(); mapIt != segMap.end(); ++mapIt)
{
if (mapIt->first != inParentGenome and mapIt->first != inGrandParentGenome)
{
Genome* outChildGenome =
_outAlignment->openGenome(mapIt->first->getName());
hal_index_t childIndex = outParentGenome->getChildIndex(outChildGenome);
assert(childIndex >= 0);
segSet = mapIt->second;
assert(segSet != NULL);
for (setIt = segSet->begin(); setIt != segSet->end(); ++setIt)
{
top->setArrayIndex(outChildGenome, (*setIt)->getArrayIndex());
top->setBottomParseIndex(NULL_INDEX);
// Connect to parent
if (rootSeg != NULL)
{
top->setParentIndex(bottom->getArrayIndex());
bool reversed = (*setIt)->getFlipped() != rootSeg->getFlipped();
top->setParentReversed(reversed);
if (setIt == segSet->begin())
{
bottom->setChildIndex(childIndex, top->getArrayIndex());
bottom->setChildReversed(childIndex, reversed);
}
}
else
{
top->setParentIndex(NULL_INDEX);
}
// Connect to next paralogy
SegmentSet::iterator setNext = setIt;
++setNext;
if (setNext == segSet->end())
{
setNext = segSet->begin();
}
if (setNext == setIt)
{
top->setNextParalogyIndex(NULL_INDEX);
}
else
{
top->setNextParalogyIndex((*setNext)->getArrayIndex());
}
}
}
}
}
示例3: copyBottomSegments
void Genome::copyBottomSegments(Genome *dest) const
{
assert(getNumBottomSegments() == dest->getNumBottomSegments());
hal_size_t inNc = getNumChildren();
hal_size_t outNc = dest->getNumChildren();
// The child indices aren't consistent across files--make sure each bottom
// segment points to the correct children
vector<string> inChildNames;
vector<string> outChildNames;
for (hal_size_t inChild = 0; inChild < inNc; ++inChild)
{
inChildNames.push_back(getChild(inChild)->getName());
}
for (hal_size_t outChild = 0; outChild < outNc; ++outChild)
{
outChildNames.push_back(dest->getChild(outChild)->getName());
}
map<hal_size_t, hal_size_t> inChildToOutChild;
for (hal_size_t inChild = 0; inChild < inNc; inChild++)
{
hal_size_t outChild;
for (outChild = 0; outChild < outNc; outChild++)
{
if (inChildNames[inChild] == outChildNames[outChild])
{
inChildToOutChild[inChild] = outChild;
break;
}
}
if (outChild == outNc)
{
inChildToOutChild[inChild] = outNc;
}
}
// Go through each sequence in this genome, find the matching
// sequence in the dest genome, then copy over the segments for each
// sequence.
SequenceIteratorConstPtr seqIt = getSequenceIterator();
SequenceIteratorConstPtr seqEndIt = getSequenceEndIterator();
for (; seqIt != seqEndIt; seqIt->toNext())
{
const Sequence *inSeq = seqIt->getSequence();
const Sequence *outSeq = dest->getSequence(inSeq->getName());
BottomSegmentIteratorPtr inBot = inSeq->getBottomSegmentIterator();
BottomSegmentIteratorPtr outBot = outSeq->getBottomSegmentIterator();
cout << "DEBUG: inSeq name: " << inSeq->getName() << ", outSeq name: " << outSeq->getName() << endl;
if (inSeq->getName() != outSeq->getName()) {
// This check is important enough that it can't be an assert.
stringstream ss;
ss << "When copying bottom segments: segment #" << inBot->getArrayIndex() << " of source genome is from sequence " << inBot->getSequence()->getName() << ", but segment #" << outBot->getArrayIndex() << " is from sequence " << outBot->getSequence()->getName();
throw hal_exception(ss.str());
}
if (inSeq->getNumBottomSegments() != outSeq->getNumBottomSegments()) {
stringstream ss;
ss << "When copying bottom segments: sequence " << inSeq->getName() << " has " << inSeq->getNumBottomSegments() << " in genome " << getName() << ", while it has " << outSeq->getNumBottomSegments() << " in genome " << dest->getName();
throw hal_exception(ss.str());
}
hal_index_t inSegmentEnd = inSeq->getBottomSegmentArrayIndex() + inSeq->getNumBottomSegments();
cout << "DEBUG: inSegmentStart: " << inSeq->getBottomSegmentArrayIndex() << " inSegmentEnd: " << inSegmentEnd << " num bottom segments: " << inSeq->getNumBottomSegments() << endl;
for (; inBot->getArrayIndex() < inSegmentEnd; inBot->toRight(),
outBot->toRight())
{
hal_index_t outStartPosition = inBot->getStartPosition() - inSeq->getStartPosition() + outSeq->getStartPosition();
cout << "Decided on outStartPosition " << outStartPosition << " for seg index " << outBot->getArrayIndex() << " (src index " << inBot->getArrayIndex() << ")" << endl;
if (dest->getSequenceBySite(outStartPosition) != outSeq) {
stringstream ss;
ss << "When copying bottom segments from " << getName() << " to " << dest->getName() << ": expected destination sequence " << outSeq->getName() << " for segment # " << inBot->getArrayIndex() << " but got " << dest->getSequenceBySite(outStartPosition)->getName();
throw hal_exception(ss.str());
}
outBot->setCoordinates(outStartPosition, inBot->getLength());
for(hal_size_t inChild = 0; inChild < inNc; inChild++) {
hal_size_t outChild = inChildToOutChild[inChild];
if (outChild != outNc) {
outBot->setChildIndex(outChild, inBot->getChildIndex(inChild));
cout << "genome " << getName() << ": Set child index " << inChild << " to " << inBot->getChildIndex(inChild) << endl;
outBot->setChildReversed(outChild, inBot->getChildReversed(inChild));
}
}
outBot->setTopParseIndex(inBot->getTopParseIndex());
}
}
}