hmmer-3.3/src/nhmmscan.c
/* process_commandline()
 * 
 * Processes the commandline, filling in fields in <cfg> and creating and returning
 * an <ESL_GETOPTS> options structure. The help page (hmmsearch -h) is formatted
 * here.
 */


Processes the commandline, filling in fields in  and creating and returning
an  options structure. The help page (hmmsearch -h) is formatted
here.
Processes the commandline filling in fields in and creating and returning an options structure . The help page ( hmmsearch - h ) is formatted here .
static int
process_commandline(int argc, char **argv, ESL_GETOPTS **ret_go, char **ret_hmmfile, char **ret_seqfile)
{
  ESL_GETOPTS *go = esl_getopts_Create(options);
  int          status;
  if (esl_opt_ProcessEnvironment(go)         != eslOK)  { if (printf("Failed to process environment: %s\n", go->errbuf) < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed"); goto FAILURE; }
  if (esl_opt_ProcessCmdline(go, argc, argv) != eslOK)  { if (printf("Failed to parse command line: %s\n",  go->errbuf) < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed"); goto FAILURE; }
  if (esl_opt_VerifyConfig(go)               != eslOK)  { if (printf("Failed to parse command line: %s\n",  go->errbuf) < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed"); goto FAILURE; }
  if (esl_opt_GetBoolean(go, "-h") == TRUE) 
    {
      p7_banner(stdout, argv[0], banner);
      esl_usage(stdout, argv[0], usage);
      if (puts("\nBasic options:")                                           < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed");
      esl_opt_DisplayHelp(stdout, go, 1, 2, 80); 
      if (puts("\nOptions controlling output:")                              < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed");
      esl_opt_DisplayHelp(stdout, go, 2, 2, 80); 
      if (puts("\nOptions controlling reporting thresholds:")                < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed");
      esl_opt_DisplayHelp(stdout, go, 4, 2, 80); 
      if (puts("\nOptions controlling inclusion (significance) thresholds:") < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed");
      esl_opt_DisplayHelp(stdout, go, 5, 2, 80); 
      if (puts("\nOptions for model-specific thresholding:")                 < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed");
      esl_opt_DisplayHelp(stdout, go, 6, 2, 80); 
      if (puts("\nOptions controlling acceleration heuristics:")             < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed");
      esl_opt_DisplayHelp(stdout, go, 7, 2, 80); 
      if (puts("\nOther expert options:")                                    < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed");
      esl_opt_DisplayHelp(stdout, go, 12, 2, 80); 
      exit(0);
    }
  if (esl_opt_ArgNumber(go)                 != 2)      { if (puts("Incorrect number of command line arguments.")      < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed"); goto FAILURE; }
  if ((*ret_hmmfile = esl_opt_GetArg(go, 1)) == NULL)  { if (puts("Failed to get <hmmdb> argument on command line")   < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed"); goto FAILURE; }
  if ((*ret_seqfile = esl_opt_GetArg(go, 2)) == NULL)  { if (puts("Failed to get <seqfile> argument on command line") < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed"); goto FAILURE; }
  if (strcmp(*ret_hmmfile, "-") == 0) 
    { if (puts("nhmmscan cannot read <hmm database> from stdin stream, because it must have hmmpress'ed auxfiles") < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed");   goto FAILURE;  }
  *ret_go = go;
  return eslOK;
 FAILURE:  
  esl_usage(stdout, argv[0], usage);
  if (puts("\nwhere most common options are:")                                 < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed");
  esl_opt_DisplayHelp(stdout, go, 1, 2, 80); 
  if (printf("\nTo see more help on available options, do %s -h\n\n", argv[0]) < 0) ESL_XEXCEPTION_SYS(eslEWRITE, "write failed");
  esl_getopts_Destroy(go);
  exit(1);  
 ERROR:
  if (go) esl_getopts_Destroy(go);
  exit(status);
}
static int process_commandline ( int argc , char * * argv , ESL_GETOPTS * * ret_go , char * * ret_hmmfile , char * * ret_seqfile ) { ESL_GETOPTS * go = esl_getopts_Create ( options ) ; int status ; if ( esl_opt_ProcessEnvironment ( go ) != eslOK ) { if ( printf ( " \n " , go -> errbuf ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; goto FAILURE ; } if ( esl_opt_ProcessCmdline ( go , argc , argv ) != eslOK ) { if ( printf ( " \n " , go -> errbuf ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; goto FAILURE ; } if ( esl_opt_VerifyConfig ( go ) != eslOK ) { if ( printf ( " \n " , go -> errbuf ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; goto FAILURE ; } if ( esl_opt_GetBoolean ( go , " " ) == TRUE ) { p7_banner ( stdout , argv [ 0 ] , banner ) ; esl_usage ( stdout , argv [ 0 ] , usage ) ; if ( puts ( " \n " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; esl_opt_DisplayHelp ( stdout , go , 1 , 2 , 80 ) ; if ( puts ( " \n " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; esl_opt_DisplayHelp ( stdout , go , 2 , 2 , 80 ) ; if ( puts ( " \n " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; esl_opt_DisplayHelp ( stdout , go , 4 , 2 , 80 ) ; if ( puts ( " \n " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; esl_opt_DisplayHelp ( stdout , go , 5 , 2 , 80 ) ; if ( puts ( " \n " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; esl_opt_DisplayHelp ( stdout , go , 6 , 2 , 80 ) ; if ( puts ( " \n " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; esl_opt_DisplayHelp ( stdout , go , 7 , 2 , 80 ) ; if ( puts ( " \n " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; esl_opt_DisplayHelp ( stdout , go , 12 , 2 , 80 ) ; exit ( 0 ) ; } if ( esl_opt_ArgNumber ( go ) != 2 ) { if ( puts ( " " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; goto FAILURE ; } if ( ( * ret_hmmfile = esl_opt_GetArg ( go , 1 ) ) == NULL ) { if ( puts ( " " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; goto FAILURE ; } if ( ( * ret_seqfile = esl_opt_GetArg ( go , 2 ) ) == NULL ) { if ( puts ( " " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; goto FAILURE ; } if ( strcmp ( * ret_hmmfile , " " ) == 0 ) { if ( puts ( " " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; goto FAILURE ; } * ret_go = go ; return eslOK ; FAILURE : esl_usage ( stdout , argv [ 0 ] , usage ) ; if ( puts ( " \n " ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; esl_opt_DisplayHelp ( stdout , go , 1 , 2 , 80 ) ; if ( printf ( " \n \n \n " , argv [ 0 ] ) < 0 ) ESL_XEXCEPTION_SYS ( eslEWRITE , " " ) ; esl_getopts_Destroy ( go ) ; exit ( 1 ) ; ERROR : if ( go ) esl_getopts_Destroy ( go ) ; exit ( status ) ; }
process_commandline()
process_commandline ()
/* help format: */ /* 1= group; 2 = indentation; 80=textwidth*/ /* Validate any attempted use of stdin streams */ /* all errors handled here are user errors, so be polite.  */ /* 1= group; 2 = indentation; 80=textwidth*/