本文整理汇总了C++中Tree::GetLeafName方法的典型用法代码示例。如果您正苦于以下问题:C++ Tree::GetLeafName方法的具体用法?C++ Tree::GetLeafName怎么用?C++ Tree::GetLeafName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree::GetLeafName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoMuscle
//.........这里部分代码省略.........
{
TextFile fileOut(g_pstrOutFileName, true);
v.ToFile(fileOut);
return;
}
if (uSeqCount > 1)
MHackStart(v);
// First iteration
Tree GuideTree;
if (0 != g_pstrUseTreeFileName)
{
// Discourage users...
if (!g_bUseTreeNoWarn)
Rprintf("%s", g_strUseTreeWarning);
// Read tree from file
TextFile TreeFile(g_pstrUseTreeFileName);
GuideTree.FromFile(TreeFile);
// Make sure tree is rooted
if (!GuideTree.IsRooted())
Quit("User tree must be rooted");
if (GuideTree.GetLeafCount() != uSeqCount)
Quit("User tree does not match input sequences");
const unsigned uNodeCount = GuideTree.GetNodeCount();
for (unsigned uNodeIndex = 0; uNodeIndex < uNodeCount; ++uNodeIndex)
{
if (!GuideTree.IsLeaf(uNodeIndex))
continue;
const char *LeafName = GuideTree.GetLeafName(uNodeIndex);
unsigned uSeqIndex;
bool SeqFound = v.FindName(LeafName, &uSeqIndex);
if (!SeqFound)
Quit("Label %s in tree does not match sequences", LeafName);
unsigned uId = v.GetSeqIdFromName(LeafName);
GuideTree.SetLeafId(uNodeIndex, uId);
}
}
else
TreeFromSeqVect(v, GuideTree, g_Cluster1, g_Distance1, g_Root1,
g_pstrDistMxFileName1);
const char *Tree1 = ValueOpt("Tree1");
if (0 != Tree1)
{
TextFile f(Tree1, true);
GuideTree.ToFile(f);
if (g_bClusterOnly)
return;
}
SetMuscleTree(GuideTree);
ValidateMuscleIds(GuideTree);
MSA msa;
ProgNode *ProgNodes = 0;
if (g_bLow)
ProgNodes = ProgressiveAlignE(v, GuideTree, msa);
else
ProgressiveAlign(v, GuideTree, msa);
SetCurrentAlignment(msa);
示例2: DiffTrees
//.........这里部分代码省略.........
uParentLeft2,
uParentRight2);
#endif
if (uParentLeft2 == uParentRight2)
{
NodeIndexToId1[uNodeIndex1] = uInternalNodeId;
IdToNodeIndex2[uInternalNodeId] = uParentLeft2;
++uInternalNodeId;
}
else
bIsBachelor1[uNodeIndex1] = true;
}
unsigned uDiffCount = 0;
for (unsigned uNodeIndex = 0; uNodeIndex < uNodeCount; ++uNodeIndex)
{
if (bIsBachelor1[uNodeIndex])
continue;
if (Tree1.IsRoot(uNodeIndex))
{
// Special case: if no bachelors, consider the
// root a diff.
if (!bIsBachelor1[uNodeIndex])
bIsDiff1[uNodeIndex] = true;
continue;
}
const unsigned uParent = Tree1.GetParent(uNodeIndex);
if (bIsBachelor1[uParent])
{
bIsDiff1[uNodeIndex] = true;
++uDiffCount;
}
}
#if TRACE
Log("Tree1:\n");
Log("Node Id Bach Diff Name\n");
Log("---- ---- ---- ---- ----\n");
for (unsigned n = 0; n < uNodeCount; ++n)
{
Log("%4u %4u %d %d",
n,
NodeIndexToId1[n],
bIsBachelor1[n],
bIsDiff1[n]);
if (Tree1.IsLeaf(n))
Log(" %s", Tree1.GetLeafName(n));
Log("\n");
}
Log("\n");
Log("Tree2:\n");
Log("Node Id Name\n");
Log("---- ---- ----\n");
for (unsigned n = 0; n < uNodeCount; ++n)
{
Log("%4u ", n);
if (Tree2.IsLeaf(n))
Log(" %s", Tree2.GetLeafName(n));
Log("\n");
}
#endif
Diffs.CreateRooted();
const unsigned uDiffsRootIndex = Diffs.GetRootNodeIndex();
const unsigned uRootIndex1 = Tree1.GetRootNodeIndex();
for (unsigned n = 0; n < uLeafCount; ++n)
IdToDiffsLeafNodeIndex[n] = uNodeCount;
BuildDiffs(Tree1, uRootIndex1, bIsDiff1, Diffs, uDiffsRootIndex,
IdToDiffsLeafNodeIndex);
#if TRACE
Log("\n");
Log("Diffs:\n");
Diffs.LogMe();
Log("\n");
Log("IdToDiffsLeafNodeIndex:");
for (unsigned n = 0; n < uLeafCount; ++n)
{
if (n%16 == 0)
Log("\n");
else
Log(" ");
Log("%u=%u", n, IdToDiffsLeafNodeIndex[n]);
}
Log("\n");
#endif
for (unsigned n = 0; n < uLeafCount; ++n)
if (IdToDiffsLeafNodeIndex[n] == uNodeCount)
Quit("TreeDiffs check 7");
delete[] NodeIndexToId1;
delete[] IdToNodeIndex2;
delete[] bIsBachelor1;
delete[] bIsDiff1;
}