本文整理汇总了C++中TopSegmentIteratorConstPtr类的典型用法代码示例。如果您正苦于以下问题:C++ TopSegmentIteratorConstPtr类的具体用法?C++ TopSegmentIteratorConstPtr怎么用?C++ TopSegmentIteratorConstPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TopSegmentIteratorConstPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:ifiddes,项目名称:hal,代码行数:27,代码来源:defaultRearrangement.cpp
示例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");
}
}
开发者ID:dayin1989,项目名称:hal,代码行数:33,代码来源:halMappedSegmentTest.cpp
示例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;
}
}
}
}
}
开发者ID:BioinformaticsArchive,项目名称:hal,代码行数:51,代码来源:halSummarizeMutations.cpp
示例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;
}
开发者ID:ifiddes,项目名称:hal,代码行数:35,代码来源:defaultRearrangement.cpp
示例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());
}
}
开发者ID:BioinformaticsArchive,项目名称:hal,代码行数:16,代码来源:halTopSegmentTest.cpp
示例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;
}
开发者ID:ifiddes,项目名称:hal,代码行数:9,代码来源:defaultRearrangement.cpp
示例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());
}
}
开发者ID:dayin1989,项目名称:hal,代码行数:45,代码来源:halMappedSegmentTest.cpp
示例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());
}
开发者ID:dayin1989,项目名称:hal,代码行数:34,代码来源:halMappedSegmentTest.cpp
示例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());
}
开发者ID:BioinformaticsArchive,项目名称:hal,代码行数:10,代码来源:halTopSegmentTest.cpp
示例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;
}
开发者ID:ifiddes,项目名称:hal,代码行数:13,代码来源:defaultRearrangement.cpp
示例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");
}
开发者ID:BioinformaticsArchive,项目名称:hal,代码行数:13,代码来源:halTopSegmentTest.cpp
示例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();
}
}
开发者ID:BioinformaticsArchive,项目名称:hal,代码行数:14,代码来源:defaultGappedBottomSegmentIterator.cpp
示例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();
}
开发者ID:ifiddes,项目名称:hal,代码行数:43,代码来源:defaultRearrangement.cpp
示例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;
}
开发者ID:ifiddes,项目名称:hal,代码行数:77,代码来源:defaultRearrangement.cpp
示例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());
}
}
}
}
}
开发者ID:BioinformaticsArchive,项目名称:hal,代码行数:41,代码来源:halValidate.cpp
示例16: hal_exception
void hal::validateTopSegment(const TopSegment* topSegment)
{
const Genome* genome = topSegment->getGenome();
hal_index_t index = topSegment->getArrayIndex();
if (index < 0 || index >= (hal_index_t)genome->getSequenceLength())
{
stringstream ss;
ss << "Segment out of range " << index << " in genome "
<< genome->getName();
throw hal_exception(ss.str());
}
if (topSegment->getLength() < 1)
{
stringstream ss;
ss << "Top segment " << index << " in genome " << genome->getName()
<< " has length 0 which is not currently supported";
throw hal_exception(ss.str());
}
const Genome* parentGenome = genome->getParent();
const hal_index_t parentIndex = topSegment->getParentIndex();
if (parentGenome != NULL && parentIndex != NULL_INDEX)
{
if (parentIndex >= (hal_index_t)parentGenome->getNumBottomSegments())
{
stringstream ss;
ss << "Parent index " << parentIndex << " of segment "
<< topSegment->getArrayIndex() << " out of range in genome "
<< parentGenome->getName();
throw hal_exception(ss.str());
}
BottomSegmentIteratorConstPtr bottomSegmentIterator =
parentGenome->getBottomSegmentIterator(parentIndex);
const BottomSegment* parentSegment =
bottomSegmentIterator->getBottomSegment();
if (topSegment->getLength() != parentSegment->getLength())
{
stringstream ss;
ss << "Parent length of segment " << topSegment->getArrayIndex()
<< " in genome " << genome->getName() << " has length "
<< parentSegment->getLength() << " which does not match "
<< topSegment->getLength();
throw hal_exception(ss.str());
}
}
const hal_index_t parseIndex = topSegment->getBottomParseIndex();
if (parseIndex == NULL_INDEX)
{
if (genome->getNumChildren() != 0)
{
stringstream ss;
ss << "Top Segment " << topSegment->getArrayIndex() << " in genome "
<< genome->getName() << " has null parse index";
throw hal_exception(ss.str());
}
}
else
{
if (parseIndex >= (hal_index_t)genome->getNumBottomSegments())
{
stringstream ss;
ss << "Top Segment " << topSegment->getArrayIndex() << " in genome "
<< genome->getName() << " has parse index out of range";
throw hal_exception(ss.str());
}
hal_offset_t parseOffset = topSegment->getBottomParseOffset();
BottomSegmentIteratorConstPtr bottomSegmentIterator =
genome->getBottomSegmentIterator(parseIndex);
const BottomSegment* parseSegment =
bottomSegmentIterator->getBottomSegment();
if (parseOffset >= parseSegment->getLength())
{
stringstream ss;
ss << "Top Segment " << topSegment->getArrayIndex() << " in genome "
<< genome->getName() << " has parse offset out of range";
throw hal_exception(ss.str());
}
if ((hal_index_t)parseOffset + parseSegment->getStartPosition() !=
topSegment->getStartPosition())
{
throw hal_exception("parse index broken in top segment in genome " +
genome->getName());
}
}
const hal_index_t paralogyIndex = topSegment->getNextParalogyIndex();
if (paralogyIndex != NULL_INDEX)
{
TopSegmentIteratorConstPtr pti =
genome->getTopSegmentIterator(paralogyIndex);
if (pti->getTopSegment()->getParentIndex() != topSegment->getParentIndex())
{
stringstream ss;
ss << "Top segment " << topSegment->getArrayIndex()
<< " has parent index "
<< topSegment->getParentIndex() << ", but next paraglog "
<< topSegment->getNextParalogyIndex() << " has parent Index "
//.........这里部分代码省略.........
开发者ID:BioinformaticsArchive,项目名称:hal,代码行数:101,代码来源:halValidate.cpp
示例17: CuAssertTrue
void
GappedSegmentIteratorIndelTest::checkCallBack(AlignmentConstPtr alignment)
{
const Genome* child = alignment->openGenome("child");
const Genome* parent = alignment->openGenome("parent");
GappedTopSegmentIteratorConstPtr gtsIt =
child->getGappedTopSegmentIterator(0, 9999999);
GappedBottomSegmentIteratorConstPtr gbsIt =
parent->getGappedBottomSegmentIterator(0, 0, 9999999);
GappedTopSegmentIteratorConstPtr gtsItRev =
child->getGappedTopSegmentIterator(0, 9999999);
gtsItRev->toReverse();
GappedBottomSegmentIteratorConstPtr gbsItRev =
parent->getGappedBottomSegmentIterator(0, 0, 9999999);
gbsItRev->toReverse();
for (size_t i = 0; i < child->getNumTopSegments(); i += 20)
{
TopSegmentIteratorConstPtr tsIt = gtsIt->getLeft();
CuAssertTrue(_testCase,
(size_t)tsIt->getTopSegment()->getArrayIndex() == i);
tsIt = gtsIt->getRight();
CuAssertTrue(_testCase,
(size_t)tsIt->getTopSegment()->getArrayIndex() == i + 19);
BottomSegmentIteratorConstPtr bsIt = gbsIt->getLeft();
CuAssertTrue(_testCase,
(size_t)bsIt->getBottomSegment()->getArrayIndex() == i);
bsIt = gbsIt->getRight();
CuAssertTrue(_testCase,
(size_t)bsIt->getBottomSegment()->getArrayIndex() == i + 19);
GappedBottomSegmentIteratorConstPtr gappedParent = gbsIt->copy();
gappedParent->toParent(gtsIt);
if (gappedParent->getReversed())
{
gappedParent->toReverse();
}
CuAssertTrue(_testCase,
gappedParent->equals(gbsIt));
GappedTopSegmentIteratorConstPtr gappedChild = gtsIt->copy();
gappedChild->toChild(gbsIt);
if (gappedChild->getReversed())
{
gappedChild->toReverse();
}
CuAssertTrue(_testCase, gappedChild->equals(gtsIt));
gtsIt->toRight();
gbsIt->toRight();
TopSegmentIteratorConstPtr tsItRev = gtsItRev->getLeft();
CuAssertTrue(_testCase,
(size_t)tsItRev->getTopSegment()->getArrayIndex() == i + 19);
tsItRev = gtsItRev->getRight();
CuAssertTrue(_testCase,
(size_t)tsItRev->getTopSegment()->getArrayIndex() == i);
gtsItRev->toLeft();
BottomSegmentIteratorConstPtr bsItRev = gbsItRev->getLeft();
CuAssertTrue(_testCase,
(size_t)bsItRev->getBottomSegment()->getArrayIndex() == i+19);
bsItRev = gbsItRev->getRight();
CuAssertTrue(_testCase,
(size_t)bsItRev->getBottomSegment()->getArrayIndex() == i);
gbsItRev->toLeft();
}
gtsIt = child->getGappedTopSegmentIterator(
child->getNumTopSegments() - 20, 9999999);
gbsIt = parent->getGappedBottomSegmentIterator(
child->getNumTopSegments() - 20, 0, 9999999);
gtsItRev = child->getGappedTopSegmentIterator(
child->getNumTopSegments() - 20, 9999999);
gtsItRev->toReverse();
gbsItRev = parent->getGappedBottomSegmentIterator(
child->getNumTopSegments() - 20, 0, 9999999);
gbsItRev->toReverse();
for (hal_index_t i = child->getNumTopSegments() - 1; i >= 0; i -= 20)
{
TopSegmentIteratorConstPtr tsIt = gtsIt->getLeft();
CuAssertTrue(_testCase, tsIt->getTopSegment()->getArrayIndex() == i - 19);
tsIt = gtsIt->getRight();
CuAssertTrue(_testCase, tsIt->getTopSegment()->getArrayIndex() == i);
CuAssertTrue(_testCase, gtsIt->getReversed() == false);
gtsIt->toLeft();
BottomSegmentIteratorConstPtr bsIt = gbsIt->getLeft();
CuAssertTrue(_testCase, bsIt->getBottomSegment()->getArrayIndex() == i-19);
bsIt = gbsIt->getRight();
CuAssertTrue(_testCase, bsIt->getBottomSegment()->getArrayIndex() == i);
CuAssertTrue(_testCase, gbsIt->getReversed() == false);
gbsIt->toLeft();
TopSegmentIteratorConstPtr tsItRev = gtsItRev->getLeft();
//.........这里部分代码省略.........
开发者ID:BioinformaticsArchive,项目名称:hal,代码行数:101,代码来源:halGappedSegmentIteratorTest.cpp
示例18: CuAssertTrue
void TopSegmentSimpleIteratorTest::checkCallBack(AlignmentConstPtr alignment)
{
const Genome* ancGenome = alignment->openGenome("Anc0");
CuAssertTrue(_testCase,
ancGenome->getNumTopSegments() == _topSegments.size());
TopSegmentIteratorConstPtr tsIt = ancGenome->getTopSegmentIterator(0);
for (size_t i = 0; i < ancGenome->getNumTopSegments(); ++i)
{
CuAssertTrue(_testCase,
(size_t)tsIt->getTopSegment()->getArrayIndex() == i);
_topSegments[i].compareTo(tsIt, _testCase);
tsIt->toRight();
}
tsIt = ancGenome->getTopSegmentIterator(
ancGenome->getNumTopSegments() - 1);
for (hal_index_t i = ancGenome->getNumTopSegments() - 1; i >= 0; --i)
{
CuAssertTrue(_testCase, tsIt->getTopSegment()->getArrayIndex() == i);
_topSegments[i].compareTo(tsIt, _testCase);
tsIt->toLeft();
}
tsIt = ancGenome->getTopSegmentIterator(0);
tsIt->slice(0, tsIt->getLength() - 1);
for (hal_index_t i = 0; i < (hal_index_t)ancGenome->getSequenceLength(); ++i)
{
CuAssertTrue(_testCase, tsIt->getLength() == 1);
CuAssertTrue(_testCase, tsIt->getStartPosition() == i);
tsIt->toRight(tsIt->getStartPosition() + 1);
}
tsIt = ancGenome->getTopSegmentIterator(
ancGenome->getNumTopSegments() - 1);
tsIt->slice(tsIt->getLength() - 1, 0);
for (hal_index_t i = ancGenome->getSequenceLength() - 1; i >= 0; --i)
{
CuAssertTrue(_testCase, tsIt->getLength() == 1);
CuAssertTrue(_testCase, tsIt->getStartPosition() == i);
tsIt->toLeft(tsIt->getStartPosition() - 1);
}
tsIt = ancGenome->getTopSegmentIterator(0);
tsIt->toReverse();
CuAssertTrue(_testCase, tsIt->getReversed() == true);
tsIt->slice(tsIt->getLength() - 1, 0);
for (hal_index_t i = 0; i < (hal_index_t)ancGenome->getSequenceLength(); ++i)
{
CuAssertTrue(_testCase, tsIt->getLength() == 1);
CuAssertTrue(_testCase, tsIt->getStartPosition() == i);
tsIt->toLeft(tsIt->getStartPosition() + 1);
}
tsIt = ancGenome->getTopSegmentIterator(
ancGenome->getNumTopSegments() - 1);
tsIt->toReverse();
tsIt->slice(0, tsIt->getLength() - 1);
for (hal_index_t i = ancGenome->getSequenceLength() - 1; i >= 0; --i)
{
CuAssertTrue(_testCase, tsIt->getLength() == 1);
CuAssertTrue(_testCase, tsIt->getStartPosition() == i);
tsIt->toRight(tsIt->getStartPosition() - 1);
}
}
开发者ID:BioinformaticsArchive,项目名称:hal,代码行数:61,代码来源:halTopSegmentTest.cpp
示例19: scanInsertionCycle
// If true, _cur will store the insertion 'candidate'
// It must be further verified that this segment has no parent to
// distinguish between destination of transposition and insertion.
bool DefaultRearrangement::scanInsertionCycle(
TopSegmentIteratorConstPtr topSegment)
{
assert(topSegment.get());
resetStatus(topSegment);
// eat up any adjacent insertions so they don't get double counted
while (_next->hasParent() == false && _next->isLast() == false)
{
_right->copy(_next);
_right->toRight();
if (_right->hasParent() == false)
{
_next->copy(_right);
}
else
{
break;
}
}
_right->copy(_next);
assert(_next->equals(_cur) || _next->hasParent() == false);
bool first = _cur->isFirst();
bool last = _right->isLast();
if (first && last)
{
return false;
}
// Case 1a) current segment is left endpoint. we consider insertion
// if right neighbour has parent
if (first)
{
_right->toRight();
if (_cur->hasParent() == false)
{
return true;
}
else if (_right->hasParent())
{
_curParent->toParent(_cur);
_rightParent->toParent(_right);
return _rightParent->adjacentTo(_curParent) == false;
}
}
// Case 1b) current segment is right endpoint. we consider insertion
// if left neighbour has parent
else if (last)
{
_left->toLeft();
if (_cur->hasParent() == false)
{
return true;
}
else if (_left->hasParent())
{
_curParent->toParent(_cur);
_leftParent->toParent(_left);
return _leftParent->adjacentTo(_curParent) == false;
}
}
// Case 2) current segment has a left neigbhour and a right neigbour
else
{
_left->toLeft();
_right->toRight();
if (_left->hasParent() == true && _right->hasParent() == true)
{
_leftParent->toParent(_left);
_rightParent->toParent(_right);
// Case 2a) Parents are adjacent
if (_leftParent->adjacentTo(_rightParent))
{
return true;
}
// Case 2b) Left parent is endpoint
else if (_leftParent->isFirst() || _leftParent->isLast())
{
return _leftParent->getSequence() == _rightParent->getSequence();
}
// Case 2c) Right parent is endpoint
else if (_rightParent->isFirst() || _rightParent->isLast())
{
return _leftParent->getSequence() == _rightParent->getSequence();
}
}
}
return false;
}
开发者ID:ifiddes,项目名称:hal,代码行数:97,代码来源:defaultRearrangement.cpp
示例20: scanDeletionCycle
// If true, _leftParent will store the deletion 'candidate'
// It must be further verified that this segment has no child to
// distinguish between source of transposition and deletion.
bool DefaultRearrangement::scanDeletionCycle(
TopSegmentIteratorConstPtr topSegment)
{
assert(topSegment.get());
resetStatus(topSegment);
assert(_atomic != true || _cur->getNumSegments() == 1);
bool first = _cur->isFirst();
bool last = _cur->isLast();
if (_cur->hasParent() == false || (first && last))
{
return false;
}
// Case 1) current segment is a right endpoint. we consider delection
// if parent has neighbour
// FIXME: the edge cases are probably very wrong.
if (last)
{
_leftParent->toParent(_cur);
if (_leftParent->isFirst() == false)
{
_leftParent->toLeft();
return true;
}
if (_leftParent->isLast() == false)
{
_leftParent->toRight();
return true;
}
}
// Case 2) Try to find deletion cycle by going right-up-left-left-down
else
{
_rightParent->toParent(_cur);
// FIXME: the edge cases are probably very wrong.
if (first) {
return false;
}
_left->toLeft();
assert(_rightParent->getGapThreshold() == _gapThreshold);
assert(_cur->getGapThreshold() == _gapThreshold);
assert(_atomic != true || _rightParent->getNumSegments() == 1);
assert(_atomic != true || _left->getNumSegments() == 1);
if (_left->hasParent() == false)
{
return false;
}
_leftParent->toParent(_left);
if (_leftParent->getSequence() == _rightParent->getSequence())
{
// don't care about inversions
// so we make sure left is left of right and they are both positive
if (_leftParent->getReversed() == true)
{
_leftParent->toReverse();
}
if (_rightParent->getReversed() == true)
{
_rightParent->toReverse();
}
if (_rightParent->getLeftArrayIndex() < _leftParent->getLeftArrayIndex())
{
swap(_leftParent, _rightParent);
}
if (_leftParent->isLast())
{
return false;
}
_leftParent->toRight();
return _leftParent->adjacentTo(_rightParent);
}
}
return false;
}
开发者ID:ifiddes,项目名称:hal,代码行数:85,代码来源:defaultRearrangement.cpp
注:本文中的TopSegmentIteratorConstPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论