Ejemplo n.º 1
0
int
process_searchopts(int fd, char *cmdstr, ESL_GETOPTS **ret_opts)
{
  int status;

  ESL_GETOPTS *go = NULL;

  if ((go = esl_getopts_Create(searchOpts))       == NULL)  return eslEMEM;
  if ((status = esl_opt_ProcessSpoof(go, cmdstr)) != eslOK) return status;
  if ((status = esl_opt_VerifyConfig(go))         != eslOK) return status;

  *ret_opts = go;
  return eslOK;
}
Ejemplo n.º 2
0
P7_HMM * constructHMM(ESL_MSA *msa, ESL_ALPHABET *abc, int ali_hmm, int frag, P7_HMM **ret_hmm, char *errbuf){
  int status;
  ESL_GETOPTS  *go          = esl_getopts_Create(options);
  P7_BUILDER      *bld      = NULL;
  P7_BG           *bg       = NULL;

  char            *args = NULL;

  esl_strcat(&args, -1, "X ", -1);

  status = esl_msa_SetName(msa, "Query", -1);
  /* Now take this alignment and make an HMM from it */
  if(status != eslOK){
    ESL_XFAIL(status, errbuf, "Easel MSA SetNAME returned an error %d\n", status);
  }
  bg = p7_bg_Create(abc);
  if(bg == NULL){
    ESL_XFAIL(status, errbuf, "Error generating bg\n");
  }

  if (frag == 1) {
    // add --fragthresh 0
    esl_strcat(&args, -1, "--fragthresh 0 ", -1);
  }

  // if these flags are set, then we want a non standard hmm out. Used by the logo server.
  if (ali_hmm == 1) {
    // observed counts
    // arguments "X --pnone --wnone --enone"
    esl_strcat(&args, -1, "--pnone --wnone --enone --symfrac 0 ", -1);
  }
  else if (ali_hmm == 2) {
    // weighted counts
    // arguments  "X --pnone");
    esl_strcat(&args, -1, "--pnone --symfrac 0 ", -1);
  }
  else if (ali_hmm == 3) {
    // Create HMM - keep all columns
    esl_strcat(&args, -1, "--symfrac 0 ", -1);
  }
  else {
    // no arguments ?
  }


  // pass in arguments to hmm builder
  esl_opt_ProcessSpoof(go, args);

  if (args != NULL) free(args);

  bld = p7_builder_Create(go, abc);
  if(bld == NULL){
    ESL_XFAIL(eslEMEM, errbuf, "Error creating builder\n");
  }

  status = p7_Builder(bld, msa, bg, ret_hmm, NULL, NULL, NULL, NULL);


  if (status != eslOK) {
    strcpy( errbuf, bld->errbuf );
    goto ERROR;
  }


  p7_bg_Destroy(bg);
  p7_builder_Destroy(bld);
  esl_getopts_Destroy(go);
  return status;

ERROR:
  if (bg != NULL) p7_bg_Destroy(bg);
  if (bld != NULL) p7_builder_Destroy(bld);
  if (go != NULL) esl_getopts_Destroy(go);
  return status;
}