当前位置: 首页>>代码示例>>C++>>正文


C++ TopSegmentIteratorPtr::getStartPosition方法代码示例

本文整理汇总了C++中TopSegmentIteratorPtr::getStartPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ TopSegmentIteratorPtr::getStartPosition方法的具体用法?C++ TopSegmentIteratorPtr::getStartPosition怎么用?C++ TopSegmentIteratorPtr::getStartPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TopSegmentIteratorPtr的用法示例。


在下文中一共展示了TopSegmentIteratorPtr::getStartPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: checkGenome

void TopSegmentIteratorToSiteTest::checkGenome(const Genome *genome) {
    TopSegmentIteratorPtr 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:glennhickey,项目名称:hal,代码行数:11,代码来源:halTopSegmentTest.cpp

示例2: checkCallBack

void TopSegmentSimpleIteratorTest::checkCallBack(const Alignment *alignment) {
    const Genome *ancGenome = alignment->openGenome("Anc0");
    CuAssertTrue(_testCase, ancGenome->getNumTopSegments() == _topSegments.size());
    TopSegmentIteratorPtr 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:glennhickey,项目名称:hal,代码行数:49,代码来源:halTopSegmentTest.cpp

示例3: checkCallBack

void GenomeCopyTest::checkCallBack(const Alignment *alignment) {
    // FIXME: halAlignment->open() fails miserably but
    // openHalAlignmentReadOnly works? Probably some state isn't cleared
    // on close.
    AlignmentPtr tmp(getTestAlignmentInstances(alignment->getStorageFormat(), _path, WRITE_ACCESS));
    _secondAlignment = tmp;
    const Genome *ancGenome = alignment->openGenome("AncGenome");
    CuAssertTrue(_testCase, ancGenome->getName() == "AncGenome");
    CuAssertTrue(_testCase, ancGenome->getSequenceLength() == 1000000);
    CuAssertTrue(_testCase, ancGenome->getNumTopSegments() == 0);
    CuAssertTrue(_testCase, ancGenome->getNumBottomSegments() == 700000);
    const MetaData *ancMeta = ancGenome->getMetaData();
    CuAssertTrue(_testCase, ancMeta->get("Young") == "Jeezy");
    const Genome *leafGenome = alignment->openGenome("LeafGenome1");
    string ancSeq = "CAT";
    hal_index_t n = ancGenome->getSequenceLength();
    DnaIteratorPtr dnaIt = ancGenome->getDnaIterator();
    for (; dnaIt->getArrayIndex() < n; dnaIt->toRight()) {
        size_t i = dnaIt->getArrayIndex() % ancSeq.size();
        CuAssertTrue(_testCase, dnaIt->getBase() == ancSeq[i]);
    }
    TopSegmentIteratorPtr topIt = leafGenome->getTopSegmentIterator();
    n = leafGenome->getNumTopSegments();
    for (; topIt->getArrayIndex() < n; topIt->toRight()) {
        CuAssertTrue(_testCase, topIt->getStartPosition() == topIt->getArrayIndex());
        CuAssertTrue(_testCase, topIt->getLength() == 1);
        CuAssertTrue(_testCase, topIt->tseg()->getParentIndex() == 3);
        CuAssertTrue(_testCase, topIt->tseg()->getParentReversed() == true);
        CuAssertTrue(_testCase, topIt->tseg()->getBottomParseIndex() == 5);
        if (topIt->getArrayIndex() != 6) {
            CuAssertTrue(_testCase, topIt->tseg()->getNextParalogyIndex() == 6);
        } else {
            CuAssertTrue(_testCase, topIt->tseg()->getNextParalogyIndex() == 7);
        }
    }
    BottomSegmentIteratorPtr botIt = ancGenome->getBottomSegmentIterator();
    n = ancGenome->getNumBottomSegments();
    for (; botIt->getArrayIndex() < n; botIt->toRight()) {
        CuAssertTrue(_testCase, botIt->getStartPosition() == botIt->getArrayIndex());
        CuAssertTrue(_testCase, botIt->getLength() == 1);
        CuAssertTrue(_testCase, botIt->bseg()->getChildIndex(0) == 3);
        CuAssertTrue(_testCase, botIt->bseg()->getChildReversed(0) == true);
        CuAssertTrue(_testCase, botIt->bseg()->getTopParseIndex() == 5);
    }

    const Genome *copyRootGenome = _secondAlignment->openGenome("copyRootGenome");
    const Genome *copyLeafGenome = _secondAlignment->openGenome("LeafGenome1");
    CuAssertTrue(_testCase, copyRootGenome->getName() == "copyRootGenome");
    CuAssertTrue(_testCase, copyRootGenome->getSequenceLength() == 1000000);
    CuAssertTrue(_testCase, copyRootGenome->getNumTopSegments() == 0);
    CuAssertTrue(_testCase, copyRootGenome->getNumBottomSegments() == 700000);
    CuAssertTrue(_testCase, copyLeafGenome->getName() == "LeafGenome1");
    CuAssertTrue(_testCase, copyLeafGenome->getSequenceLength() == 1000000);
    CuAssertTrue(_testCase, copyLeafGenome->getNumTopSegments() == 5000);
    CuAssertTrue(_testCase, copyLeafGenome->getNumBottomSegments() == 0);
    const MetaData *copyMeta = copyRootGenome->getMetaData();
    CuAssertTrue(_testCase, copyMeta->get("Young") == "Jeezy");
    n = copyRootGenome->getSequenceLength();
    dnaIt = copyRootGenome->getDnaIterator();
    for (; dnaIt->getArrayIndex() < n; dnaIt->toRight()) {
        size_t i = dnaIt->getArrayIndex() % ancSeq.size();
        CuAssertTrue(_testCase, dnaIt->getBase() == ancSeq[i]);
    }
    topIt = copyLeafGenome->getTopSegmentIterator();
    n = copyLeafGenome->getNumTopSegments();
    for (; topIt->getArrayIndex() < n; topIt->toRight()) {
        CuAssertTrue(_testCase, topIt->getStartPosition() == topIt->getArrayIndex());
        CuAssertTrue(_testCase, topIt->getLength() == 1);
        CuAssertTrue(_testCase, topIt->tseg()->getParentIndex() == 3);
        CuAssertTrue(_testCase, topIt->tseg()->getParentReversed() == true);
        CuAssertTrue(_testCase, topIt->tseg()->getBottomParseIndex() == 5);
        if (topIt->getArrayIndex() != 6) {
            CuAssertTrue(_testCase, topIt->tseg()->getNextParalogyIndex() == 6);
        } else {
            CuAssertTrue(_testCase, topIt->tseg()->getNextParalogyIndex() == 7);
        }
    }
    botIt = copyRootGenome->getBottomSegmentIterator();
    n = copyRootGenome->getNumBottomSegments();
    for (; botIt->getArrayIndex() < n; botIt->toRight()) {
        CuAssertTrue(_testCase, botIt->getStartPosition() == botIt->getArrayIndex());
        CuAssertTrue(_testCase, botIt->getLength() == 1);
        CuAssertTrue(_testCase, botIt->bseg()->getChildIndex(0) == 3);
        CuAssertTrue(_testCase, botIt->bseg()->getChildReversed(0) == true);
        CuAssertTrue(_testCase, botIt->bseg()->getTopParseIndex() == 5);
    }

    _secondAlignment->close();
    remove(_path.c_str());
}
开发者ID:glennhickey,项目名称:hal,代码行数:90,代码来源:halGenomeTest.cpp


注:本文中的TopSegmentIteratorPtr::getStartPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。