本文整理汇总了C++中PWPath::PrependEdge方法的典型用法代码示例。如果您正苦于以下问题:C++ PWPath::PrependEdge方法的具体用法?C++ PWPath::PrependEdge怎么用?C++ PWPath::PrependEdge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PWPath
的用法示例。
在下文中一共展示了PWPath::PrependEdge方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NWDASimple
//.........这里部分代码省略.........
}
if (E > BestScore)
{
cEdgeType = 'E';
BestScore = E;
}
if (I > BestScore)
{
cEdgeType = 'I';
BestScore = I;
}
if (J > BestScore)
{
cEdgeType = 'J';
BestScore = J;
}
#if TRACE
Log("DA Simple: MAB=%.4g DAB=%.4g EAB=%.4g IAB=%.4g JAB=%.4g best=%c\n",
M, D, E, I, J, cEdgeType);
#endif
unsigned PLA = uLengthA;
unsigned PLB = uLengthB;
for (;;)
{
PWEdge Edge;
Edge.cType = XlatEdgeType(cEdgeType);
Edge.uPrefixLengthA = PLA;
Edge.uPrefixLengthB = PLB;
#if TRACE
Log("Prepend %c%d.%d\n", Edge.cType, PLA, PLB);
#endif
Path.PrependEdge(Edge);
switch (cEdgeType)
{
case 'M':
assert(PLA > 0);
assert(PLB > 0);
cEdgeType = TBM(PLA, PLB);
--PLA;
--PLB;
break;
case 'D':
assert(PLA > 0);
cEdgeType = TBD(PLA, PLB);
--PLA;
break;
case 'E':
assert(PLA > 0);
cEdgeType = TBE(PLA, PLB);
--PLA;
break;
case 'I':
assert(PLB > 0);
cEdgeType = TBI(PLA, PLB);
--PLB;
break;
case 'J':
assert(PLB > 0);
cEdgeType = TBJ(PLA, PLB);
示例2: TraceBack
SCORE TraceBack(const ProfPos *PA, unsigned uLengthA, const ProfPos *PB,
unsigned uLengthB, const SCORE *DPM_, const SCORE *DPD_, const SCORE *DPI_,
PWPath &Path)
{
#if TRACE
Log("\n");
Log("TraceBack LengthA=%u LengthB=%u\n", uLengthA, uLengthB);
#endif
assert(uLengthB > 0 && uLengthA > 0);
const unsigned uPrefixCountA = uLengthA + 1;
const unsigned uPrefixCountB = uLengthB + 1;
Path.Clear();
unsigned uPrefixLengthA = uLengthA;
unsigned uPrefixLengthB = uLengthB;
const SCORE scoreM = DPM(uPrefixLengthA, uPrefixLengthB);
SCORE scoreD = DPD(uPrefixLengthA, uPrefixLengthB);
SCORE scoreI = DPI(uPrefixLengthA, uPrefixLengthB);
const ProfPos &LastPPA = PA[uLengthA - 1];
const ProfPos &LastPPB = PB[uLengthB - 1];
scoreD += LastPPA.m_scoreGapClose;
scoreI += LastPPB.m_scoreGapClose;
char cEdgeType = cInsane;
SCORE scoreMax;
if (scoreM >= scoreD && scoreM >= scoreI)
{
scoreMax = scoreM;
cEdgeType = 'M';
}
else if (scoreD >= scoreM && scoreD >= scoreI)
{
scoreMax = scoreD;
cEdgeType = 'D';
}
else
{
assert(scoreI >= scoreM && scoreI >= scoreD);
scoreMax = scoreI;
cEdgeType = 'I';
}
for (;;)
{
if ('S' == cEdgeType)
break;
PWEdge Edge;
Edge.cType = cEdgeType;
Edge.uPrefixLengthA = uPrefixLengthA;
Edge.uPrefixLengthB = uPrefixLengthB;
Path.PrependEdge(Edge);
char cPrevEdgeType;
unsigned uPrevPrefixLengthA = uPrefixLengthA;
unsigned uPrevPrefixLengthB = uPrefixLengthB;
switch (cEdgeType)
{
case 'M':
{
assert(uPrefixLengthA > 0);
assert(uPrefixLengthB > 0);
const ProfPos &PPA = PA[uPrefixLengthA - 1];
const ProfPos &PPB = PB[uPrefixLengthB - 1];
const SCORE Score = DPM(uPrefixLengthA, uPrefixLengthB);
const SCORE scoreMatch = ScoreProfPos2(PPA, PPB);
SCORE scoreSM;
if (1 == uPrefixLengthA && 1 == uPrefixLengthB)
scoreSM = scoreMatch;
else
scoreSM = MINUS_INFINITY;
SCORE scoreMM = MINUS_INFINITY;
SCORE scoreDM = MINUS_INFINITY;
SCORE scoreIM = MINUS_INFINITY;
if (uPrefixLengthA > 1 && uPrefixLengthB > 1)
scoreMM = DPM(uPrefixLengthA-1, uPrefixLengthB-1) + scoreMatch;
if (uPrefixLengthA > 1)
{
SCORE scoreTransDM = PA[uPrefixLengthA-2].m_scoreGapClose;
scoreDM = DPD(uPrefixLengthA-1, uPrefixLengthB-1) + scoreTransDM + scoreMatch;
}
if (uPrefixLengthB > 1)
{
SCORE scoreTransIM = PB[uPrefixLengthB-2].m_scoreGapClose;
scoreIM = DPI(uPrefixLengthA-1, uPrefixLengthB-1) + scoreTransIM + scoreMatch;
}
if (EQ(scoreMM, Score))
cPrevEdgeType = 'M';
else if (EQ(scoreDM, Score))
cPrevEdgeType = 'D';
//.........这里部分代码省略.........
示例3: TraceBackDimer
static SCORE TraceBackDimer( const SCORE *DPM_, const SCORE *DPD_, const SCORE *DPI_,
const char *TBM_, const char *TBD_, const char *TBI_,
unsigned uLengthA, unsigned uLengthB, PWPath &Path)
{
const unsigned uPrefixCountA = uLengthA + 1;
unsigned uPrefixLengthA = uLengthA;
unsigned uPrefixLengthB = uLengthB;
char cEdge = 'M';
SCORE scoreMax = DPM(uLengthA, uLengthB);
if (DPD(uLengthA, uLengthB) > scoreMax)
{
scoreMax = DPD(uLengthA, uLengthB);
cEdge = 'D';
}
if (DPI(uLengthA, uLengthB) > scoreMax)
{
scoreMax = DPI(uLengthA, uLengthB);
cEdge = 'I';
}
for (;;)
{
if (0 == uPrefixLengthA && 0 == uPrefixLengthB)
break;
PWEdge Edge;
Edge.cType = cEdge;
Edge.uPrefixLengthA = uPrefixLengthA;
Edge.uPrefixLengthB = uPrefixLengthB;
Path.PrependEdge(Edge);
#if TRACE
Log("PLA=%u PLB=%u Edge=%c\n", uPrefixLengthA, uPrefixLengthB, cEdge);
#endif
switch (cEdge)
{
case 'M':
assert(uPrefixLengthA > 0 && uPrefixLengthB > 0);
cEdge = TBM(uPrefixLengthA, uPrefixLengthB);
--uPrefixLengthA;
--uPrefixLengthB;
break;
case 'D':
assert(uPrefixLengthA > 0);
cEdge = TBD(uPrefixLengthA, uPrefixLengthB);
--uPrefixLengthA;
break;
case 'I':
assert(uPrefixLengthB > 0);
cEdge = TBI(uPrefixLengthA, uPrefixLengthB);
--uPrefixLengthB;
break;
default:
Quit("Invalid edge PLA=%u PLB=%u %c", uPrefixLengthA, uPrefixLengthB, cEdge);
}
}
#if TRACE
Path.LogMe();
#endif
return scoreMax;
}