本文整理汇总了C++中TopologyNode::containsClade方法的典型用法代码示例。如果您正苦于以下问题:C++ TopologyNode::containsClade方法的具体用法?C++ TopologyNode::containsClade怎么用?C++ TopologyNode::containsClade使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopologyNode
的用法示例。
在下文中一共展示了TopologyNode::containsClade方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void TmrcaStatistic::update( void ) {
const std::vector<TopologyNode*> &n = tree->getValue().getNodes();
size_t minCaldeSize = n.size() + 2;
bool found = false;
if ( index != RbConstants::Size_t::nan )
{
TopologyNode *node = n[index];
std::vector<std::string> taxa;
node->getTaxaStringVector( taxa );
size_t cladeSize = taxa.size();
if ( node->containsClade( clade, false ) && taxaCount == cladeSize )
{
found = true;
}
else
{
minCaldeSize = cladeSize;
}
}
if ( found == false )
{
for (size_t i = tree->getValue().getNumberOfTips(); i < n.size(); ++i)
{
TopologyNode *node = n[i];
std::vector<std::string> taxa;
node->getTaxaStringVector( taxa );
size_t cladeSize = taxa.size();
if ( cladeSize < minCaldeSize && cladeSize >= taxaCount && node->containsClade( clade, false ) )
{
index = node->getIndex();
minCaldeSize = cladeSize;
if ( taxaCount == cladeSize )
{
break;
}
}
}
}
if ( index == RbConstants::Size_t::nan )
{
throw RbException("TMRCA-Statistics can only be applied if clade is present.");
}
if ( stemAge )
{
size_t parentIndex = tree->getValue().getNode(index).getParent().getIndex();
double tmrca = tree->getValue().getAge(parentIndex);
*value = tmrca;
}
else
{
double tmrca = tree->getValue().getAge(index);
*value = tmrca;
}
}
示例2: update
void TmrcaStatistic::update( void )
{
const std::vector<TopologyNode*> &n = tree->getValue().getNodes();
size_t minCladeSize = n.size() + 2;
bool found = false;
if ( index != -RbConstants::Integer::max )
{
TopologyNode *node = n[index];
size_t cladeSize = size_t( (node->getNumberOfNodesInSubtree(true) + 1) / 2);
if ( node->containsClade( clade, false ) == true )
{
if ( taxaCount == cladeSize )
{
found = true;
}
else
{
minCladeSize = cladeSize;
}
}
}
if ( found == false )
{
// for each node
for (size_t i = 0; i < n.size(); ++i)
{
TopologyNode *node = n[i];
size_t cladeSize = size_t( (node->getNumberOfNodesInSubtree(true) + 1) / 2);
if ( cladeSize < minCladeSize && cladeSize >= taxaCount && node->containsClade( clade, false ) )
{
index = node->getIndex();
minCladeSize = cladeSize;
if ( taxaCount == cladeSize )
{
break;
}
}
}
}
if ( index == -RbConstants::Integer::max )
{
throw RbException("TMRCA-Statistics can only be applied if clade is present.");
}
if ( stemAge && index != tree->getValue().getRoot().getIndex() )
{
size_t parentIndex = tree->getValue().getNode(index).getParent().getIndex();
double tmrca = tree->getValue().getNode( parentIndex ).getAge();
*value = tmrca;
}
else
{
double tmrca = tree->getValue().getNode( index ).getAge();
*value = tmrca;
}
}