本文整理汇总了C++中PWPath::FromMSAPair方法的典型用法代码示例。如果您正苦于以下问题:C++ PWPath::FromMSAPair方法的具体用法?C++ PWPath::FromMSAPair怎么用?C++ PWPath::FromMSAPair使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PWPath
的用法示例。
在下文中一共展示了PWPath::FromMSAPair方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TryRealign
bool TryRealign(MSA &msaIn, const Tree &tree, const unsigned Leaves1[],
unsigned uCount1, const unsigned Leaves2[], unsigned uCount2,
SCORE *ptrscoreBefore, SCORE *ptrscoreAfter,
bool bLockLeft, bool bLockRight)
{
#if TRACE
Log("TryRealign, msaIn=\n");
#endif
MuscleContext *ctx = getMuscleContext();
const unsigned uSeqCount = msaIn.GetSeqCount();
unsigned *Ids1 = new unsigned[uSeqCount];
unsigned *Ids2 = new unsigned[uSeqCount];
LeafIndexesToIds(tree, Leaves1, uCount1, Ids1);
LeafIndexesToIds(tree, Leaves2, uCount2, Ids2);
MSA msa1;
MSA msa2;
MSASubsetByIds(msaIn, Ids1, uCount1, msa1);
MSASubsetByIds(msaIn, Ids2, uCount2, msa2);
#if DEBUG
ValidateMuscleIds(msa1);
ValidateMuscleIds(msa2);
#endif
// Computing the objective score may be expensive for
// large numbers of sequences. As a speed optimization,
// we check whether the alignment changes. If it does
// not change, there is no need to compute the objective
// score. We test for the alignment changing by comparing
// the Viterbi paths before and after re-aligning.
PWPath pathBefore;
pathBefore.FromMSAPair(msa1, msa2);
DeleteGappedCols(msa1);
DeleteGappedCols(msa2);
if (0 == msa1.GetColCount() || 0 == msa2.GetColCount()) {
delete[] Ids1;
delete[] Ids2;
return false;
}
MSA msaRealigned;
PWPath pathAfter;
AlignTwoMSAs(msa1, msa2, msaRealigned, pathAfter, bLockLeft, bLockRight);
bool bAnyChanges = !pathAfter.Equal(pathBefore);
unsigned uDiffCount1;
unsigned uDiffCount2;
unsigned* Edges1 = ctx->refinehoriz.Edges1;
unsigned* Edges2 = ctx->refinehoriz.Edges2;
DiffPaths(pathBefore, pathAfter, Edges1, &uDiffCount1, Edges2, &uDiffCount2);
#if TRACE
Log("TryRealign, msa1=\n");
Log("\nmsa2=\n");
Log("\nRealigned (changes %s)=\n", bAnyChanges ? "TRUE" : "FALSE");
#endif
if (!bAnyChanges)
{
*ptrscoreBefore = 0;
*ptrscoreAfter = 0;
delete[] Ids1;
delete[] Ids2;
return false;
}
SetMSAWeightsMuscle(msaIn);
SetMSAWeightsMuscle(msaRealigned);
#if DIFFOBJSCORE
const SCORE scoreDiff = DiffObjScore(msaIn, pathBefore, Edges1, uDiffCount1,
msaRealigned, pathAfter, Edges2, uDiffCount2);
bool bAccept = (scoreDiff > 0);
*ptrscoreBefore = 0;
*ptrscoreAfter = scoreDiff;
//const SCORE scoreBefore = ObjScoreIds(msaIn, Ids1, uCount1, Ids2, uCount2);
//const SCORE scoreAfter = ObjScoreIds(msaRealigned, Ids1, uCount1, Ids2, uCount2);
//Log("Diff = %.3g %.3g\n", scoreDiff, scoreAfter - scoreBefore);
#else
const SCORE scoreBefore = ObjScoreIds(msaIn, Ids1, uCount1, Ids2, uCount2);
const SCORE scoreAfter = ObjScoreIds(msaRealigned, Ids1, uCount1, Ids2, uCount2);
bool bAccept = (scoreAfter > scoreBefore);
#if TRACE
Log("Score %g -> %g Accept %s\n", scoreBefore, scoreAfter, bAccept ? "TRUE" : "FALSE");
#endif
*ptrscoreBefore = scoreBefore;
*ptrscoreAfter = scoreAfter;
#endif
//.........这里部分代码省略.........