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


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

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


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

示例1: writeUnsampledSequence

void LodExtract::writeUnsampledSequence(const Sequence* outSequence,
                                        SegmentIteratorPtr outSegment)
{
  outSegment->setCoordinates(outSequence->getStartPosition(),
                             outSequence->getSequenceLength());
  if (outSegment->isTop())
  {
    assert(outSequence->getNumTopSegments() == 1);
    TopSegmentIteratorPtr top = outSegment.downCast<TopSegmentIteratorPtr>();
    top->setParentIndex(NULL_INDEX);
    top->setParentReversed(false);
    top->setNextParalogyIndex(NULL_INDEX);
    top->setBottomParseIndex(NULL_INDEX);
  }
  else
  {
    assert(outSequence->getNumBottomSegments() == 1);
    BottomSegmentIteratorPtr bottom = 
       outSegment.downCast<BottomSegmentIteratorPtr>();
    hal_size_t numChildren = bottom->getNumChildren();
    for (hal_size_t childNum = 0; childNum < numChildren; ++childNum)
    {
      bottom->setChildIndex(childNum, NULL_INDEX);
      bottom->setChildReversed(childNum, false);
    }
    bottom->setTopParseIndex(NULL_INDEX);
  }
}
开发者ID:dayin1989,项目名称:hal,代码行数:28,代码来源:halLodExtract.cpp

示例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);
    }
  }
}
开发者ID:dayin1989,项目名称:hal,代码行数:52,代码来源:halGenome.cpp

示例3: updateBlockEdges

void LodExtract::updateBlockEdges(const Genome* inParentGenome,
                                  SegmentMap& segMap,
                                  const LodBlock* block,
                                  BottomSegmentIteratorPtr bottom,
                                  TopSegmentIteratorPtr top)
{
  Genome* outParentGenome = bottom->getGenome();
  const LodSegment* rootSeg = NULL;
  SegmentSet* segSet;
  SegmentSet::iterator setIt;

  // Zap all segments in parent genome
  SegmentMap::iterator mapIt = segMap.find(inParentGenome);
  if (mapIt != segMap.end())
  {
    segSet = mapIt->second;
    assert(segSet != NULL);
    setIt = segSet->begin();
    for (; setIt != segSet->end(); ++setIt)
    {
      bottom->setArrayIndex(outParentGenome, (*setIt)->getArrayIndex());
      for (hal_size_t i = 0; i < bottom->getNumChildren(); ++i)
      {
        bottom->setChildIndex(i, NULL_INDEX);
        bottom->setTopParseIndex(NULL_INDEX);
      }
    }

    // Choose first segment as parent to all segments in the child genome
    setIt = segSet->begin();
    rootSeg = *(setIt);
    bottom->setArrayIndex(outParentGenome, (*setIt)->getArrayIndex());
  }

  // Do the child genomes
  const Genome* inGrandParentGenome = inParentGenome->getParent();
  SegmentSet::iterator nextIt;
  for (mapIt = segMap.begin(); mapIt != segMap.end(); ++mapIt)
  {
    if (mapIt->first != inParentGenome and mapIt->first != inGrandParentGenome)
    {
      Genome* outChildGenome = 
         _outAlignment->openGenome(mapIt->first->getName());
      hal_index_t childIndex = outParentGenome->getChildIndex(outChildGenome);
      assert(childIndex >= 0);
      segSet = mapIt->second;
      assert(segSet != NULL);
      for (setIt = segSet->begin(); setIt != segSet->end(); ++setIt)
      {
        top->setArrayIndex(outChildGenome, (*setIt)->getArrayIndex());
        top->setBottomParseIndex(NULL_INDEX);

        // Connect to parent
        if (rootSeg != NULL)
        {
          top->setParentIndex(bottom->getArrayIndex());
          bool reversed = (*setIt)->getFlipped() != rootSeg->getFlipped();
          top->setParentReversed(reversed);
          if (setIt == segSet->begin())
          {
            bottom->setChildIndex(childIndex, top->getArrayIndex());         
            bottom->setChildReversed(childIndex, reversed);      
          }
        }
        else
        {
          top->setParentIndex(NULL_INDEX);
        }

        // Connect to next paralogy
        SegmentSet::iterator setNext = setIt;
        ++setNext;
        if (setNext == segSet->end())
        {
          setNext = segSet->begin();
        }
        if (setNext == setIt)
        {
          top->setNextParalogyIndex(NULL_INDEX);
        }
        else
        {
          top->setNextParalogyIndex((*setNext)->getArrayIndex());
        }
      }
    }
  }
}
开发者ID:dayin1989,项目名称:hal,代码行数:88,代码来源:halLodExtract.cpp


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