本文整理汇总了C++中TopSegmentIteratorConstPtr::getStartPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ TopSegmentIteratorConstPtr::getStartPosition方法的具体用法?C++ TopSegmentIteratorConstPtr::getStartPosition怎么用?C++ TopSegmentIteratorConstPtr::getStartPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopSegmentIteratorConstPtr
的用法示例。
在下文中一共展示了TopSegmentIteratorConstPtr::getStartPosition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testTopSegment
void MappedSegmentMapAcrossTest::testTopSegment(AlignmentConstPtr alignment,
TopSegmentIteratorConstPtr top)
{
const Genome* parent = top->getGenome()->getParent();
const Genome* other = top->getGenome()->getName() == "child1" ?
alignment->openGenome("child2") : alignment->openGenome("child1");
set<MappedSegmentConstPtr> results;
top->getMappedSegments(results, other, 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);
TopSegmentIteratorConstPtr sister = other->getTopSegmentIterator();
sister->toChildG(bottom, other);
CuAssertTrue(_testCase, mseg->getGenome() == sister->getGenome());
CuAssertTrue(_testCase,
mseg->getStartPosition() == sister->getStartPosition());
CuAssertTrue(_testCase,
mseg->getLength() == sister->getLength());
CuAssertTrue(_testCase,
mseg->getReversed() == sister->getReversed());
}
示例2: 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);
}
}
}
示例3: 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());
}
}
示例4: testBottomSegment
void MappedSegmentMapDownTest::testBottomSegment(
AlignmentConstPtr alignment,
BottomSegmentIteratorConstPtr bottom,
hal_size_t childIndex)
{
const Genome* child = bottom->getGenome()->getChild(childIndex);
set<MappedSegmentConstPtr> results;
bottom->getMappedSegments(results, child, NULL, false);
CuAssertTrue(_testCase, results.size() == 1);
MappedSegmentConstPtr mseg = *results.begin();
CuAssertTrue(_testCase, mseg->getSource()->getGenome() ==
bottom->getGenome());
CuAssertTrue(_testCase, mseg->getSource()->getStartPosition() ==
bottom->getStartPosition());
CuAssertTrue(_testCase,
mseg->getSource()->getLength() == bottom->getLength());
CuAssertTrue(_testCase,
mseg->getSource()->getReversed() == bottom->getReversed());
TopSegmentIteratorConstPtr top = child->getTopSegmentIterator();
top->toChild(bottom, childIndex);
CuAssertTrue(_testCase, mseg->getGenome() == top->getGenome());
CuAssertTrue(_testCase,
mseg->getStartPosition() == top->getStartPosition());
CuAssertTrue(_testCase,
mseg->getLength() == top->getLength());
CuAssertTrue(_testCase,
mseg->getReversed() == top->getReversed());
}
示例5: checkCallBack
void TopSegmentIteratorParseTest::checkCallBack(AlignmentConstPtr alignment)
{
BottomSegmentIteratorConstPtr bi;
TopSegmentIteratorConstPtr 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());
}
示例6: checkCallBack
void MappedSegmentMapExtraParalogsTest::checkCallBack(AlignmentConstPtr alignment)
{
validateAlignment(alignment);
const Genome *grandChild1 = alignment->openGenome("grandChild1");
const Genome *grandChild2 = alignment->openGenome("grandChild2");
const Genome *root = alignment->openGenome("root");
TopSegmentIteratorConstPtr top = grandChild2->getTopSegmentIterator();
set<MappedSegmentConstPtr> results;
// First, check that by default we will only get the homologies in
// or before the MRCA. (in this case, just seg 0 of grandChild1).
top->getMappedSegments(results, grandChild1, NULL, true);
CuAssertTrue(_testCase, results.size() == 1);
MappedSegmentConstPtr mseg = *results.begin();
// Source information should be preserved
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());
// Check target information is correct
CuAssertTrue(_testCase,
mseg->getGenome() == grandChild1);
CuAssertTrue(_testCase,
mseg->getStartPosition() == 2);
CuAssertTrue(_testCase,
mseg->getLength() == 3);
CuAssertTrue(_testCase,
mseg->getReversed() == true);
// Check that by using the grandparent as the coalescence limit we
// will get all the paralogs.
top->getMappedSegments(results, grandChild1, NULL, true, 0, root);
CuAssertTrue(_testCase, results.size() == 3);
set<MappedSegmentConstPtr>::iterator i = results.begin();
bool found[3] = {false, false, false};
for (; i != results.end(); ++i)
{
// Source information should be preserved
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());
// Check target information is correct
CuAssertTrue(_testCase,
mseg->getGenome() == grandChild1);
CuAssertTrue(_testCase,
mseg->getStartPosition() == 2
|| mseg->getStartPosition() == 5
|| mseg->getStartPosition() == 8);
CuAssertTrue(_testCase,
mseg->getLength() == 3);
CuAssertTrue(_testCase,
mseg->getReversed() == true);
found[mseg->getArrayIndex()] = true;
}
}