本文整理汇总了C++中p7_CreateDefaultApp函数的典型用法代码示例。如果您正苦于以下问题:C++ p7_CreateDefaultApp函数的具体用法?C++ p7_CreateDefaultApp怎么用?C++ p7_CreateDefaultApp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了p7_CreateDefaultApp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 0, argc, argv, banner, usage);
ESL_RANDOMNESS *rng = esl_randomness_Create(esl_opt_GetInteger(go, "-s"));
P7_COORDS2 *c2 = p7_coords2_Create(0, 0);
P7_COORDS2_HASH *hash = p7_coords2_hash_Create(0, 0, 0);
int L = 20;
int maxseg = 1;
int nsamples = 1000;
int32_t *wrk = NULL;
int32_t keyidx;
int i;
for (i = 0; i < nsamples; i++)
{
p7_coords2_Sample(rng, c2, maxseg, L, &wrk);
p7_coords2_hash_Store(hash, c2, &keyidx);
p7_coords2_Reuse(c2);
}
p7_coords2_hash_Dump(stdout, hash);
if (wrk) free(wrk);
p7_coords2_hash_Destroy(hash);
p7_coords2_Destroy(c2);
esl_randomness_Destroy(rng);
esl_getopts_Destroy(go);
return 0;
}
示例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);
int N = esl_opt_GetInteger(go, "-N");
ESL_STOPWATCH *w = esl_stopwatch_Create();
ESL_ALPHABET *abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
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");
p7_hmmfile_Close(hfp);
esl_stopwatch_Start(w);
while (N--)
{ /* cfg rng bg gm om */
p7_Calibrate(hmm, NULL, NULL, NULL, NULL, NULL);
}
esl_stopwatch_Stop(w);
esl_stopwatch_Display(stdout, w, "# CPU time: ");
p7_hmm_Destroy(hmm);
esl_alphabet_Destroy(abc);
esl_stopwatch_Destroy(w);
esl_getopts_Destroy(go);
return 0;
}
示例3: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 0, argc, argv, banner, usage);
ESL_RANDOMNESS *r = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
ESL_ALPHABET *abc = NULL;
P7_BG *bg = NULL;
P7_HMM *hmm = NULL;
P7_OPROFILE *om = NULL;
int M = esl_opt_GetInteger(go, "-M");
int L = esl_opt_GetInteger(go, "-L");
fprintf(stderr, "## %s\n", argv[0]);
fprintf(stderr, "# rng seed = %" PRIu32 "\n", esl_randomness_GetSeed(r));
/* Sample a random HMM and optimized profile, in amino acid alphabet. */
if ((abc = esl_alphabet_Create(eslAMINO)) == NULL) esl_fatal("failed to create alphabet");
if ((bg = p7_bg_Create(abc)) == NULL) esl_fatal("failed to create null model");
if (( p7_oprofile_Sample(r, abc, bg, M, L, &hmm, NULL, &om)) != eslOK) esl_fatal("failed to sample HMM and profile");
/* unit test(s) */
utest_ReadWrite(hmm, om);
p7_oprofile_Destroy(om);
p7_hmm_Destroy(hmm);
p7_bg_Destroy(bg);
esl_alphabet_Destroy(abc);
esl_randomness_Destroy(r);
esl_getopts_Destroy(go);
fprintf(stderr, "# status = ok\n");
return eslOK;
}
示例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_GMX *gx1 = NULL;
P7_GMX *gx2 = 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;
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);
gx1 = p7_gmx_Create(gm->M, L);
gx2 = p7_gmx_Create(gm->M, L);
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);
esl_stopwatch_Start(w);
for (i = 0; i < N; i++)
p7_GNull2_ByExpectation(gm, gx2, null2);
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_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;
}
示例5: main
int
main(int argc, char **argv)
{
char *msg = "p7_gmx unit test driver failed";
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 0, argc, argv, banner, usage);
ESL_RANDOMNESS *r = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
ESL_ALPHABET *abc = esl_alphabet_Create(eslAMINO);
P7_BG *bg = p7_bg_Create(abc);
P7_HMM *hmm = NULL;
P7_PROFILE *gm = NULL;
int M = esl_opt_GetInteger(go, "-M");
int L = esl_opt_GetInteger(go, "-L");
float tol = esl_opt_GetReal (go, "-t");
p7_FLogsumInit();
if (p7_hmm_Sample(r, M, abc, &hmm) != eslOK) esl_fatal(msg);
if ((gm = p7_profile_Create(hmm->M, abc)) == NULL) esl_fatal(msg);
if (p7_bg_SetLength(bg, L) != eslOK) esl_fatal(msg);
if (p7_ProfileConfig(hmm, bg, gm, L, p7_UNILOCAL) != eslOK) esl_fatal(msg);
utest_GrowTo();
utest_Compare(r, gm, bg, L, tol);
esl_getopts_Destroy(go);
esl_randomness_Destroy(r);
esl_alphabet_Destroy(abc);
p7_bg_Destroy(bg);
p7_hmm_Destroy(hmm);
p7_profile_Destroy(gm);
return eslOK;
}
示例6: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 1, argc, argv, banner, usage);
ESL_STOPWATCH *w = esl_stopwatch_Create();
char *hmmfile = esl_opt_GetArg(go, 1);
P7_HMMCACHE *hcache = NULL;
char errbuf[eslERRBUFSIZE];
size_t tot_mem;
int status;
esl_stopwatch_Start(w);
status = p7_hmmcache_Open(hmmfile, &hcache, errbuf);
if (status == eslENOTFOUND) p7_Fail("Failed to read %s\n %s\n", hmmfile, errbuf);
else if (status == eslEFORMAT) p7_Fail("Failed to parse %s\n %s\n", hmmfile, errbuf);
else if (status == eslEINCOMPAT) p7_Fail("Mixed profile types in %s\n %s\n", hmmfile, errbuf);
else if (status != eslOK) p7_Fail("Failed to cache %s: error code %d\n", hmmfile, status);
p7_hmmcache_SetNumericNames(hcache);
tot_mem = p7_hmmcache_Sizeof(hcache);
esl_stopwatch_Stop(w);
esl_stopwatch_Display(stdout, w, "# CPU time: ");
printf("models = %d\n", hcache->n);
printf("tot memory = %" PRIu64 "\n", (uint64_t) tot_mem);
p7_hmmcache_Close(hcache);
esl_getopts_Destroy(go);
esl_stopwatch_Destroy(w);
return 0;
}
示例7: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 0, argc, argv, banner, usage);
ESL_RANDOMNESS *rng = esl_randomness_Create(esl_opt_GetInteger(go, "-s"));
P7_ANCHORS *anch = p7_anchors_Create();
P7_ANCHORHASH *ah = p7_anchorhash_Create();
int L = 400;
int M = 200;
int maxD = 50;
int nsamples = 1000;
int32_t keyidx;
int s;
for (s = 0; s < nsamples; s++)
{
p7_anchors_Sample(rng, L, M, maxD, anch);
p7_anchorhash_Store(ah, anch, 0, &keyidx);
p7_anchors_Reuse(anch);
}
p7_anchorhash_Dump(stdout, ah);
p7_anchorhash_Destroy(ah);
p7_anchors_Destroy(anch);
esl_randomness_Destroy(rng);
esl_getopts_Destroy(go);
return 0;
}
示例8: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 0, argc, argv, banner, usage);
ESL_RANDOMNESS *rng = NULL;
int stalling = esl_opt_GetBoolean(go, "--stall");
int my_rank;
int nproc;
/* The startup sequence below is designed in part to facilitate debugging.
* To debug an MPI program, you start it with 'mpirun' as usual, but
* with the --stall flag; this causes all processes to start, but then
* wait for the developer to attach gdb's to each running process.
* Example:
* mpirun -n 2 ./p7_hmm_mpi_utest --stall
* [pid's <pid0> and <pid1> are reported for processes 0 and 1]
* in one terminal window:
* gdb ./p7_hmm_mpi_utest <pid0>
* [set desired breakpoint in the master]
* set stalling=0
* c
* and similarly in a second terminal window, for worker <pid1>.
*
* Additionally, we want to show the rng seed. This is so we can diagnose
* failures that are rare; we can re-run the unit test until we see it fail,
* get the rng seed, then reproduce exactly that failure.
*/
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
if (my_rank == 0) {
rng = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
fprintf(stderr, "## %s\n", argv[0]);
fprintf(stderr, "# rng seed = %" PRIu32 "\n", esl_randomness_GetSeed(rng));
fprintf(stderr, "# MPI nproc = %d\n", nproc);
}
#ifdef HAVE_GETPID
/* To debug an MPI program, you attach gdb's to each process, already running;
* for this, you need the pid of each process. Provide the pid's to help the
* developer.
*/
fprintf(stderr, "# %6d = %d\n", my_rank, getpid());
#endif
/* This infinite loop waits on the developer to attach gdb's to each process.
* In each gdb, developer may set a better breakpoint, then does "set stalling=0"
* and "continue" to release the waiting process from this stall point.
*/
while (stalling);
utest_SendRecv(rng, my_rank, nproc);
if (my_rank == 0) {
fprintf(stderr, "# status = ok\n");
esl_randomness_Destroy(rng);
}
MPI_Finalize();
esl_getopts_Destroy(go);
exit(0); /* success */
}
示例9: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 0, argc, argv, banner, usage);
ESL_RANDOMNESS *r = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
ESL_ALPHABET *abc = NULL;
P7_HMM *hmm = NULL;
P7_PROFILE *gm = NULL;
P7_BG *bg = NULL;
int M = 100;
int L = 200;
int nseq = 20;
char errbuf[eslERRBUFSIZE];
if ((abc = esl_alphabet_Create(eslAMINO)) == NULL) esl_fatal("failed to create alphabet");
if (p7_hmm_Sample(r, M, abc, &hmm) != eslOK) esl_fatal("failed to sample an HMM");
if ((bg = p7_bg_Create(abc)) == NULL) esl_fatal("failed to create null model");
if ((gm = p7_profile_Create(hmm->M, abc)) == NULL) esl_fatal("failed to create profile");
if (p7_ProfileConfig(hmm, bg, gm, L, p7_LOCAL) != eslOK) esl_fatal("failed to config profile");
if (p7_hmm_Validate (hmm, errbuf, 0.0001) != eslOK) esl_fatal("whoops, HMM is bad!: %s", errbuf);
if (p7_profile_Validate(gm, errbuf, 0.0001) != eslOK) esl_fatal("whoops, profile is bad!: %s", errbuf);
utest_basic (go);
utest_viterbi(go, r, abc, bg, gm, nseq, L);
p7_profile_Destroy(gm);
p7_bg_Destroy(bg);
p7_hmm_Destroy(hmm);
esl_alphabet_Destroy(abc);
esl_randomness_Destroy(r);
esl_getopts_Destroy(go);
return 0;
}
示例10: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 1, argc, argv, banner, usage);
ESL_STOPWATCH *w = esl_stopwatch_Create();
char *hmmfile = esl_opt_GetArg(go, 1);
ESL_ALPHABET *abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
P7_BG *bg = NULL;
int L = esl_opt_GetInteger(go, "-L");
int N = esl_opt_GetInteger(go, "-N");
int i;
/* Read one HMM from <hmmfile> */
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");
p7_hmmfile_Close(hfp);
bg = p7_bg_Create(abc);
esl_stopwatch_Start(w);
for (i = 0; i < N; i++)
p7_bg_SetFilterByHMM(bg, hmm);
esl_stopwatch_Stop(w);
esl_stopwatch_Display(stdout, w, "# CPU time: ");
p7_bg_Destroy(bg);
p7_hmm_Destroy(hmm);
esl_alphabet_Destroy(abc);
esl_stopwatch_Destroy(w);
esl_getopts_Destroy(go);
return 0;
}
示例11: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 1, argc, argv, banner, usage);
ESL_RANDOMNESS *rng = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
char *hmmfile = esl_opt_GetArg(go, 1);
int L = esl_opt_GetInteger(go, "-L");
int N = esl_opt_GetInteger(go, "-N");
ESL_ALPHABET *abc = NULL;
P7_HMMFILE *hfp = NULL;
P7_HMM *hmm = NULL;
P7_BG *bg = NULL;
P7_PROFILE *gm = NULL;
P7_TRACE *tr = p7_trace_Create();
ESL_SQ *sq = NULL;
char errbuf[eslERRBUFSIZE];
int i;
int status;
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);
if (status == eslEFORMAT) p7_Fail("Bad file format in HMM file %s:\n%s\n", hfp->fname, hfp->errbuf);
else if (status == eslEINCOMPAT) p7_Fail("HMM in %s is not in the expected %s alphabet\n", hfp->fname, esl_abc_DecodeType(abc->type));
else if (status == eslEOF) p7_Fail("Empty HMM file %s? No HMM data found.\n", hfp->fname);
else if (status != eslOK) p7_Fail("Unexpected error in reading HMMs from %s\n", hfp->fname);
p7_hmmfile_Close(hfp);
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);
sq = esl_sq_CreateDigital(abc);
for (i = 0; i < N; i++)
{
p7_ProfileEmit(rng, hmm, gm, bg, sq, tr);
esl_sq_FormatName(sq, "%s-sample%d", hmm->name, i);
esl_sqio_Write(stdout, sq, eslSQFILE_FASTA, FALSE);
if (p7_trace_Validate(tr, abc, sq->dsq, errbuf) != eslOK) esl_fatal(errbuf);
esl_sq_Reuse(sq);
p7_trace_Reuse(tr);
}
esl_sq_Destroy(sq);
p7_trace_Destroy(tr);
p7_profile_Destroy(gm);
p7_bg_Destroy(bg);
p7_hmm_Destroy(hmm);
esl_alphabet_Destroy(abc);
esl_randomness_Destroy(rng);
esl_getopts_Destroy(go);
return 0;
}
示例12: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 0, argc, argv, banner, usage);
ESL_RANDOMNESS *r = esl_randomness_CreateFast(esl_opt_GetInteger(go, "-s"));
int N = esl_opt_GetInteger(go, "-N");
P7_TOPHITS *h1 = NULL;
P7_TOPHITS *h2 = NULL;
P7_TOPHITS *h3 = NULL;
char name[] = "not_unique_name";
char acc[] = "not_unique_acc";
char desc[] = "Test description for the purposes of making the test driver allocate space";
double key;
int i;
fprintf(stderr, "## %s\n", argv[0]);
fprintf(stderr, "# rng seed = %" PRIu32 "\n", esl_randomness_GetSeed(r));
h1 = p7_tophits_Create(p7_TOPHITS_DEFAULT_INIT_ALLOC);
h2 = p7_tophits_Create(p7_TOPHITS_DEFAULT_INIT_ALLOC);
h3 = p7_tophits_Create(p7_TOPHITS_DEFAULT_INIT_ALLOC);
for (i = 0; i < N; i++)
{
key = esl_random(r);
tophits_Add(h1, name, acc, desc, key);
key = 10.0 * esl_random(r);
tophits_Add(h2, name, acc, desc, key);
key = 0.1 * esl_random(r);
tophits_Add(h3, name, acc, desc, key);
}
tophits_Add(h1, "last", NULL, NULL, -1.0);
tophits_Add(h1, "first", NULL, NULL, 20.0);
p7_tophits_SortBySortkey(h1);
if (strcmp(h1->hit[0]->name, "first") != 0) esl_fatal("sort failed (top is %s = %f)", h1->hit[0]->name, h1->hit[0]->sortkey);
if (strcmp(h1->hit[N+1]->name, "last") != 0) esl_fatal("sort failed (last is %s = %f)", h1->hit[N+1]->name, h1->hit[N+1]->sortkey);
p7_tophits_Merge(h1, h2);
if (strcmp(h1->hit[0]->name, "first") != 0) esl_fatal("after merge 1, sort failed (top is %s = %f)", h1->hit[0]->name, h1->hit[0]->sortkey);
if (strcmp(h1->hit[2*N+1]->name, "last") != 0) esl_fatal("after merge 1, sort failed (last is %s = %f)", h1->hit[2*N+1]->name, h1->hit[2*N+1]->sortkey);
p7_tophits_Merge(h3, h1);
if (strcmp(h3->hit[0]->name, "first") != 0) esl_fatal("after merge 2, sort failed (top is %s = %f)", h3->hit[0]->name, h3->hit[0]->sortkey);
if (strcmp(h3->hit[3*N+1]->name, "last") != 0) esl_fatal("after merge 2, sort failed (last is %s = %f)", h3->hit[3*N+1]->name, h3->hit[3*N+1]->sortkey);
if (p7_tophits_GetMaxNameLength(h3) != strlen(name)) esl_fatal("GetMaxNameLength() failed");
p7_tophits_Destroy(h1);
p7_tophits_Destroy(h2);
p7_tophits_Destroy(h3);
esl_randomness_Destroy(r);
esl_getopts_Destroy(go);
fprintf(stderr, "# status = ok\n");
return eslOK;
}
示例13: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 0, argc, argv, banner, usage);
fprintf(stderr, "## %s\n", argv[0]);
utest_Compare();
fprintf(stderr, "# status = ok\n");
esl_getopts_Destroy(go);
return 0;
}
示例14: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 0, argc, argv, banner, usage);
fprintf(stderr, "## %s\n", argv[0]);
utest_normalization(go);
esl_getopts_Destroy(go);
fprintf(stderr, "# status = ok\n");
exit(0); /* success */
}
示例15: main
int
main(int argc, char **argv)
{
ESL_GETOPTS *go = p7_CreateDefaultApp(options, 0, argc, argv, banner, usage);
utest_alphabet_config(eslAMINO);
utest_alphabet_config(eslDNA);
utest_alphabet_config(eslRNA);
utest_alphabet_config(eslCOINS);
utest_alphabet_config(eslDICE);
esl_getopts_Destroy(go);
return 0;
}