本文整理汇总了C++中AlignmentPtr::insertGenome方法的典型用法代码示例。如果您正苦于以下问题:C++ AlignmentPtr::insertGenome方法的具体用法?C++ AlignmentPtr::insertGenome怎么用?C++ AlignmentPtr::insertGenome使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AlignmentPtr
的用法示例。
在下文中一共展示了AlignmentPtr::insertGenome方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
CLParserPtr optParser = initParser();
string inPath, botAlignmentPath, topAlignmentPath, parentName, insertName,
childName, leafName;
double upperBranchLength, leafBranchLength;
bool noMarkAncestors;
try {
optParser->parseOptions(argc, argv);
inPath = optParser->getArgument<string>("inFile");
botAlignmentPath = optParser->getArgument<string>("botAlignmentFile");
topAlignmentPath = optParser->getArgument<string>("topAlignmentFile");
parentName = optParser->getArgument<string>("parentName");
insertName = optParser->getArgument<string>("insertName");
childName = optParser->getArgument<string>("childName");
leafName = optParser->getArgument<string>("leafName");
upperBranchLength = optParser->getArgument<double>("upperBranchLength");
leafBranchLength = optParser->getArgument<double>("leafBranchLength");
noMarkAncestors = optParser->getFlag("noMarkAncestors");
} catch (exception &e) {
optParser->printUsage(cerr);
return 1;
}
AlignmentPtr mainAlignment = openHalAlignment(inPath, optParser);
AlignmentConstPtr botAlignment = openHalAlignment(botAlignmentPath,
optParser);
AlignmentConstPtr topAlignment = openHalAlignment(topAlignmentPath,
optParser);
mainAlignment->insertGenome(insertName, parentName, childName,
upperBranchLength);
mainAlignment->addLeafGenome(leafName, insertName, leafBranchLength);
// Insert the new intermediate node.
Genome *insertGenome = mainAlignment->openGenome(insertName);
const Genome *topInsertGenome = topAlignment->openGenome(insertName);
const Genome *botInsertGenome = botAlignment->openGenome(insertName);
topInsertGenome->copyDimensions(insertGenome);
topInsertGenome->copyTopDimensions(insertGenome);
botInsertGenome->copyBottomDimensions(insertGenome);
topInsertGenome->copySequence(insertGenome);
topInsertGenome->copyTopSegments(insertGenome);
topInsertGenome->copyMetadata(insertGenome);
botInsertGenome->copyBottomSegments(insertGenome);
insertGenome->fixParseInfo();
// Copy the bottom segments for the parent genome from the top alignment.
Genome *parentGenome = mainAlignment->openGenome(parentName);
const Genome *botParentGenome = topAlignment->openGenome(parentName);
botParentGenome->copyBottomDimensions(parentGenome);
botParentGenome->copyBottomSegments(parentGenome);
parentGenome->fixParseInfo();
// Fix the parent's other children as well.
vector<string> allChildren = mainAlignment->getChildNames(parentName);
for (size_t i = 0; i < allChildren.size(); i++)
{
if (allChildren[i] != insertName)
{
Genome *outGenome = mainAlignment->openGenome(allChildren[i]);
const Genome *topSegmentsGenome = topAlignment->openGenome(allChildren[i]);
topSegmentsGenome->copyTopDimensions(outGenome);
topSegmentsGenome->copyTopSegments(outGenome);
outGenome->fixParseInfo();
}
}
// Copy the top segments for the child genome from the bottom alignment.
Genome *childGenome = mainAlignment->openGenome(childName);
const Genome *topChildGenome = botAlignment->openGenome(childName);
topChildGenome->copyTopDimensions(childGenome);
topChildGenome->copyTopSegments(childGenome);
childGenome->fixParseInfo();
// Copy the entire genome for the leaf from the bottom alignment.
Genome *outLeafGenome = mainAlignment->openGenome(leafName);
const Genome *inLeafGenome = botAlignment->openGenome(leafName);
inLeafGenome->copy(outLeafGenome);
if (!noMarkAncestors) {
markAncestorsForUpdate(mainAlignment, insertName);
}
mainAlignment->close();
botAlignment->close();
topAlignment->close();
}