本文整理汇总了C++中TopSegmentIteratorConstPtr类的典型用法代码示例。如果您正苦于以下问题:C++ TopSegmentIteratorConstPtr类的具体用法?C++ TopSegmentIteratorConstPtr怎么用?C++ TopSegmentIteratorConstPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TopSegmentIteratorConstPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resetStatus
void DefaultRearrangement::resetStatus(TopSegmentIteratorConstPtr topSegment)
{
_id = Invalid;
assert(topSegment.get());
_genome = topSegment->getTopSegment()->getGenome();
_parent = _genome->getParent();
assert(_parent != NULL);
_cur->setLeft(topSegment);
_next->copy(_cur);
_left->copy(_cur);
_right->copy(_left);
assert(_cur->getGapThreshold() == _gapThreshold);
assert(_next->getGapThreshold() == _gapThreshold);
assert(_left->getGapThreshold() == _gapThreshold);
assert(_right->getGapThreshold() == _gapThreshold);
assert(_leftParent->getGapThreshold() == _gapThreshold);
assert(_rightParent->getGapThreshold() == _gapThreshold);
assert(_curParent->getGapThreshold() == _gapThreshold);
assert(_cur->getAtomic() == _atomic);
assert(_next->getAtomic() == _atomic);
assert(_left->getAtomic() == _atomic);
assert(_right->getAtomic() == _atomic);
assert(_leftParent->getAtomic() == _atomic);
assert(_rightParent->getAtomic() == _atomic);
assert(_curParent->getAtomic() == _atomic);
}
示例2: validateAlignment
void MappedSegmentMapUpTest::checkCallBack(AlignmentConstPtr alignment)
{
validateAlignment(alignment);
const Genome* child1 = alignment->openGenome("child1");
const Genome* child2 = alignment->openGenome("child2");
TopSegmentIteratorConstPtr top = child2->getTopSegmentIterator();
testTopSegment(alignment, top, "parent");
top->slice(1,2);
testTopSegment(alignment, top, "parent");
top->toReverse();
testTopSegment(alignment, top, "parent");
top = child1->getTopSegmentIterator();
testTopSegment(alignment, top, "parent");
top->slice(1,2);
testTopSegment(alignment, top, "parent");
top->toReverse();
testTopSegment(alignment, top, "parent");
const Genome* g1 = alignment->openGenome("g1");
for (hal_size_t i = 0; i < g1->getNumTopSegments(); ++i)
{
top = g1->getTopSegmentIterator(i);
testTopSegment(alignment, top, "parent");
top->slice(1,0);
testTopSegment(alignment, top, "parent");
top->toReverse();
testTopSegment(alignment, top, "parent");
top->slice(0,1);
testTopSegment(alignment, top, "parent");
top->toReverse();
testTopSegment(alignment, top, "parent");
}
}
示例3: assert
void SummarizeMutations::subsAndGapInserts(
GappedTopSegmentIteratorConstPtr gappedTop, MutationsStats& stats)
{
assert(gappedTop->getReversed() == false);
hal_size_t numGaps = gappedTop->getNumGaps();
if (numGaps > 0)
{
stats._gapInsertionLength.add(gappedTop->getNumGapBases(), numGaps);
}
string parent, child;
TopSegmentIteratorConstPtr l = gappedTop->getLeft();
TopSegmentIteratorConstPtr r = gappedTop->getRight();
BottomSegmentIteratorConstPtr p =
l->getTopSegment()->getGenome()->getParent()->getBottomSegmentIterator();
for (TopSegmentIteratorConstPtr i = l->copy();
i->getTopSegment()->getArrayIndex() <=
r->getTopSegment()->getArrayIndex();
i->toRight())
{
if (i->hasParent())
{
p->toParent(i);
i->getString(child);
p->getString(parent);
assert(child.length() == parent.length());
for (size_t j = 0; j < child.length(); ++j)
{
if (isTransition(child[j], parent[j]))
{
++stats._transitions;
++stats._subs;
}
else if (isTransversion(child[j], parent[j]))
{
++stats._transversions;
++stats._subs;
}
else if (isSubstitution(child[j], parent[j]))
{
++stats._subs;
}
else if (!isMissingData(child[j]) && !isMissingData(parent[j]))
{
++stats._matches;
}
}
}
}
}
示例4: scanTranslocationCycle
// If true, _leftParent will store the swapped segment (and _cur will store)
// the other half
// NEED TO REVISE WITH STRONGER CRITERIA -- right now any operation
// next to an endpoint can get confused with a translocation.
bool DefaultRearrangement::scanTranslocationCycle(
TopSegmentIteratorConstPtr topSegment)
{
assert(topSegment.get());
resetStatus(topSegment);
bool first = _cur->isFirst();
bool last = _cur->isLast();
if (_cur->hasParent() == false || (!first && !last))
{
return false;
}
_leftParent->toParent(_cur);
bool pFirst = _leftParent->isFirst();
//bool pLast = _leftParent->isLast();
_rightParent->copy(_leftParent);
first ? _right->toRight() : _right->toLeft();
pFirst ? _rightParent->toRight() : _rightParent->toLeft();
if (_right->hasParent() == false)
{
return true;
}
else
{
_curParent->toParent(_right);
return _curParent->equals(_rightParent);
}
return false;
}
示例5: checkGenome
void TopSegmentIteratorToSiteTest::checkGenome(const Genome* genome)
{
TopSegmentIteratorConstPtr ti = genome->getTopSegmentIterator();
for (hal_index_t pos = 0;
pos < (hal_index_t)genome->getSequenceLength(); ++pos)
{
ti->toSite(pos);
CuAssertTrue(_testCase, ti->getStartPosition() == pos);
CuAssertTrue(_testCase, ti->getLength() == 1);
ti->toSite(pos, false);
CuAssertTrue(_testCase, pos >= ti->getStartPosition() &&
pos < ti->getStartPosition() + (hal_index_t)ti->getLength());
CuAssertTrue(_testCase,
ti->getLength() == ti->getTopSegment()->getLength());
}
}
示例6: scanDuplicationCycle
// leaves duplication on _cur and _right
bool DefaultRearrangement::scanDuplicationCycle(
TopSegmentIteratorConstPtr topSegment)
{
assert(topSegment.get());
resetStatus(topSegment);
return _cur->hasNextParalogy() == true &&
_cur->isCanonicalParalog() == false;
}
示例7: testTopSegment
void MappedSegmentParseTest::testTopSegment(AlignmentConstPtr alignment,
TopSegmentIteratorConstPtr top)
{
const Genome* parent = alignment->openGenome("parent");
set<MappedSegmentConstPtr> results;
top->getMappedSegments(results, parent, NULL, false);
vector<bool> covered(top->getLength(), false);
CuAssertTrue(_testCase, results.size() >= 1);
set<MappedSegmentConstPtr>::iterator i = results.begin();
for (; i != results.end(); ++i)
{
MappedSegmentConstPtr mseg = *i;
CuAssertTrue(_testCase, mseg->getSource()->getGenome() == top->getGenome());
CuAssertTrue(_testCase, mseg->getGenome() == parent);
for (hal_index_t j = mseg->getStartPosition(); j <= mseg->getEndPosition();
++j)
{
CuAssertTrue(_testCase, covered[j] == false);
covered[j] = true;
}
CuAssertTrue(_testCase, mseg->getStartPosition() ==
mseg->getSource()->getStartPosition());
CuAssertTrue(_testCase, mseg->getEndPosition() ==
mseg->getSource()->getEndPosition());
set<MappedSegmentConstPtr> tResults;
mseg->getMappedSegments(tResults, top->getGenome(), NULL, false);
CuAssertTrue(_testCase, tResults.size() == 1);
MappedSegmentConstPtr tmseg = *tResults.begin();
CuAssertTrue(_testCase, tmseg->getGenome() == top->getGenome());
CuAssertTrue(_testCase, tmseg->getSource()->getGenome() ==
mseg->getGenome());
CuAssertTrue(_testCase, tmseg->getStartPosition() ==
mseg->getStartPosition());
CuAssertTrue(_testCase, tmseg->getEndPosition() ==
mseg->getEndPosition());
CuAssertTrue(_testCase, tmseg->getSource()->getStartPosition() ==
mseg->getStartPosition());
CuAssertTrue(_testCase, tmseg->getSource()->getEndPosition() ==
mseg->getEndPosition());
}
}
示例8: CuAssertTrue
void MappedSegmentMapUpTest::testTopSegment(AlignmentConstPtr alignment,
TopSegmentIteratorConstPtr top,
const string& ancName)
{
const Genome* parent = alignment->openGenome(ancName);
set<MappedSegmentConstPtr> results;
top->getMappedSegments(results, parent, NULL, false);
CuAssertTrue(_testCase, results.size() == 1);
MappedSegmentConstPtr mseg = *results.begin();
CuAssertTrue(_testCase, mseg->getSource()->getGenome() == top->getGenome());
CuAssertTrue(_testCase, mseg->getSource()->getStartPosition() ==
top->getStartPosition());
CuAssertTrue(_testCase,
mseg->getSource()->getLength() == top->getLength());
CuAssertTrue(_testCase,
mseg->getSource()->getReversed() == top->getReversed());
BottomSegmentIteratorConstPtr bottom = parent->getBottomSegmentIterator();
bottom->toParent(top);
// extra hop for when top is in grand child
if (bottom->getGenome() != parent)
{
TopSegmentIteratorConstPtr temp =
bottom->getGenome()->getTopSegmentIterator();
temp->toParseUp(bottom);
bottom->toParent(temp);
}
CuAssertTrue(_testCase, mseg->getGenome() == bottom->getGenome());
CuAssertTrue(_testCase,
mseg->getStartPosition() == bottom->getStartPosition());
CuAssertTrue(_testCase,
mseg->getLength() == bottom->getLength());
CuAssertTrue(_testCase,
mseg->getReversed() == bottom->getReversed());
}
示例9: compareTo
void TopSegmentStruct::compareTo(TopSegmentIteratorConstPtr it,
CuTest* testCase) const
{
const TopSegment* seg = it->getTopSegment();
CuAssertTrue(testCase, _length == seg->getLength());
CuAssertTrue(testCase, _startPosition == seg->getStartPosition());
CuAssertTrue(testCase, _nextParalogyIndex == seg->getNextParalogyIndex());
CuAssertTrue(testCase, _parentIndex == seg->getParentIndex());
CuAssertTrue(testCase, _bottomParseIndex == seg->getBottomParseIndex());
}
示例10: identifyInsertionFromLeftBreakpoint
bool DefaultRearrangement::identifyInsertionFromLeftBreakpoint(
TopSegmentIteratorConstPtr topSegment)
{
assert(topSegment->getReversed() == false);
if (scanInsertionCycle(topSegment) == true &&
_cur->hasParent() == false)
{
_id = Insertion;
return true;
}
_id = Invalid;
return false;
}
示例11: checkCallBack
void TopSegmentSequenceTest::checkCallBack(AlignmentConstPtr alignment)
{
const Genome* ancGenome = alignment->openGenome("Anc0");
TopSegmentIteratorConstPtr tsIt = ancGenome->getTopSegmentIterator(100);
CuAssertTrue(_testCase, tsIt->getTopSegment()->getStartPosition() == 500);
CuAssertTrue(_testCase, tsIt->getTopSegment()->getLength() == 9);
string seq;
tsIt->getString(seq);
CuAssertTrue(_testCase, seq == "CACACATTC");
tsIt->toReverse();
tsIt->getString(seq);
CuAssertTrue(_testCase, seq == "GAATGTGTG");
}
示例12: toRightNextUngapped
void DefaultGappedBottomSegmentIterator::toRightNextUngapped(
TopSegmentIteratorConstPtr ts) const
{
while (ts->hasParent() == false &&
ts->getLength() <= _gapThreshold)
{
if ((!ts->getReversed() && ts->getTopSegment()->isLast()) ||
(ts->getReversed() && ts->getTopSegment()->isFirst()))
{
break;
}
ts->toRight();
}
}
示例13: scanInversionCycle
// Segment is an inverted descendant of another Segment but
// otherwise no rearrangement.
bool DefaultRearrangement::scanInversionCycle(
TopSegmentIteratorConstPtr topSegment)
{
assert(topSegment.get());
resetStatus(topSegment);
bool first = _cur->isFirst();
bool last = _cur->isLast();
if (_cur->hasParent() == false)
{
return false;
}
_curParent->toParent(_cur);
if (first == false)
{
_left->toLeft();
if (_left->hasParent() == false)
{
return false;
}
_leftParent->toParent(_left);
if (_leftParent->adjacentTo(_curParent) == false)
{
return false;
}
}
if (last == false)
{
_right->toRight();
if (_right->hasParent() == false)
{
return false;
}
_rightParent->toParent(_right);
if (_rightParent->adjacentTo(_curParent) == false)
{
return false;
}
}
return _cur->getParentReversed();
}
示例14: scanNothingCycle
// Segment corresponds to no rearrangemnt. This will happen when
// there is a rearrangement in the homolgous segment in its sibling
// genome. In general, we can expect about half of segments to correspond
// to such cases.
bool DefaultRearrangement::scanNothingCycle(
TopSegmentIteratorConstPtr topSegment)
{
assert(topSegment.get());
resetStatus(topSegment);
bool first = _cur->isFirst();
bool last = _cur->isLast();
if (_cur->hasParent() == false)
{
return false;
}
_curParent->toParent(_cur);
if (first == false)
{
_left->toLeft();
if (_left->hasParent() == false)
{
return false;
}
_leftParent->toParent(_left);
if (_leftParent->adjacentTo(_curParent) == false)
{
return false;
}
if (_left->getParentReversed() == true)
{
if (_cur->getParentReversed() == false ||
_leftParent->rightOf(_curParent->getStartPosition()) == false)
{
return false;
}
}
else
{
if (_cur->getParentReversed() == true ||
_leftParent->leftOf(_curParent->getStartPosition()) == false)
{
return false;
}
}
}
if (last == false)
{
_right->toRight();
if (_right->hasParent() == false)
{
return false;
}
_rightParent->toParent(_right);
if (_rightParent->adjacentTo(_curParent) == false)
{
return false;
}
if (_right->getParentReversed() == true)
{
if (_cur->getParentReversed() == false ||
_rightParent->leftOf(_curParent->getStartPosition()) == false)
{
return false;
}
}
else
{
if (_cur->getParentReversed() == true ||
_rightParent->rightOf(_curParent->getStartPosition()) == false)
{
return false;
}
}
}
return last && first ? _cur->getParentReversed() : true;
}
示例15: validateDuplications
void hal::validateDuplications(const Genome* genome)
{
const Genome* parent = genome->getParent();
if (parent == NULL)
{
return;
}
TopSegmentIteratorConstPtr topIt = genome->getTopSegmentIterator();
TopSegmentIteratorConstPtr endIt = genome->getTopSegmentEndIterator();
vector<unsigned char> pcount(parent->getNumBottomSegments(), 0);
for (; topIt != endIt; topIt->toRight())
{
if (topIt->hasParent())
{
if (pcount[topIt->getTopSegment()->getParentIndex()] < 250)
{
++pcount[topIt->getTopSegment()->getParentIndex()];
}
}
}
for (topIt = genome->getTopSegmentIterator(); topIt != endIt; topIt->toRight())
{
if (topIt->hasParent())
{
size_t count = pcount[topIt->getTopSegment()->getParentIndex()];
assert(count > 0);
{
if (topIt->hasNextParalogy() == false && count > 1)
{
stringstream ss;
ss << "Top Segment " << topIt->getTopSegment()->getArrayIndex()
<< " in genome " << genome->getName() << " is not marked as a"
<< " duplication but it shares its parent "
<< topIt->getTopSegment()->getArrayIndex() << " with at least "
<< count - 1 << " other segments in the same genome";
throw hal_exception(ss.str());
}
}
}
}
}