本文整理汇总了C++中p7_bg_Create函数的典型用法代码示例。如果您正苦于以下问题:C++ p7_bg_Create函数的具体用法?C++ p7_bg_Create怎么用?C++ p7_bg_Create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了p7_bg_Create函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = esl_getopts_CreateDefaultApp(options, 1, argc, argv, banner, usage);
char *hmmfile = esl_opt_GetArg(go, 1);
ESL_STOPWATCH *w = esl_stopwatch_Create();
ESL_RANDOMNESS *r = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
ESL_ALPHABET *abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
P7_BG *bg = NULL;
P7_PROFILE *gm = NULL;
P7_OPROFILE *om = NULL;
P7_GMX *gx = NULL;
P7_OMX *fwd = NULL;
P7_TRACE *tr = NULL;
int L = esl_opt_GetInteger(go, "-L");
int N = esl_opt_GetInteger(go, "-N");
ESL_DSQ *dsq = malloc(sizeof(ESL_DSQ) * (L+2));
int i;
float sc, fsc, vsc;
float bestsc = -eslINFINITY;
if (p7_hmmfile_Open(hmmfile, NULL, &hfp) != eslOK) p7_Fail("Failed to open HMM file %s", hmmfile);
if (p7_hmmfile_Read(hfp, &abc, &hmm) != eslOK) p7_Fail("Failed to read HMM");
bg = p7_bg_Create(abc); p7_bg_SetLength(bg, L);
gm = p7_profile_Create(hmm->M, abc); p7_ProfileConfig(hmm, bg, gm, L, p7_UNILOCAL);
om = p7_oprofile_Create(gm->M, abc); p7_oprofile_Convert(gm, om);
fwd = p7_omx_Create(gm->M, L, L);
gx = p7_gmx_Create(gm->M, L);
tr = p7_trace_Create();
esl_rsq_xfIID(r, bg->f, abc->K, L, dsq);
p7_GViterbi(dsq, L, gm, gx, &vsc);
p7_Forward (dsq, L, om, fwd, &fsc);
esl_stopwatch_Start(w);
for (i = 0; i < N; i++)
{
p7_StochasticTrace(r, dsq, L, om, fwd, tr);
p7_trace_Score(tr, dsq, gm, &sc);
bestsc = ESL_MAX(bestsc, sc);
p7_trace_Reuse(tr);
}
esl_stopwatch_Stop(w);
esl_stopwatch_Display(stdout, w, "# CPU time: ");
printf("forward sc = %.4f nats\n", fsc);
printf("viterbi sc = %.4f nats\n", vsc);
printf("max trace sc = %.4f nats\n", bestsc);
free(dsq);
p7_trace_Destroy(tr);
p7_gmx_Destroy(gx);
p7_omx_Destroy(fwd);
p7_oprofile_Destroy(om);
p7_profile_Destroy(gm);
p7_bg_Destroy(bg);
p7_hmm_Destroy(hmm);
p7_hmmfile_Close(hfp);
esl_alphabet_Destroy(abc);
esl_stopwatch_Destroy(w);
esl_randomness_Destroy(r);
esl_getopts_Destroy(go);
return 0;
}
开发者ID:Denis84,项目名称:EPA-WorkBench,代码行数:68,代码来源:stotrace.c
示例2: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 1, argc, argv, banner, usage);
char *hmmfile = esl_opt_GetArg(go, 1);
ESL_RANDOMNESS *r = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
ESL_ALPHABET *abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
P7_BG *bg = NULL;
P7_PROFILE *gm = NULL;
P7_OPROFILE *om = NULL;
double lambda = 0.0;
double mmu = 0.0;
double vmu = 0.0;
double ftau = 0.0;
int Z = esl_opt_GetInteger(go, "-Z");
int EmL = esl_opt_GetInteger(go, "--EmL");
int EmN = esl_opt_GetInteger(go, "--EmN");
int EvL = esl_opt_GetInteger(go, "--EvL");
int EvN = esl_opt_GetInteger(go, "--EvN");
int EfL = esl_opt_GetInteger(go, "--EfL");
int EfN = esl_opt_GetInteger(go, "--EfN");
int Eft = esl_opt_GetReal (go, "--Eft");
int iteration;
int do_msv, do_vit, do_fwd;
int status;
if (esl_opt_GetBoolean(go, "--msvonly") == TRUE) { do_msv = TRUE; do_vit = FALSE; do_fwd = FALSE; }
else if (esl_opt_GetBoolean(go, "--vitonly") == TRUE) { do_msv = FALSE; do_vit = TRUE; do_fwd = FALSE; }
else if (esl_opt_GetBoolean(go, "--fwdonly") == TRUE) { do_msv = FALSE; do_vit = FALSE; do_fwd = TRUE; }
else { do_msv = TRUE; do_vit = TRUE; do_fwd = TRUE; }
if (p7_hmmfile_OpenE(hmmfile, NULL, &hfp, NULL) != eslOK) p7_Fail("Failed to open HMM file %s", hmmfile);
while ((status = p7_hmmfile_Read(hfp, &abc, &hmm)) != eslEOF)
{
if (bg == NULL) bg = p7_bg_Create(abc);
gm = p7_profile_Create(hmm->M, abc);
p7_ProfileConfig(hmm, bg, gm, EvL, p7_LOCAL); /* the EvL doesn't matter */
om = p7_oprofile_Create(hmm->M, abc);
p7_oprofile_Convert(gm, om);
if (esl_opt_IsOn(go, "--lambda")) lambda = esl_opt_GetReal(go, "--lambda");
else p7_Lambda(hmm, bg, &lambda);
for (iteration = 0; iteration < Z; iteration++)
{
if (do_msv) p7_MSVMu (r, om, bg, EmL, EmN, lambda, &mmu);
if (do_vit) p7_ViterbiMu (r, om, bg, EvL, EvN, lambda, &vmu);
if (do_fwd) p7_Tau (r, om, bg, EfL, EfN, lambda, Eft, &ftau);
printf("%s %.4f %.4f %.4f %.4f\n", hmm->name, lambda, mmu, vmu, ftau);
}
p7_hmm_Destroy(hmm);
p7_profile_Destroy(gm);
p7_oprofile_Destroy(om);
}
p7_hmmfile_Close(hfp);
p7_bg_Destroy(bg);
esl_alphabet_Destroy(abc);
esl_randomness_Destroy(r);
esl_getopts_Destroy(go);
return eslOK;
}
开发者ID:ElofssonLab,项目名称:TOPCONS2,代码行数:66,代码来源:evalues.c
示例3: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = NULL;
int i, j;
int status = eslOK;
P7_HMMFILE *hfp = NULL; /* open input HMM file */
P7_HMM *hmm = NULL; /* one HMM query */
ESL_ALPHABET *abc = NULL; /* digital alphabet */
P7_BG *bg = NULL;
char errbuf[eslERRBUFSIZE];
char* hmmfile;
float *rel_ents = NULL;
float **heights = NULL;
float **probs = NULL;
float *ins_P = NULL;
float *ins_expL = NULL;
float *occupancy = NULL;
int mode = HMMLOGO_RELENT_ALL; //default
go = esl_getopts_Create(options);
if (esl_opt_ProcessCmdline(go, argc, argv) != eslOK) esl_fatal(argv[0], "Failed to parse command line: %s\n", go->errbuf);
if (esl_opt_VerifyConfig(go) != eslOK) esl_fatal(argv[0], "Error in configuration: %s\n", go->errbuf);
if (esl_opt_GetBoolean(go, "-h") ) {
p7_banner (stdout, argv[0], banner);
esl_usage (stdout, argv[0], usage);
puts("\nOptions:");
esl_opt_DisplayHelp(stdout, go, 1, 2, 100);
exit(0);
}
if (esl_opt_ArgNumber(go) != 1) esl_fatal(argv[0], "Incorrect number of command line arguments.\n");
hmmfile = esl_opt_GetArg(go, 1);
if (esl_opt_IsOn(go, "--height_relent_all"))
mode = HMMLOGO_RELENT_ALL;
else if (esl_opt_IsOn(go, "--height_relent_abovebg"))
mode = HMMLOGO_RELENT_ABOVEBG;
else if (esl_opt_IsOn(go, "--height_score"))
mode = HMMLOGO_SCORE;
else
mode = HMMLOGO_RELENT_ALL; //default
/* Open the query profile HMM file */
status = p7_hmmfile_OpenE(hmmfile, NULL, &hfp, errbuf);
if (status == eslENOTFOUND) p7_Fail("File existence/permissions problem in trying to open HMM file %s.\n%s\n", hmmfile, errbuf);
else if (status == eslEFORMAT) p7_Fail("File format problem in trying to open HMM file %s.\n%s\n", hmmfile, errbuf);
else if (status != eslOK) p7_Fail("Unexpected error %d in opening HMM file %s.\n%s\n", status, hmmfile, errbuf);
status = p7_hmmfile_Read(hfp, &abc, &hmm);
bg = p7_bg_Create(abc);
ESL_ALLOC(rel_ents, (hmm->M+1) * sizeof(float));
ESL_ALLOC(heights, (hmm->M+1) * sizeof(float*));
ESL_ALLOC(probs, (hmm->M+1) * sizeof(float*));
for (i = 1; i <= hmm->M; i++) {
ESL_ALLOC(heights[i], abc->K * sizeof(float));
ESL_ALLOC(probs[i], abc->K * sizeof(float));
}
/* residue heights */
if (mode == HMMLOGO_RELENT_ALL) {
printf ("max expected height = %.2f\n", hmmlogo_maxHeight(bg) );
hmmlogo_RelativeEntropy_all(hmm, bg, rel_ents, probs, heights);
} else if (mode == HMMLOGO_RELENT_ABOVEBG) {
printf ("max expected height = %.2f\n", hmmlogo_maxHeight(bg) );
hmmlogo_RelativeEntropy_above_bg(hmm, bg, rel_ents, probs, heights);
} else if (mode == HMMLOGO_SCORE) {
hmmlogo_ScoreHeights(hmm, bg, heights );
}
printf ("Residue heights\n");
for (i = 1; i <= hmm->M; i++) {
printf("%d: ", i);
for (j=0; j<abc->K; j++)
printf("%6.3f ", heights[i][j] );
if (mode != HMMLOGO_SCORE)
printf(" (%6.3f)", rel_ents[i]);
printf("\n");
}
if (rel_ents != NULL) free(rel_ents);
if (heights != NULL) {
for (i = 1; i <= hmm->M; i++)
if (heights[i] != NULL) free(heights[i]);
free(heights);
}
//.........这里部分代码省略.........
开发者ID:dboudour2002,项目名称:musicHMMER,代码行数:101,代码来源:hmmlogo.c
示例4: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 1, argc, argv, banner, usage);
char *hmmfile = esl_opt_GetArg(go, 1);
ESL_STOPWATCH *w = esl_stopwatch_Create();
ESL_RANDOMNESS *r = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
ESL_ALPHABET *abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
P7_BG *bg = NULL;
P7_PROFILE *gm = NULL;
P7_OPROFILE *om = NULL;
P7_OMX *ox1 = NULL;
P7_OMX *ox2 = NULL;
int L = esl_opt_GetInteger(go, "-L");
int N = esl_opt_GetInteger(go, "-N");
ESL_DSQ *dsq = malloc(sizeof(ESL_DSQ) * (L+2));
float null2[p7_MAXCODE];
int i,j,d,pos;
int nsamples = 200;
float fsc, bsc;
double Mcs;
if (p7_hmmfile_OpenE(hmmfile, NULL, &hfp, NULL) != eslOK) p7_Fail("Failed to open HMM file %s", hmmfile);
if (p7_hmmfile_Read(hfp, &abc, &hmm) != eslOK) p7_Fail("Failed to read HMM");
bg = p7_bg_Create(abc); p7_bg_SetLength(bg, L);
gm = p7_profile_Create(hmm->M, abc); p7_ProfileConfig(hmm, bg, gm, L, p7_LOCAL);
om = p7_oprofile_Create(gm->M, abc); p7_oprofile_Convert(gm, om);
p7_oprofile_ReconfigLength(om, L);
ox1 = p7_omx_Create(gm->M, L, L);
ox2 = p7_omx_Create(gm->M, L, L);
esl_rsq_xfIID(r, bg->f, abc->K, L, dsq);
p7_Forward (dsq, L, om, ox1, &fsc);
if (esl_opt_GetBoolean(go, "-t"))
{
P7_TRACE *tr = p7_trace_Create();
float *n2sc = malloc(sizeof(float) * (L+1));
esl_stopwatch_Start(w);
for (i = 0; i < N; i++)
{ /* This is approximately what p7_domaindef.c::region_trace_ensemble() is doing: */
for (j = 0; j < nsamples; j++)
{
p7_StochasticTrace(r, dsq, L, om, ox1, tr);
p7_trace_Index(tr);
pos = 1;
for (d = 0; d < tr->ndom; d++)
{
p7_Null2_ByTrace(om, tr, tr->tfrom[d], tr->tto[d], ox2, null2);
for (; pos <= tr->sqfrom[d]; pos++) n2sc[pos] += 1.0;
for (; pos < tr->sqto[d]; pos++) n2sc[pos] += null2[dsq[pos]];
}
for (; pos <= L; pos++) n2sc[pos] += 1.0;
p7_trace_Reuse(tr);
}
for (pos = 1; pos <= L; pos++)
n2sc[pos] = logf(n2sc[pos] / nsamples);
}
esl_stopwatch_Stop(w);
free(n2sc);
p7_trace_Destroy(tr);
}
else
{
p7_Backward(dsq, L, om, ox1, ox2, &bsc);
p7_Decoding(om, ox1, ox2, ox2);
esl_stopwatch_Start(w);
for (i = 0; i < N; i++)
p7_Null2_ByExpectation(om, ox2, null2);
esl_stopwatch_Stop(w);
}
Mcs = (double) N * (double) L * (double) gm->M * 1e-6 / (double) w->user;
esl_stopwatch_Display(stdout, w, "# CPU time: ");
printf("# M = %d\n", gm->M);
printf("# %.1f Mc/s\n", Mcs);
free(dsq);
p7_omx_Destroy(ox1);
p7_omx_Destroy(ox2);
p7_oprofile_Destroy(om);
p7_profile_Destroy(gm);
p7_bg_Destroy(bg);
p7_hmm_Destroy(hmm);
p7_hmmfile_Close(hfp);
esl_alphabet_Destroy(abc);
esl_stopwatch_Destroy(w);
esl_randomness_Destroy(r);
esl_getopts_Destroy(go);
return 0;
}
开发者ID:dboudour2002,项目名称:musicHMMER,代码行数:100,代码来源:null2.c
示例5: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = esl_getopts_CreateDefaultApp(options, 1, argc, argv, banner, usage);
char *hmmfile = esl_opt_GetArg(go, 1);
ESL_STOPWATCH *w = esl_stopwatch_Create();
ESL_RANDOMNESS *r = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
ESL_ALPHABET *abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
P7_BG *bg = NULL;
P7_PROFILE *gm = NULL;
P7_OPROFILE *om = NULL;
P7_OMX *ox = NULL;
P7_GMX *gx = NULL;
int L = esl_opt_GetInteger(go, "-L");
int N = esl_opt_GetInteger(go, "-N");
ESL_DSQ *dsq = malloc(sizeof(ESL_DSQ) * (L+2));
int i;
float sc1, sc2;
double base_time, bench_time, Mcs;
if (p7_hmmfile_Open(hmmfile, NULL, &hfp) != eslOK) p7_Fail("Failed to open HMM file %s", hmmfile);
if (p7_hmmfile_Read(hfp, &abc, &hmm) != eslOK) p7_Fail("Failed to read HMM");
bg = p7_bg_Create(abc);
p7_bg_SetLength(bg, L);
gm = p7_profile_Create(hmm->M, abc);
p7_ProfileConfig(hmm, bg, gm, L, p7_LOCAL);
om = p7_oprofile_Create(gm->M, abc);
p7_oprofile_Convert(gm, om);
p7_oprofile_ReconfigLength(om, L);
if (esl_opt_GetBoolean(go, "-x")) p7_profile_SameAsVF(om, gm);
ox = p7_omx_Create(gm->M, 0, 0);
gx = p7_gmx_Create(gm->M, L);
/* Get a baseline time: how long it takes just to generate the sequences */
esl_stopwatch_Start(w);
for (i = 0; i < N; i++)
esl_rsq_xfIID(r, bg->f, abc->K, L, dsq);
esl_stopwatch_Stop(w);
base_time = w->user;
/* Run the benchmark */
esl_stopwatch_Start(w);
for (i = 0; i < N; i++)
{
esl_rsq_xfIID(r, bg->f, abc->K, L, dsq);
p7_ViterbiFilter(dsq, L, om, ox, &sc1);
if (esl_opt_GetBoolean(go, "-c"))
{
p7_GViterbi(dsq, L, gm, gx, &sc2);
printf("%.4f %.4f\n", sc1, sc2);
}
if (esl_opt_GetBoolean(go, "-x"))
{
p7_GViterbi(dsq, L, gm, gx, &sc2);
sc2 /= om->scale_w;
if (om->mode == p7_UNILOCAL) sc2 -= 2.0; /* that's ~ L \log \frac{L}{L+2}, for our NN,CC,JJ */
else if (om->mode == p7_LOCAL) sc2 -= 3.0; /* that's ~ L \log \frac{L}{L+3}, for our NN,CC,JJ */
printf("%.4f %.4f\n", sc1, sc2);
}
}
esl_stopwatch_Stop(w);
bench_time = w->user - base_time;
Mcs = (double) N * (double) L * (double) gm->M * 1e-6 / (double) bench_time;
esl_stopwatch_Display(stdout, w, "# CPU time: ");
printf("# M = %d\n", gm->M);
printf("# %.1f Mc/s\n", Mcs);
free(dsq);
p7_omx_Destroy(ox);
p7_gmx_Destroy(gx);
p7_oprofile_Destroy(om);
p7_profile_Destroy(gm);
p7_bg_Destroy(bg);
p7_hmm_Destroy(hmm);
p7_hmmfile_Close(hfp);
esl_alphabet_Destroy(abc);
esl_stopwatch_Destroy(w);
esl_randomness_Destroy(r);
esl_getopts_Destroy(go);
return 0;
}
开发者ID:TuftsBCB,项目名称:SMURFBuild,代码行数:88,代码来源:vitfilter.c
示例6: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = esl_getopts_CreateDefaultApp(options, 1, argc, argv, banner, usage);
char *hmmfile = esl_opt_GetArg(go, 1);
ESL_STOPWATCH *w = esl_stopwatch_Create();
ESL_RANDOMNESS *r = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
ESL_ALPHABET *abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
P7_BG *bg = NULL;
P7_PROFILE *gm = NULL;
P7_GMX *gx = NULL;
int L = esl_opt_GetInteger(go, "-L");
int N = esl_opt_GetInteger(go, "-N");
ESL_DSQ *dsq = malloc(sizeof(ESL_DSQ) * (L+2));
int i;
float sc;
double base_time, bench_time, Mcs;
if (p7_hmmfile_Open(hmmfile, NULL, &hfp) != eslOK) p7_Fail("Failed to open HMM file %s", hmmfile);
if (p7_hmmfile_Read(hfp, &abc, &hmm) != eslOK) p7_Fail("Failed to read HMM");
bg = p7_bg_Create(abc);
p7_bg_SetLength(bg, L);
gm = p7_profile_Create(hmm->M, abc);
p7_ProfileConfig(hmm, bg, gm, L, p7_UNILOCAL);
gx = p7_gmx_Create(gm->M, L);
/* Baseline time. */
esl_stopwatch_Start(w);
for (i = 0; i < N; i++) esl_rsq_xfIID(r, bg->f, abc->K, L, dsq);
esl_stopwatch_Stop(w);
base_time = w->user;
/* Benchmark time. */
esl_stopwatch_Start(w);
for (i = 0; i < N; i++)
{
esl_rsq_xfIID(r, bg->f, abc->K, L, dsq);
p7_GViterbi (dsq, L, gm, gx, &sc);
}
esl_stopwatch_Stop(w);
bench_time = w->user - base_time;
Mcs = (double) N * (double) L * (double) gm->M * 1e-6 / (double) bench_time;
esl_stopwatch_Display(stdout, w, "# CPU time: ");
printf("# M = %d\n", gm->M);
printf("# %.1f Mc/s\n", Mcs);
free(dsq);
p7_gmx_Destroy(gx);
p7_profile_Destroy(gm);
p7_bg_Destroy(bg);
p7_hmm_Destroy(hmm);
p7_hmmfile_Close(hfp);
esl_alphabet_Destroy(abc);
esl_stopwatch_Destroy(w);
esl_randomness_Destroy(r);
esl_getopts_Destroy(go);
return 0;
}
开发者ID:Denis84,项目名称:EPA-WorkBench,代码行数:62,代码来源:generic_viterbi.c
示例7: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 1, argc, argv, banner, usage);
char *hmmfile = esl_opt_GetArg(go, 1);
ESL_STOPWATCH *w = esl_stopwatch_Create();
ESL_RANDOMNESS *r = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
ESL_ALPHABET *abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
P7_BG *bg = NULL;
P7_PROFILE *gm = NULL;
P7_GMX *gx1 = NULL;
P7_GMX *gx2 = NULL;
P7_TRACE *tr = NULL;
int L = esl_opt_GetInteger(go, "-L");
int N = esl_opt_GetInteger(go, "-N");
ESL_DSQ *dsq = malloc(sizeof(ESL_DSQ) * (L+2));
int i;
float fsc, bsc, accscore;
double Mcs;
p7_FLogsumInit();
if (p7_hmmfile_OpenE(hmmfile, NULL, &hfp, NULL) != eslOK) p7_Fail("Failed to open HMM file %s", hmmfile);
if (p7_hmmfile_Read(hfp, &abc, &hmm) != eslOK) p7_Fail("Failed to read HMM");
bg = p7_bg_Create(abc);
p7_bg_SetLength(bg, L);
gm = p7_profile_Create(hmm->M, abc);
p7_ProfileConfig(hmm, bg, gm, L, p7_UNILOCAL);
gx1 = p7_gmx_Create(gm->M, L);
gx2 = p7_gmx_Create(gm->M, L);
tr = p7_trace_CreateWithPP();
esl_rsq_xfIID(r, bg->f, abc->K, L, dsq);
p7_GForward (dsq, L, gm, gx1, &fsc);
p7_GBackward(dsq, L, gm, gx2, &bsc);
p7_GDecoding(gm, gx1, gx2, gx2); /* <gx2> is now the posterior decoding matrix */
esl_stopwatch_Start(w);
for (i = 0; i < N; i++)
{
p7_GOptimalAccuracy(gm, gx2, gx1, &accscore); /* <gx1> is now the OA matrix */
if (! esl_opt_GetBoolean(go, "--notrace"))
{
p7_GOATrace(gm, gx2, gx1, tr);
p7_trace_Reuse(tr);
}
}
esl_stopwatch_Stop(w);
Mcs = (double) N * (double) L * (double) gm->M * 1e-6 / w->user;
esl_stopwatch_Display(stdout, w, "# CPU time: ");
printf("# M = %d\n", gm->M);
printf("# %.1f Mc/s\n", Mcs);
free(dsq);
p7_trace_Destroy(tr);
p7_gmx_Destroy(gx1);
p7_gmx_Destroy(gx2);
p7_profile_Destroy(gm);
p7_bg_Destroy(bg);
p7_hmm_Destroy(hmm);
p7_hmmfile_Close(hfp);
esl_alphabet_Destroy(abc);
esl_stopwatch_Destroy(w);
esl_randomness_Destroy(r);
esl_getopts_Destroy(go);
return 0;
}
开发者ID:ElofssonLab,项目名称:TOPCONS2,代码行数:71,代码来源:generic_optacc.c
示例8: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 1, argc, argv, banner, usage);
char *hmmfile = esl_opt_GetArg(go, 1);
ESL_ALPHABET *abc = esl_alphabet_Create(eslAMINO);
P7_BG *bg = p7_bg_Create(abc);
int my_rank;
int nproc;
char *buf = NULL;
int nbuf = 0;
int subtotalM = 0;
int allM = 0;
int stalling = esl_opt_GetBoolean(go, "--stall");
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
while (stalling);
/* Master MPI process: */
if (my_rank == 0)
{
ESL_STOPWATCH *w = esl_stopwatch_Create();
P7_HMMFILE *hfp = NULL;
P7_OPROFILE *om = NULL;
P7_HMM *hmm = NULL;
/* Read HMMs from a file. */
if (p7_hmmfile_OpenE(hmmfile, NULL, &hfp, NULL) != eslOK) p7_Fail("Failed to open HMM file %s", hmmfile);
esl_stopwatch_Start(w);
while (p7_oprofile_ReadMSV(hfp, &abc, &om) == eslOK &&
p7_oprofile_ReadRest(hfp, om) == eslOK)
{
if (!esl_opt_GetBoolean(go, "-b"))
p7_oprofile_MPISend(om, 1, 0, MPI_COMM_WORLD, &buf, &nbuf); /* 1 = dest; 0 = tag */
p7_hmm_Destroy(hmm);
p7_oprofile_Destroy(om);
}
p7_oprofile_MPISend(NULL, 1, 0, MPI_COMM_WORLD, &buf, &nbuf); /* send the "no more HMMs" sign */
MPI_Reduce(&subtotalM, &allM, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
printf("total: %d\n", allM);
esl_stopwatch_Stop(w);
esl_stopwatch_Display(stdout, w, "CPU Time: ");
esl_stopwatch_Destroy(w);
}
/* Worker MPI process: */
else
{
P7_OPROFILE *om_recd = NULL;
while (p7_oprofile_MPIRecv(0, 0, MPI_COMM_WORLD, &buf, &nbuf, &abc, &om_recd) == eslOK)
{
subtotalM += om_recd->M;
p7_oprofile_Destroy(om_recd);
}
MPI_Reduce(&subtotalM, &allM, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
}
free(buf);
p7_bg_Destroy(bg);
esl_alphabet_Destroy(abc);
esl_getopts_Destroy(go);
MPI_Finalize();
exit(0);
}
开发者ID:Janelia-Farm-Xfam,项目名称:Bio-HMM-Logo,代码行数:70,代码来源:mpi.c
示例9: main
int main(int argc, char **argv)
{
ESL_GETOPTS *go = esl_getopts_CreateDefaultApp(options, 2, argc, argv, banner, usage);
char *hmmfile = esl_opt_GetArg(go, 1);
char *seqfile = esl_opt_GetArg(go, 2);
ESL_STOPWATCH *w = esl_stopwatch_Create();
ESL_RANDOMNESS*r = esl_randomness_Create(esl_opt_GetInteger(go, "-s"));
ESL_ALPHABET*abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
P7_BG *bg = NULL;
P7_PROFILE *gm1, *gm2;
int L = esl_opt_GetInteger(go, "-L");
int N = esl_opt_GetInteger(go, "-N") / SSE16_NVALS;
int MaxPart = esl_opt_GetInteger(go, "-M");
int NROUNDS = esl_opt_GetInteger(go, "-R");
int check = esl_opt_GetBoolean(go, "-c");
__m128 resdata[10];
int i, j;
float *sc1 = (float*) resdata;
ESL_SQFILE *sqfp = NULL;
DATA_COPS16 *dcops;
struct timeb tbstart, tbend;
int sumlengths = 0;
float* results = NULL;
srand(time(NULL));
if (p7_hmmfile_Open(hmmfile, NULL, &hfp) != eslOK) p7_Fail("Failed to open HMM file %s", hmmfile);
if (p7_hmmfile_Read(hfp, &abc, &hmm) != eslOK) p7_Fail("Failed to read HMM");
bg = p7_bg_Create(abc);
p7_bg_SetLength(bg, L);
gm1 = p7_profile_Create(hmm->M, abc);
gm2 = p7_profile_Create(hmm->M, abc);
p7_ProfileConfig(hmm, bg, gm1, L, p7_UNILOCAL);
p7_ProfileConfig(hmm, bg, gm2, L, p7_UNILOCAL);
dcops = p7_ViterbiCOPSw_Create(gm1);
p7_ViterbiCOPSW_Setup(dcops, L+100, MaxPart); // use max L
dcops->L = L;
int dbsize = SSE16_NVALS*N;
SEQ **seqsdb= calloc(dbsize+1, sizeof(SEQ*));
int equallength = 1;
if (esl_sqfile_OpenDigital(abc, seqfile, eslSQFILE_FASTA, NULL, &sqfp) == eslOK)
{ // Use Sequence file
ESL_SQ* sq = esl_sq_CreateDigital(abc);
int maxseqs, len=0;
if (esl_opt_IsDefault(go, "-N")) // N not specified in cmdline
maxseqs = INT_MAX; // no limit
else
maxseqs = SSE16_NVALS*N; // use cmdline limit
for (j = 0; j < maxseqs && esl_sqio_Read(sqfp, sq) == eslOK; j++)
{
if (equallength && sq->n != len && j > 0)
equallength = 0;
len = sq->n;
if (j > dbsize)
{ seqsdb = realloc(seqsdb, 2*(dbsize+1)*sizeof(SEQ*));
dbsize *= 2;
}
ESL_DSQ* dsq = sq->dsq;
seqsdb[j] = malloc(sizeof(SEQ));
seqsdb[j]->length = len;
seqsdb[j]->seq = malloc((len+4)*sizeof(ESL_DSQ));
memcpy(seqsdb[j]->seq, dsq, len+2);
sumlengths += len;
esl_sq_Reuse(sq);
}
N = j/SSE16_NVALS;
}
else // Not found database. Generate random sequences
for (i = 0; i < N; i++)
for (j = 0; j < SSE16_NVALS; j++)
{
int len = L; // - rand()%1000;
seqsdb[i*SSE16_NVALS+j] = malloc(sizeof(SEQ));
seqsdb[i*SSE16_NVALS+j]->seq = malloc(len+4);
seqsdb[i*SSE16_NVALS+j]->length = len;
esl_rsq_xfIID(r, bg->f, abc->K, len, seqsdb[i*SSE16_NVALS+j]->seq);
sumlengths += len;
}
printf("Viterbi COPS Word with %d threads, model %s. ModelLen: %d, #Segms: %d, SeqL.: %d, #seqs: %d, Partition: %d, #parts: %d\n",
NTHREADS, hmmfile, gm1->M, (int) ceil(gm1->M/SSE16_NVALS), L, SSE16_NVALS*N*NROUNDS, dcops->partition, dcops->Npartitions);
/* // No. of partitions computed without full parallelism ( == no. of threads active while some are idle)
int Niters_part = dcops->Npartitions % NTHREADS;
// No. of Model lines that could be computed but are wasted by idle threads waiting on the end
int Nwasted_threads = dcops->partition * ((NTHREADS-Niters_part) % NTHREADS);
// No. of lines in the last partition that go beyond M. It's wasted comp time by a single thread
int Nwasted_leftover= (dcops->partition - gm1->M % dcops->partition) % dcops->partition;
// Total number of wasted lines
int wastedcomp = Nwasted_threads + Nwasted_leftover;
// Total number of lines computed and waited for
//.........这里部分代码省略.........
开发者ID:ParaSky,项目名称:cops,代码行数:101,代码来源:viterbi_cops.c
示例10: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = esl_getopts_CreateDefaultApp(options, 1, argc, argv, banner, usage);
char *hmmfile = esl_opt_GetArg(go, 1);
int N = esl_opt_GetInteger(go, "-N");
ESL_STOPWATCH *w = esl_stopwatch_Create();
ESL_RANDOMNESS *r = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
ESL_ALPHABET *abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
P7_BG *bg = NULL;
P7_PROFILE *gm = NULL;
P7_OPROFILE *om = NULL;
P7_TRACE *tr = NULL;
ESL_SQ *sq = NULL;
P7_ALIDISPLAY *ad = NULL;
int i,z;
if (p7_hmmfile_Open(hmmfile, NULL, &hfp) != eslOK) p7_Fail("Failed to open HMM file %s", hmmfile);
if (p7_hmmfile_Read(hfp, &abc, &hmm) != eslOK) p7_Fail("Failed to read HMM");
p7_hmmfile_Close(hfp);
bg = p7_bg_Create(abc);
p7_bg_SetLength(bg, 0);
gm = p7_profile_Create(hmm->M, abc);
p7_ProfileConfig(hmm, bg, gm, 0, p7_UNIGLOCAL); /* that sets N,C,J to generate nothing */
om = p7_oprofile_Create(gm->M, abc);
p7_oprofile_Convert(gm, om);
if (esl_opt_GetBoolean(go, "-p")) tr = p7_trace_CreateWithPP();
else tr = p7_trace_Create();
sq = esl_sq_CreateDigital(abc);
esl_stopwatch_Start(w);
for (i = 0; i < N; i++)
{
p7_ProfileEmit(r, hmm, gm, bg, sq, tr);
esl_sq_SetName(sq, "random");
if (! esl_opt_GetBoolean(go, "-b"))
{
if (esl_opt_GetBoolean(go, "-p"))
for (z = 0; z < tr->N; z++)
if (tr->i[z] > 0) tr->pp[z] = esl_random(r);
ad = p7_alidisplay_Create(tr, 0, om, sq);
p7_alidisplay_Print(stdout, ad, 40, 80, FALSE);
p7_alidisplay_Destroy(ad);
}
p7_trace_Reuse(tr);
esl_sq_Reuse(sq);
}
esl_stopwatch_Stop(w);
esl_stopwatch_Display(stdout, w, "# CPU time: ");
esl_sq_Destroy(sq);
p7_trace_Destroy(tr);
p7_oprofile_Destroy(om);
p7_profile_Destroy(gm);
p7_bg_Destroy(bg);
p7_hmm_Destroy(hmm);
esl_alphabet_Destroy(abc);
esl_randomness_Destroy(r);
esl_stopwatch_Destroy(w);
esl_getopts_Destroy(go);
return 0;
}
开发者ID:Denis84,项目名称:EPA-WorkBench,代码行数:70,代码来源:p7_alidisplay.c
示例11: main
//.........这里部分代码省略.........
*/
status = p7_hmmfile_OpenE(hmmfile, NULL, &hfp, errbuf);
if (status == eslENOTFOUND) p7_Fail("File existence/permissions problem in trying to open HMM file %s.\n%s\n", hmmfile, errbuf);
else if (status == eslEFORMAT) p7_Fail("File format problem in trying to open HMM file %s.\n%s\n", hmmfile, errbuf);
else if (status != eslOK) p7_Fail("Unexpected error %d in opening HMM file %s.\n%s\n", status, hmmfile, errbuf);
/* Main body: read HMMs one at a time, print one line of stats
*/
printf("#\n");
printf("# %-4s %-20s %-12s %8s %8s %6s %6s %6s %6s %6s", "idx", "name", "accession", "nseq", "eff_nseq", "M", "relent", "info", "p relE", "compKL");
if (do_eval2score)
printf (" %6s %6.2g", "sc for", e_val);
if (do_score2eval)
printf (" %6s %6.2f", "E-val for", s_val);
printf("\n");
printf("# %-4s %-20s %-12s %8s %8s %6s %6s %6s %6s %6s", "----", "--------------------", "------------", "--------", "--------", "------", "------", "------", "------", "------");
if (do_eval2score)
printf (" %13s", "-------------");
if (do_score2eval)
printf (" %13s", "-------------");
printf("\n");
nhmm = 0;
while ((status = p7_hmmfile_Read(hfp, &abc, &hmm)) != eslEOF)
{
if (status == eslEOD) esl_fatal("read failed, HMM file %s may be truncated?", hmmfile);
else if (status == eslEFORMAT) esl_fatal("bad file format in HMM file %s", hmmfile);
else if (status == eslEINCOMPAT) esl_fatal("HMM file %s contains different alphabets", hmmfile);
else if (status != eslOK) esl_fatal("Unexpected error in reading HMMs from %s", hmmfile);
nhmm++;
if ( esl_opt_IsOn(go, "--eval2score") || esl_opt_IsOn(go, "--score2eval") ) {
if (esl_opt_IsUsed(go, "--baseZ") || esl_opt_IsUsed(go, "--baseZ1" ) ) {
if ( hmm->abc->type != eslRNA && hmm->abc->type != eslDNA) {
puts("The flags --baseZ and --baseZ1 can't be used with non-nucleotide models.");
esl_usage(stdout, argv[0], usage);
printf("\nTo see more help on available options, do %s -h\n\n", argv[0]);
exit(1);
}
} else if ( hmm->abc->type != eslAMINO && hmm->abc->type != eslRNA && hmm->abc->type != eslDNA) {
puts("The flags --eval2score and --score2eval can't be used with non-sequence models.");
esl_usage(stdout, argv[0], usage);
printf("\nTo see more help on available options, do %s -h\n\n", argv[0]);
exit(1);
}
}
if (esl_opt_IsUsed(go, "--baseZ") ) {
nseq = (float)z_val / (float)(hmm->max_length);
} else if (esl_opt_IsUsed(go, "--baseZ1") ) {
nseq = (float)z_val / (float)(hmm->max_length);
} else {
nseq = z_val;
}
if (bg == NULL) bg = p7_bg_Create(abc);
p7_MeanPositionRelativeEntropy(hmm, bg, &x);
p7_hmm_CompositionKLDist(hmm, bg, &KL, NULL);
printf("%-6d %-20s %-12s %8d %8.2f %6d %6.2f %6.2f %6.2f %6.2f",
nhmm,
hmm->name,
hmm->acc == NULL ? "-" : hmm->acc,
hmm->nseq,
hmm->eff_nseq,
hmm->M,
p7_MeanMatchRelativeEntropy(hmm, bg),
p7_MeanMatchInfo(hmm, bg),
x,
KL);
if ( do_eval2score )
{
float sc;
sc = esl_exp_invsurv( e_val / nseq , hmm->evparam[p7_FTAU], hmm->evparam[p7_FLAMBDA]);
printf("%13.2f", sc);
}
else if ( do_score2eval)
{
float e;
e = nseq * esl_exp_surv( s_val , hmm->evparam[p7_FTAU], hmm->evparam[p7_FLAMBDA]);
printf("%13.2g", e);
}
printf("\n");
/* p7_MeanForwardScore(hmm, bg)); */
p7_hmm_Destroy(hmm);
}
p7_bg_Destroy(bg);
esl_alphabet_Destroy(abc);
p7_hmmfile_Close(hfp);
esl_getopts_Destroy(go);
exit(0);
}
开发者ID:EddyRivasLab,项目名称:hmmer,代码行数:101,代码来源:hmmstat.c
示例12: main
int
main(int argc, char **argv)
{
char *hmmfile = argv[1];
char *seqfile = argv[2];
ESL_ALPHABET *abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
P7_BG *bg = NULL;
P7_PROFILE *gm = NULL;
P7_OPROFILE *om = NULL;
P7_OMX *ox = NULL;
P7_GMX *gx = NULL;
ESL_SQ *sq = NULL;
ESL_SQFILE *sqfp = NULL;
int format = eslSQFILE_UNKNOWN;
float sc;
int status;
/* Read in one HMM */
if (p7_hmmfile_Open(hmmfile, NULL, &hfp) != eslOK) p7_Fail("Failed to open HMM file %s", hmmfile);
if (p7_hmmfile_Read(hfp, &abc, &hmm) != eslOK) p7_Fail("Failed to read HMM");
/* Read in one sequence */
sq = esl_sq_CreateDigital(abc);
status = esl_sqfile_Open(seqfile, format, NULL, &sqfp);
if (status == eslENOTFOUND) p7_Fail("No such file.");
else if (status == eslEFORMAT) p7_Fail("Format unrecognized.");
else if (status == eslEINVAL) p7_Fail("Can't autodetect stdin or .gz.");
else if (status != eslOK) p7_Fail("Open failed, code %d.", status);
if (esl_sqio_Read(sqfp, sq) != eslOK) p7_Fail("Failed to read sequence");
/* create default null model, then create and optimize profile */
bg = p7_bg_Create(abc);
p7_bg_SetLength(bg, sq->n);
gm = p7_profile_Create(hmm->M, abc);
p7_ProfileConfig(hmm, bg, gm, sq->n, p7_LOCAL);
om = p7_oprofile_Create(gm->M, abc);
p7_oprofile_Convert(gm, om);
p7_oprofile_Logify(om);
/* allocate DP matrices, both a generic and an optimized one */
ox = p7_omx_Create(gm->M, 0, sq->n);
gx = p7_gmx_Create(gm->M, sq->n);
/* Useful to place and compile in for debugging:
p7_oprofile_Dump(stdout, om); dumps the optimized profile
p7_omx_SetDumpMode(ox, TRUE); makes the fast DP algorithms dump their matrices
p7_gmx_Dump(stdout, gx); dumps a generic DP matrix
*/
p7_ViterbiScore(sq->dsq, sq->n, om, ox, &sc); printf("viterbi (non-optimized): %.2f nats\n", sc);
p7_GViterbi (sq->dsq, sq->n, gm, gx, &sc); printf("viterbi (generic): %.2f nats\n", sc);
/* now in a real app, you'd need to convert raw nat scores to final bit
* scores, by subtracting the null model score and rescaling.
*/
/* cleanup */
esl_sq_Destroy(sq);
esl_sqfile_Close(sqfp);
p7_omx_Destroy(ox);
p7_gmx_Destroy(gx);
p7_oprofile_Destroy(om);
p7_profile_Destroy(gm);
p7_bg_Destroy(bg);
p7_hmm_Destroy(hmm);
p7_hmmfile_Close(hfp);
esl_alphabet_Destroy(abc);
return 0;
}
开发者ID:Denis84,项目名称:EPA-WorkBench,代码行数:71,代码来源:vitscore.c
示例13: serial_master
//.........这里部分代码省略.........
else if (status == eslEFORMAT) p7_Fail("Sequence file %s is empty or misformatted\n", cfg->seqfile);
else if (status == eslEINVAL) p7_Fail("Can't autodetect format of a stdin or .gz seqfile");
else if (status != eslOK) p7_Fail("Unexpected error %d opening sequence file %s\n", status, cfg->seqfile);
if (sqfp->format > 100) // breaking the law! That range is reserved for msa, for aligned formats
p7_Fail("%s contains a multiple sequence alignment; expect unaligned sequences, like FASTA\n", cfg->seqfile);
qsq = esl_sq_CreateDigital(abc);
/* Open the results output files */
if (esl_opt_IsOn(go, "-o")) { if ((ofp = fopen(esl_opt_GetString(go, "-o"), "w")) == NULL) esl_fatal("Failed to open output file %s for writing\n", esl_opt_GetString(go, "-o")); }
if (esl_opt_IsOn(go, "--tblout")) { if ((tblfp = fopen(esl_opt_GetString(go, "--tblout"), "w")) == NULL) esl_fatal("Failed to open tabular per-seq output file %s for writing\n", esl_opt_GetString(go, "--tblfp")); }
if (esl_opt_IsOn(go, "--dfamtblout")) { if ((dfamtblfp = fopen(esl_opt_GetString(go, "--dfamtblout"),"w")) == NULL) esl_fatal("Failed to open tabular dfam output file %s for writing\n", esl_opt_GetString(go, "--dfamtblout")); }
if (esl_opt_IsOn(go, "--aliscoresout")) { if ((aliscoresfp = fopen(esl_opt_GetString(go, "--aliscoresout"),"w")) == NULL) esl_fatal("Failed to open alignment scores output file %s for writing\n", esl_opt_GetString(go, "--aliscoresout")); }
output_header(ofp, go, cfg->hmmfile, cfg->seqfile);
#ifdef HMMER_THREADS
/* initialize thread data */
if (esl_opt_IsOn(go, "--cpu")) ncpus = esl_opt_GetInteger(go, "--cpu");
else esl_threads_CPUCount(&ncpus);
if (ncpus > 0)
{
threadObj = esl_threads_Create(&pipeline_thread);
queue = esl_workqueue_Create(ncpus * 2);
}
#endif
infocnt = (ncpus == 0) ? 1 : ncpus;
ESL_ALLOC(info, sizeof(*info) * infocnt);
for (i = 0; i < infocnt; ++i)
{
info[i].bg = p7_bg_Create(abc);
#ifdef HMMER_THREADS
info[i].queue = queue;
#endif
}
#ifdef HMMER_THREADS
for (i = 0; i < ncpus * 2; ++i)
{
block = p7_oprofile_CreateBlock(BLOCK_SIZE);
if (block == NULL) esl_fatal("Failed to allocate sequence block");
status = esl_workqueue_Init(queue, block);
if (status != eslOK) esl_fatal("Failed to add block to work queue");
}
#endif
/* Outside loop: over each query sequence in <seqfile>. */
while ((sstatus = esl_sqio_Read(sqfp, qsq)) == eslOK)
{
if (sstatus == eslEMEM) p7_Fail("Memory allocation error reading sequence file\n", status);
if (sstatus == eslEINCONCEIVABLE) p7_Fail("Unexpected error %d reading sequence file\n", status);
// if (qsq->L > NHMMER_MAX_RESIDUE_COUNT) p7_Fail("Input sequence %s in file %s exceeds maximum length of %d bases.\n", qsq->name, cfg->seqfile, NHMMER_MAX_RESIDUE_COUNT);
nquery++;
esl_stopwatch_Start(w);
/* Open the target profile database */
status = p7_hmmfile_OpenE(cfg->hmmfile, p7_HMMDBENV, &hfp, NULL);
if (status != eslOK) p7_Fail("Unexpected error %d in opening hmm file %s.\n", status, cfg->hmmfile);
#ifdef HMMER_THREADS
/* if we are threaded, create a lock to prevent multiple readers */
开发者ID:ElofssonLab,项目名称:TOPCONS2,代码行数:67,代码来源:nhmmscan.c
示例14: search_thread
static void
search_thread(void *arg)
{
int i;
int count;
int seed;
int status;
int workeridx;
WORKER_INFO *info;
ESL_THREADS *obj;
ESL_SQ dbsq;
ESL_STOPWATCH *w = NULL; /* timing stopwatch */
P7_BUILDER *bld = NULL; /* HMM construction configuration */
P7_BG *bg = NULL; /* null model */
P7_PIPELINE *pli = NULL; /* work pipeline */
P7_TOPHITS *th = NULL; /* top hit results */
P7_PROFILE *gm = NULL; /* generic model */
P7_OPROFILE *om = NULL; /* optimized query profile */
obj = (ESL_THREADS *) arg;
esl_threads_Started(obj, &workeridx);
info = (WORKER_INFO *) esl_threads_GetData(obj, workeridx);
w = esl_stopwatch_Create();
bg = p7_bg_Create(info->abc);
esl_stopwatch_Start(w);
/* set up the dummy description and accession fields */
dbsq.desc = "";
dbsq.acc = "";
/* process a query sequence or hmm */
if (info->seq != NULL) {
bld = p7_builder_Create(NULL, info->abc);
if ((seed = esl_opt_GetInteger(info->opts, "--seed")) > 0) {
esl_randomness_Init(bld->r, seed);
bld->do_reseeding = TRUE;
}
bld->EmL = esl_opt_GetInteger(info->opts, "--EmL");
bld->EmN = esl_opt_GetInteger(info->opts, "--EmN");
bld->EvL = esl_opt_GetInteger(info->opts, "--EvL");
bld->EvN = esl_opt_GetInteger(info->opts, "--EvN");
bld->EfL = esl_opt_GetInteger(info->opts, "--EfL");
bld->EfN = esl_opt_GetInteger(info->opts, "--EfN");
bld->Eft = esl_opt_GetReal (info->opts, "--Eft");
if (esl_opt_IsOn(info->opts, "--mxfile")) status = p7_builder_SetScoreSystem (bld, esl_opt_GetString(info->opts, "--mxfile"), NULL, esl_opt_GetReal(info->opts, "--popen"), esl_opt_GetReal(info->opts, "--pextend"), bg);
else status = p7_builder_LoadScoreSystem(bld, esl_opt_GetString(info->opts, "--mx"), esl_opt_GetReal(info->opts, "--popen"), esl_opt_GetReal(info->opts, "--pextend"), bg);
if (status != eslOK) {
//client_error(info->sock, status, "hmmgpmd: failed to set single query sequence score system: %s", bld->errbuf);
fprintf(stderr, "hmmpgmd: failed to set single query sequence score system: %s", bld->errbuf);
pthread_exit(NULL);
return;
}
p7_SingleBuilder(bld, info->seq, bg, NULL, NULL, NULL, &om); /* bypass HMM - only need model */
p7_builder_Destroy(bld);
} else {
gm = p7_profile_Create (info->hmm->M, info->abc);
om = p7_oprofile_Create(info->hmm->M, info->abc);
p7_ProfileConfig(info->hmm, bg, gm, 100, p7_LOCAL);
p7_oprofile_Convert(gm, om);
}
/* Create processing pipeline and hit list */
th = p7_tophits_Create();
pli = p7_pipeline_Create(info->opts, om->M, 100, FALSE, p7_SEARCH_SEQS);
p7_pli_NewModel(pli, om, bg);
if (pli->Z_setby == p7_ZSETBY_NTARGETS) pli->Z = info->db_Z;
/* loop until all sequences have been processed */
count = 1;
while (count > 0) {
int inx;
int blksz;
HMMER_SEQ **sq;
/* grab the next block of sequences */
if (pthread_mutex_lock(info->inx_mutex) != 0) p7_Fail("mutex lock failed");
inx = *info->inx;
blksz = *info->blk_size;
if (inx > *info->limit) {
blksz /= 5;
if (blksz < 1000) {
*info->limit = info->sq_cnt * 2;
} else {
*info->limit = inx + (info->sq_cnt - inx) * 2 / 3;
}
}
*info->blk_size = blksz;
*info->inx += blksz;
if (pthread_mutex_unlock(info->inx_mutex) != 0) p7_Fail("mutex unlock failed");
sq = info->sq_list + inx;
count = info->sq_cnt - inx;
if (count > blksz) count = blksz;
/* Main loop: */
for (i = 0; i < count; ++i, ++sq) {
//.........这里部分代码省略.........
开发者ID:dboudour2002,项目名称:musicHMMER,代码行数:101,代码来源:hmmdwrkr.c
|
请发表评论