本文整理汇总了C++中Algebra::choice方法的典型用法代码示例。如果您正苦于以下问题:C++ Algebra::choice方法的具体用法?C++ Algebra::choice怎么用?C++ Algebra::choice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Algebra
的用法示例。
在下文中一共展示了Algebra::choice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMtrxVal
void Alignment<R,L,AL>::calculateGlobal(const PPForest<L> *ppfx, const PPForest<L> *ppfy, const Algebra<R,L> &alg, bool noSpeedup)
{
assert(ppfx != NULL);
assert(ppfy != NULL);
Ulong m,n,h,cols;
long i,k;
Uint j,l,r;
R score,h_score;
// alloc space for the score matrix, backtrack structure and , if wanted, for the calculation-order-matrix
m_mtrxSize=ppfx->getNumCSFs()*ppfy->getNumCSFs();
m_mtrx=new R[m_mtrxSize];
m_rowStart=new Ulong[ppfx->getNumCSFs()];
m_ppfx = new PPForest<L>(*ppfx); // copy the ppforests
m_ppfy = new PPForest<L>(*ppfy);
m_alg=&alg;
m_rnaAlg=NULL;
m_localOptimum=alg.worst_score();
// initialize variables
m=ppfx->size();
n=ppfy->size();
cols=ppfy->getNumCSFs();
m_rowStart[0]=0;
for(h=1;h<ppfx->getNumCSFs();h++)
m_rowStart[h]=m_rowStart[h-1]+cols;
// align forests fx and fy
// the easiest case ..
setMtrxVal(0,0,alg.empty());
// align fx to the empty forest (fill first row of array)
for(i=m-1;i>=0;i--) // for all nodes in fx
{
for(j=1;j<=ppfx->getMaxLength(i);j++) // for all non empty csfs induced by i
{
score = alg.del(ppfx->label(i),
getMtrxVal(ppfx->down(i),0),
getMtrxVal(ppfx->over(i,j),0));
setMtrxVal(ppfx->indexpos(i,j),0,score);
}
}
// align fy to the empty forest (fill first column of array)
for(k=n-1;k>=0;k--) // for all nodes in fx
{
for(l=1;l<=ppfy->getMaxLength(k);l++) // for all non empty csfs induced by k
{
score = alg.insert(getMtrxVal(0,ppfy->down(k)),
ppfy->label(k),
getMtrxVal(0,ppfy->over(k,l)));
setMtrxVal(0,ppfy->indexpos(k,l),score);
}
}
// align the rest
for(i=m-1;i>=0;i--) // for all nodes in fx
for(k=n-1;k>=0;k--) // for all nodes in fx
{
j=ppfx->getMaxLength(i);
for(l=1;l<=ppfy->getMaxLength(k);l++) // for all non empty csfs induced by k
{
// replace
score = alg.replace(ppfx->label(i),
getMtrxVal(ppfx->down(i),ppfy->down(k)),
ppfy->label(k),
getMtrxVal(ppfx->over(i,j),ppfy->over(k,l)));
// delete
if(ppfx->noc(i)==0 && !noSpeedup) // no child
{
h_score = alg.del(ppfx->label(i),0,
getMtrxVal(ppfx->over(i,j),ppfy->indexpos(k,l)));
score=alg.choice(score,h_score);
}
else
{
if(ppfx->rb(i)==0 && !noSpeedup) // no right brother
{
h_score = alg.del(ppfx->label(i),
getMtrxVal(ppfx->down(i),ppfy->indexpos(k,l)),
0);
score=alg.choice(score,h_score);
}
else
{
h=k; // h is the node where the suffix of the split begins
for(r=0;r<=l;r++) // for all splits of fy
{
//.........这里部分代码省略.........
示例2: progressiveAlign
//.........这里部分代码省略.........
AlignmentLinear<double,RNA_Alphabet_Profile,RNA_Alphabet_Profile> * ali = new AlignmentLinear<double,RNA_Alphabet_Profile,RNA_Alphabet_Profile>(f1,f2,*alg,topdown,anchored,local,printBT);
if (local)
score_mtrx->setAt(x-1,y-1,ali->getLocalOptimum());
else
score_mtrx->setAt(x-1,y-1,ali->getGlobalOptimumRelative());
std::cout << x << "," << y << ": " << score_mtrx->getAt(x-1,y-1) << std::endl;
delete ali;
}
}
}
std::cout << std::endl;
std::vector<RNAProfileAliKeyPairType> inputListMult;
long bestx = 0, besty = 0; // keys of stuctures in inputMapProfile
RNAProfileAlignment *f = NULL;
int level = 1;
while (inputMapProfile.size()>1) {
// find the best score of all pairwise alignments
if (options.has(Options::Affine))
bestScore = alg_affine->worst_score();
else
bestScore = alg->worst_score();
for (it=inputMapProfile.begin(); it!=inputMapProfile.end(); it++) {
x = it->first;
for (it2=inputMapProfile.begin(); it2->first < it->first; it2++) {
double old_bestScore = bestScore;
y = it2->first;
if (options.has(Options::Affine))
bestScore = alg_affine->choice(bestScore,score_mtrx->getAt(x-1,y-1));
else
bestScore = alg->choice(bestScore,score_mtrx->getAt(x-1,y-1));
if (bestScore != old_bestScore) {
bestx = it->first;
besty = it2->first;
old_bestScore = bestScore;
}
}
}
std::cout << "joining alignments:" << std::endl;
// test, if score is better than the threshold value
// if threshold is set generate a vector of best pairs within threshold
bool scoreBetterThanThreshold = false;
if (options.has(Options::Affine))
scoreBetterThanThreshold = (alg_affine->choice(bestScore,threshold)!= threshold);
else
scoreBetterThanThreshold = (alg->choice(bestScore,threshold)!= threshold);
if (scoreBetterThanThreshold) {
int maximize;
Graph graph;
if (options.has(Options::Affine))
graph = makePairsGraph(inputMapProfile,alg_affine,score_mtrx,threshold);
else
graph = makePairsGraph(inputMapProfile,alg,score_mtrx,threshold);
if (options.has(Options::CalculateDistance))
maximize = 0;
else