本文整理汇总了C++中BottomSegmentIteratorPtr::slice方法的典型用法代码示例。如果您正苦于以下问题:C++ BottomSegmentIteratorPtr::slice方法的具体用法?C++ BottomSegmentIteratorPtr::slice怎么用?C++ BottomSegmentIteratorPtr::slice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BottomSegmentIteratorPtr
的用法示例。
在下文中一共展示了BottomSegmentIteratorPtr::slice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkCallBack
void TopSegmentIteratorParseTest::checkCallBack(const Alignment *alignment) {
BottomSegmentIteratorPtr bi;
TopSegmentIteratorPtr ti;
// case 1
const Genome *case1 = alignment->openGenome("case1");
ti = case1->getTopSegmentIterator();
bi = case1->getBottomSegmentIterator();
ti->toParseUp(bi);
CuAssertTrue(_testCase, bi->getStartPosition() == ti->getStartPosition());
CuAssertTrue(_testCase, bi->getLength() == ti->getLength());
bi->slice(3, 1);
ti->toParseUp(bi);
CuAssertTrue(_testCase, bi->getLength() == bi->getBottomSegment()->getLength() - 4);
CuAssertTrue(_testCase, bi->getStartPosition() == ti->getStartPosition());
CuAssertTrue(_testCase, bi->getLength() == ti->getLength());
// case 2
const Genome *case2 = alignment->openGenome("case2");
ti = case2->getTopSegmentIterator();
bi = case2->getBottomSegmentIterator(1);
ti->toParseUp(bi);
CuAssertTrue(_testCase, bi->getStartPosition() == ti->getStartPosition());
bi->slice(1, 1);
ti->toParseUp(bi);
CuAssertTrue(_testCase, bi->getStartPosition() == ti->getStartPosition());
// case 3
const Genome *case3 = alignment->openGenome("case3");
ti = case3->getTopSegmentIterator();
bi = case3->getBottomSegmentIterator();
ti->toParseUp(bi);
CuAssertTrue(_testCase, bi->getStartPosition() == ti->getStartPosition());
bi->slice(2, 1);
ti->toParseUp(bi);
CuAssertTrue(_testCase, bi->getStartPosition() == ti->getStartPosition());
// case 4
const Genome *case4 = alignment->openGenome("case4");
ti = case4->getTopSegmentIterator();
bi = case4->getBottomSegmentIterator(1);
ti->toParseUp(bi);
CuAssertTrue(_testCase, bi->getStartPosition() == ti->getStartPosition());
bi->slice(2, 2);
ti->toParseUp(bi);
CuAssertTrue(_testCase, bi->getStartPosition() == ti->getStartPosition());
}
示例2: boundComp
int MappedSegment::boundComp(const SegmentIteratorPtr &s1, const SegmentIteratorPtr &s2) {
int res = 0;
bool flip = s2->getReversed();
if (flip) {
s2->toReverse();
}
if (s1->isTop() && !s2->isTop()) {
BottomSegmentIteratorPtr bot = std::dynamic_pointer_cast<BottomSegmentIterator>(s2);
hal_index_t lb = bot->bseg()->getTopParseIndex();
hal_index_t ub = lb;
if ((hal_size_t)bot->getArrayIndex() < bot->getGenome()->getNumBottomSegments() - 1) {
bot = bot->clone();
bot->slice(0, 0);
bot->toRight();
ub = bot->bseg()->getTopParseIndex();
}
if (s1->getArrayIndex() < lb) {
res = -1;
} else if (s1->getArrayIndex() > ub) {
res = 1;
}
} else if (!s1->isTop() && s2->isTop()) {
TopSegmentIteratorPtr top = std::dynamic_pointer_cast<TopSegmentIterator>(s2);
hal_index_t lb = top->tseg()->getBottomParseIndex();
hal_index_t ub = lb;
if ((hal_size_t)top->getArrayIndex() < top->getGenome()->getNumTopSegments() - 1) {
top = top->clone();
top->slice(0, 0);
top->toRight();
ub = top->tseg()->getBottomParseIndex();
}
if (s1->getArrayIndex() < lb) {
res = -1;
} else if (s1->getArrayIndex() > ub) {
res = 1;
}
}
if (flip) {
s2->toReverse();
}
return res;
}