本文整理汇总了C++中HMM::AddSSPrediction方法的典型用法代码示例。如果您正苦于以下问题:C++ HMM::AddSSPrediction方法的具体用法?C++ HMM::AddSSPrediction怎么用?C++ HMM::AddSSPrediction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HMM
的用法示例。
在下文中一共展示了HMM::AddSSPrediction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalculateSS
// Calculate secondary structure for given HMM and return prediction
void CalculateSS(HMM& q, char *ss_pred, char *ss_conf)
{
char tmpfile[]="/tmp/hhCalcSSXXXXXX";
if (mkstemp(tmpfile) == -1) {
cerr << "ERROR! Could not create tmp-file!\n";
exit(4);
}
// Write log-odds matrix from q to tmpfile.mtx
char filename[NAMELEN];
FILE* mtxf = NULL;
strcpy(filename,tmpfile);
strcat(filename,".mtx");
mtxf = fopen(filename,"w");
if (!mtxf) OpenFileError(filename);
fprintf(mtxf,"%i\n",q.L);
fprintf(mtxf,"%s\n",q.seq[q.nfirst]+1);
fprintf(mtxf,"2.670000e-03\n4.100000e-02\n-3.194183e+00\n1.400000e-01\n2.670000e-03\n4.420198e-02\n-3.118986e+00\n1.400000e-01\n3.176060e-03\n1.339561e-01\n-2.010243e+00\n4.012145e-01\n");
for (int i = 1; i <= q.L; ++i)
{
fprintf(mtxf,"-32768 ");
for (int a = 0; a < 20; ++a)
{
int tmp = iround(50*flog2(q.p[i][s2a[a]]/pb[s2a[a]]));
fprintf(mtxf,"%5i ",tmp);
if (a == 0) { // insert logodds value for B
fprintf(mtxf,"%5i ",-32768);
} else if (a == 18) { // insert logodds value for X
fprintf(mtxf,"%5i ",-100);
} else if (a == 19) { // insert logodds value for Z
fprintf(mtxf,"%5i ",-32768);
}
}
fprintf(mtxf,"-32768 -400\n");
}
fclose(mtxf);
// Calculate secondary structure
CalculateSS(ss_pred, ss_conf, tmpfile);
q.AddSSPrediction(ss_pred, ss_conf);
// Remove temp-files
std::string command = "rm " + (std::string)tmpfile + "*";
runSystem(command,v);
}