mirror of
http://43.156.76.180:8026/YuuMJ/EukPhylo.git
synced 2025-12-28 07:10:24 +08:00
1831 lines
72 KiB
C
1831 lines
72 KiB
C
/*
|
|
File autogenerated by gengetopt version 2.22.4
|
|
generated with the following command:
|
|
gengetopt -isemphy.ggo -Fsemphy_cmdline
|
|
|
|
The developers of gengetopt consider the fixed text that goes in all
|
|
gengetopt output files to be in the public domain:
|
|
we make no copyright claims on it.
|
|
*/
|
|
|
|
/* If we use autoconf. */
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#ifndef FIX_UNUSED
|
|
#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
|
|
#endif
|
|
|
|
#include <getopt.h>
|
|
|
|
#include "semphy_cmdline.h"
|
|
|
|
const char *gengetopt_args_info_purpose = "structural EM based Phylogeny";
|
|
|
|
const char *gengetopt_args_info_usage = "Usage: semphy [OPTIONS]...";
|
|
|
|
const char *gengetopt_args_info_description = "";
|
|
|
|
const char *gengetopt_args_info_full_help[] = {
|
|
" -h, --help Print help and exit",
|
|
" --full-help Print help, including hidden options, and exit",
|
|
" -V, --version Print version and exit",
|
|
"\nWhich algorithm to run:",
|
|
" -S, --SEMPHY Do SEMPHY step (default=off)",
|
|
" -n, --bbl Only optimize branch length (default=off)",
|
|
" -L, --likelihood Compute likelihood for fixed tree \n (default=off)",
|
|
" -P, --PerPosLike Compute likelihood per position for a fixed \n tree (default=off)",
|
|
" -B, --PerPosPosterior Compute likelihood per position and Bayesian \n posterior (default=off)",
|
|
" -R, --rate optimize rate of gene (default=off)",
|
|
"\nAdvanced Algorithm Options:",
|
|
" -M, --max-semphy-iter=INT Max number of SEM iterations (default=`100')",
|
|
" --epsilonLikelihoodImprovement4iterNJ=FLOAT\n The threshold for optimization of likelihood of \n the tree, in iterative distance-based tree \n reconstruction (default=`0.01')",
|
|
" --epsilonLikelihoodImprovement4pairwiseDistance=FLOAT\n The threshold for optimization of likelihood of \n a pair of sequences, in pairwise distance \n optimization (default=`0.0001')",
|
|
" --epsilonLikelihoodImprovement4alphaOptimiz=FLOAT\n The threshold for optimization of likelihood of \n the tree, in alpha optimization (also used \n for Nu optimization when using --ssrv) \n (default=`0.01')",
|
|
" --epsilonLikelihoodImprovement4BBL=FLOAT\n The threshold for optimization of likelihood of \n the tree, in branch-lengths optimization \n (default=`0.01')",
|
|
" --maxNumOfBBLIter=INT Number of BBL iterations in BBL+ALPHA \n optimization (default=`10')",
|
|
" --consurf version for use in consurf (default=off)",
|
|
"\nNon Iterative methods:",
|
|
"\n Group: DistanceTableEstimationMethod\n Method used for computing the distance table for the initial tree NJ \n construction",
|
|
" -J, --NJ 'classic' Neighbor Joining (same as \n homogeneousRates)",
|
|
" --homogeneousRatesDTME homogeneous rates MLE distance",
|
|
" --pairwiseGammaDTME Gamma-ASRV with alpha optimized for each pair. \n (must give either --alpha or --optimizeAlpha)",
|
|
"\nIterative distance-based tree reconstruction, with distance estimation methods \nthat utilize side information from the tree of the previous iteration:",
|
|
" --commonAlphaDTME Side information is the alpha parameter.(must \n use --optimizeAlpha; may give an initial \n alpha value in --alpha)",
|
|
" --rate4siteDTME Side information is the ML rate for each site",
|
|
" --posteriorDTME Side information is the posterior probabilities \n of the rates at each site. (must use \n --optimizeAlpha; may give an initial alpha \n value in --alpha)",
|
|
"\nBootstrap:",
|
|
" --BPrepeats=INT Use bootstrap and set number of repeats",
|
|
" --BPconsensus=INT Use bootstrap and compute a Consensus tree",
|
|
" --BPonUserTree Use compute support for user provided tree \n (default=off)",
|
|
"\nBasic Options:",
|
|
" -s, --sequence=FILENAME Sequence file name (default=`-')",
|
|
" -t, --tree=FILENAME Tree file name",
|
|
" -c, --constraint=FILENAME Constraint Tree file name",
|
|
" -o, --outputfile=FILENAME Output file (default=`-')",
|
|
" -T, --treeoutputfile=FILENAME Tree output file (default=`-')",
|
|
" -g, --gaps Remove positions with gaps (default=off)",
|
|
" -r, --seed=LONG Seed random number generator",
|
|
"\nModel Options:",
|
|
" -a, --alphabet=4|20|61|64 Alphabet Size (default=`20')",
|
|
" -z, --ratio=FLOAT Transition/Transversion ratio (default=`2.0')",
|
|
" -p, --ACGprob=A,C,G User input nucleotide frequencies. String \n separated list for A,C,G \n (default=`0.25,0.25,0.25')",
|
|
" --inputRate=FLOAT Set External globalRate (default=`1.0')",
|
|
"\nAmong Site Rate Variation (ASRV):",
|
|
" -H, --homogeneous Don't use Gamma ASRV (default=off)",
|
|
" -A, --alpha=Alpha Set alpha for Gamma ASRV",
|
|
" -O, --optimizeAlpha Optimize alpha for Gamma ASRV (default=off)",
|
|
" -C, --categories=INT Number of categories to use with descrete Gamma \n ASRV (default=`8')",
|
|
" --laguerre Use Laguerre approximation of Gamma - CURRENTLY \n NOT IMPLIMENTED (default=off)",
|
|
" --ssrv Use a Site-Specific Rate Variation model (SSRV) \n (default=off)",
|
|
" --nu=Nu Set Nu for the SSRV model (default=`1.0')",
|
|
" --posteriorRates=FILENAME File with posterior distribution of the rate \n for each sequence site - for ASRV",
|
|
"\n Group: Model\n Model type",
|
|
" --day Use 'day' model",
|
|
" --jtt Use 'jtt' model (default)",
|
|
" --rev Use 'rev' model",
|
|
" --wag Use 'wag' model",
|
|
" --cprev Use 'cprev' model",
|
|
" --nucjc Use nucleic acid JC model",
|
|
" --aaJC Use amino acid JC model",
|
|
" --k2p Use 'k2p' model",
|
|
" --hky Use 'hky' model",
|
|
" --tamura92 Use 'tamura92' model",
|
|
" --gtr Use 'gtr' model (general reversible model)",
|
|
" --modelfile=NAME Read replacement matrix from user input file",
|
|
"\nLog Options:",
|
|
" -v, --verbose=INT Log report level (verbose) (default=`1')",
|
|
" -l, --Logfile=FILENAME Log output file name (default=`-')",
|
|
0
|
|
};
|
|
|
|
static void
|
|
init_help_array(void)
|
|
{
|
|
gengetopt_args_info_help[0] = gengetopt_args_info_full_help[0];
|
|
gengetopt_args_info_help[1] = gengetopt_args_info_full_help[1];
|
|
gengetopt_args_info_help[2] = gengetopt_args_info_full_help[2];
|
|
gengetopt_args_info_help[3] = gengetopt_args_info_full_help[3];
|
|
gengetopt_args_info_help[4] = gengetopt_args_info_full_help[4];
|
|
gengetopt_args_info_help[5] = gengetopt_args_info_full_help[5];
|
|
gengetopt_args_info_help[6] = gengetopt_args_info_full_help[6];
|
|
gengetopt_args_info_help[7] = gengetopt_args_info_full_help[7];
|
|
gengetopt_args_info_help[8] = gengetopt_args_info_full_help[8];
|
|
gengetopt_args_info_help[9] = gengetopt_args_info_full_help[9];
|
|
gengetopt_args_info_help[10] = gengetopt_args_info_full_help[18];
|
|
gengetopt_args_info_help[11] = gengetopt_args_info_full_help[19];
|
|
gengetopt_args_info_help[12] = gengetopt_args_info_full_help[20];
|
|
gengetopt_args_info_help[13] = gengetopt_args_info_full_help[21];
|
|
gengetopt_args_info_help[14] = gengetopt_args_info_full_help[22];
|
|
gengetopt_args_info_help[15] = gengetopt_args_info_full_help[23];
|
|
gengetopt_args_info_help[16] = gengetopt_args_info_full_help[24];
|
|
gengetopt_args_info_help[17] = gengetopt_args_info_full_help[25];
|
|
gengetopt_args_info_help[18] = gengetopt_args_info_full_help[26];
|
|
gengetopt_args_info_help[19] = gengetopt_args_info_full_help[27];
|
|
gengetopt_args_info_help[20] = gengetopt_args_info_full_help[28];
|
|
gengetopt_args_info_help[21] = gengetopt_args_info_full_help[29];
|
|
gengetopt_args_info_help[22] = gengetopt_args_info_full_help[30];
|
|
gengetopt_args_info_help[23] = gengetopt_args_info_full_help[31];
|
|
gengetopt_args_info_help[24] = gengetopt_args_info_full_help[32];
|
|
gengetopt_args_info_help[25] = gengetopt_args_info_full_help[33];
|
|
gengetopt_args_info_help[26] = gengetopt_args_info_full_help[34];
|
|
gengetopt_args_info_help[27] = gengetopt_args_info_full_help[35];
|
|
gengetopt_args_info_help[28] = gengetopt_args_info_full_help[36];
|
|
gengetopt_args_info_help[29] = gengetopt_args_info_full_help[37];
|
|
gengetopt_args_info_help[30] = gengetopt_args_info_full_help[38];
|
|
gengetopt_args_info_help[31] = gengetopt_args_info_full_help[39];
|
|
gengetopt_args_info_help[32] = gengetopt_args_info_full_help[40];
|
|
gengetopt_args_info_help[33] = gengetopt_args_info_full_help[41];
|
|
gengetopt_args_info_help[34] = gengetopt_args_info_full_help[42];
|
|
gengetopt_args_info_help[35] = gengetopt_args_info_full_help[43];
|
|
gengetopt_args_info_help[36] = gengetopt_args_info_full_help[44];
|
|
gengetopt_args_info_help[37] = gengetopt_args_info_full_help[45];
|
|
gengetopt_args_info_help[38] = gengetopt_args_info_full_help[46];
|
|
gengetopt_args_info_help[39] = gengetopt_args_info_full_help[47];
|
|
gengetopt_args_info_help[40] = gengetopt_args_info_full_help[48];
|
|
gengetopt_args_info_help[41] = gengetopt_args_info_full_help[49];
|
|
gengetopt_args_info_help[42] = gengetopt_args_info_full_help[50];
|
|
gengetopt_args_info_help[43] = gengetopt_args_info_full_help[51];
|
|
gengetopt_args_info_help[44] = gengetopt_args_info_full_help[52];
|
|
gengetopt_args_info_help[45] = gengetopt_args_info_full_help[53];
|
|
gengetopt_args_info_help[46] = gengetopt_args_info_full_help[54];
|
|
gengetopt_args_info_help[47] = gengetopt_args_info_full_help[55];
|
|
gengetopt_args_info_help[48] = gengetopt_args_info_full_help[56];
|
|
gengetopt_args_info_help[49] = gengetopt_args_info_full_help[57];
|
|
gengetopt_args_info_help[50] = gengetopt_args_info_full_help[58];
|
|
gengetopt_args_info_help[51] = gengetopt_args_info_full_help[59];
|
|
gengetopt_args_info_help[52] = gengetopt_args_info_full_help[60];
|
|
gengetopt_args_info_help[53] = gengetopt_args_info_full_help[61];
|
|
gengetopt_args_info_help[54] = gengetopt_args_info_full_help[62];
|
|
gengetopt_args_info_help[55] = gengetopt_args_info_full_help[63];
|
|
gengetopt_args_info_help[56] = gengetopt_args_info_full_help[64];
|
|
gengetopt_args_info_help[57] = gengetopt_args_info_full_help[65];
|
|
gengetopt_args_info_help[58] = gengetopt_args_info_full_help[66];
|
|
gengetopt_args_info_help[59] = gengetopt_args_info_full_help[67];
|
|
gengetopt_args_info_help[60] = gengetopt_args_info_full_help[68];
|
|
gengetopt_args_info_help[61] = 0;
|
|
|
|
}
|
|
|
|
const char *gengetopt_args_info_help[62];
|
|
|
|
typedef enum {ARG_NO
|
|
, ARG_FLAG
|
|
, ARG_STRING
|
|
, ARG_INT
|
|
, ARG_LONG
|
|
, ARG_FLOAT
|
|
} cmdline_parser_arg_type;
|
|
|
|
static
|
|
void clear_given (struct gengetopt_args_info *args_info);
|
|
static
|
|
void clear_args (struct gengetopt_args_info *args_info);
|
|
|
|
static int
|
|
cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
|
|
struct cmdline_parser_params *params, const char *additional_error);
|
|
|
|
|
|
static char *
|
|
gengetopt_strdup (const char *s);
|
|
|
|
static
|
|
void clear_given (struct gengetopt_args_info *args_info)
|
|
{
|
|
args_info->help_given = 0 ;
|
|
args_info->full_help_given = 0 ;
|
|
args_info->version_given = 0 ;
|
|
args_info->SEMPHY_given = 0 ;
|
|
args_info->bbl_given = 0 ;
|
|
args_info->likelihood_given = 0 ;
|
|
args_info->PerPosLike_given = 0 ;
|
|
args_info->PerPosPosterior_given = 0 ;
|
|
args_info->rate_given = 0 ;
|
|
args_info->max_semphy_iter_given = 0 ;
|
|
args_info->epsilonLikelihoodImprovement4iterNJ_given = 0 ;
|
|
args_info->epsilonLikelihoodImprovement4pairwiseDistance_given = 0 ;
|
|
args_info->epsilonLikelihoodImprovement4alphaOptimiz_given = 0 ;
|
|
args_info->epsilonLikelihoodImprovement4BBL_given = 0 ;
|
|
args_info->maxNumOfBBLIter_given = 0 ;
|
|
args_info->consurf_given = 0 ;
|
|
args_info->NJ_given = 0 ;
|
|
args_info->homogeneousRatesDTME_given = 0 ;
|
|
args_info->pairwiseGammaDTME_given = 0 ;
|
|
args_info->commonAlphaDTME_given = 0 ;
|
|
args_info->rate4siteDTME_given = 0 ;
|
|
args_info->posteriorDTME_given = 0 ;
|
|
args_info->BPrepeats_given = 0 ;
|
|
args_info->BPconsensus_given = 0 ;
|
|
args_info->BPonUserTree_given = 0 ;
|
|
args_info->sequence_given = 0 ;
|
|
args_info->tree_given = 0 ;
|
|
args_info->constraint_given = 0 ;
|
|
args_info->outputfile_given = 0 ;
|
|
args_info->treeoutputfile_given = 0 ;
|
|
args_info->gaps_given = 0 ;
|
|
args_info->seed_given = 0 ;
|
|
args_info->alphabet_given = 0 ;
|
|
args_info->ratio_given = 0 ;
|
|
args_info->ACGprob_given = 0 ;
|
|
args_info->inputRate_given = 0 ;
|
|
args_info->homogeneous_given = 0 ;
|
|
args_info->alpha_given = 0 ;
|
|
args_info->optimizeAlpha_given = 0 ;
|
|
args_info->categories_given = 0 ;
|
|
args_info->laguerre_given = 0 ;
|
|
args_info->ssrv_given = 0 ;
|
|
args_info->nu_given = 0 ;
|
|
args_info->posteriorRates_given = 0 ;
|
|
args_info->day_given = 0 ;
|
|
args_info->jtt_given = 0 ;
|
|
args_info->rev_given = 0 ;
|
|
args_info->wag_given = 0 ;
|
|
args_info->cprev_given = 0 ;
|
|
args_info->nucjc_given = 0 ;
|
|
args_info->aaJC_given = 0 ;
|
|
args_info->k2p_given = 0 ;
|
|
args_info->hky_given = 0 ;
|
|
args_info->tamura92_given = 0 ;
|
|
args_info->gtr_given = 0 ;
|
|
args_info->modelfile_given = 0 ;
|
|
args_info->verbose_given = 0 ;
|
|
args_info->Logfile_given = 0 ;
|
|
args_info->DistanceTableEstimationMethod_group_counter = 0 ;
|
|
args_info->Model_group_counter = 0 ;
|
|
}
|
|
|
|
static
|
|
void clear_args (struct gengetopt_args_info *args_info)
|
|
{
|
|
FIX_UNUSED (args_info);
|
|
args_info->SEMPHY_flag = 0;
|
|
args_info->bbl_flag = 0;
|
|
args_info->likelihood_flag = 0;
|
|
args_info->PerPosLike_flag = 0;
|
|
args_info->PerPosPosterior_flag = 0;
|
|
args_info->rate_flag = 0;
|
|
args_info->max_semphy_iter_arg = 100;
|
|
args_info->max_semphy_iter_orig = NULL;
|
|
args_info->epsilonLikelihoodImprovement4iterNJ_arg = 0.01;
|
|
args_info->epsilonLikelihoodImprovement4iterNJ_orig = NULL;
|
|
args_info->epsilonLikelihoodImprovement4pairwiseDistance_arg = 0.0001;
|
|
args_info->epsilonLikelihoodImprovement4pairwiseDistance_orig = NULL;
|
|
args_info->epsilonLikelihoodImprovement4alphaOptimiz_arg = 0.01;
|
|
args_info->epsilonLikelihoodImprovement4alphaOptimiz_orig = NULL;
|
|
args_info->epsilonLikelihoodImprovement4BBL_arg = 0.01;
|
|
args_info->epsilonLikelihoodImprovement4BBL_orig = NULL;
|
|
args_info->maxNumOfBBLIter_arg = 10;
|
|
args_info->maxNumOfBBLIter_orig = NULL;
|
|
args_info->consurf_flag = 0;
|
|
args_info->BPrepeats_orig = NULL;
|
|
args_info->BPconsensus_orig = NULL;
|
|
args_info->BPonUserTree_flag = 0;
|
|
args_info->sequence_arg = gengetopt_strdup ("-");
|
|
args_info->sequence_orig = NULL;
|
|
args_info->tree_arg = NULL;
|
|
args_info->tree_orig = NULL;
|
|
args_info->constraint_arg = NULL;
|
|
args_info->constraint_orig = NULL;
|
|
args_info->outputfile_arg = gengetopt_strdup ("-");
|
|
args_info->outputfile_orig = NULL;
|
|
args_info->treeoutputfile_arg = gengetopt_strdup ("-");
|
|
args_info->treeoutputfile_orig = NULL;
|
|
args_info->gaps_flag = 0;
|
|
args_info->seed_orig = NULL;
|
|
args_info->alphabet_arg = 20;
|
|
args_info->alphabet_orig = NULL;
|
|
args_info->ratio_arg = 2.0;
|
|
args_info->ratio_orig = NULL;
|
|
args_info->ACGprob_arg = gengetopt_strdup ("0.25,0.25,0.25");
|
|
args_info->ACGprob_orig = NULL;
|
|
args_info->inputRate_arg = 1.0;
|
|
args_info->inputRate_orig = NULL;
|
|
args_info->homogeneous_flag = 0;
|
|
args_info->alpha_orig = NULL;
|
|
args_info->optimizeAlpha_flag = 0;
|
|
args_info->categories_arg = 8;
|
|
args_info->categories_orig = NULL;
|
|
args_info->laguerre_flag = 0;
|
|
args_info->ssrv_flag = 0;
|
|
args_info->nu_arg = 1.0;
|
|
args_info->nu_orig = NULL;
|
|
args_info->posteriorRates_arg = NULL;
|
|
args_info->posteriorRates_orig = NULL;
|
|
args_info->modelfile_arg = NULL;
|
|
args_info->modelfile_orig = NULL;
|
|
args_info->verbose_arg = 1;
|
|
args_info->verbose_orig = NULL;
|
|
args_info->Logfile_arg = gengetopt_strdup ("-");
|
|
args_info->Logfile_orig = NULL;
|
|
|
|
}
|
|
|
|
static
|
|
void init_args_info(struct gengetopt_args_info *args_info)
|
|
{
|
|
|
|
init_help_array();
|
|
args_info->help_help = gengetopt_args_info_full_help[0] ;
|
|
args_info->full_help_help = gengetopt_args_info_full_help[1] ;
|
|
args_info->version_help = gengetopt_args_info_full_help[2] ;
|
|
args_info->SEMPHY_help = gengetopt_args_info_full_help[4] ;
|
|
args_info->bbl_help = gengetopt_args_info_full_help[5] ;
|
|
args_info->likelihood_help = gengetopt_args_info_full_help[6] ;
|
|
args_info->PerPosLike_help = gengetopt_args_info_full_help[7] ;
|
|
args_info->PerPosPosterior_help = gengetopt_args_info_full_help[8] ;
|
|
args_info->rate_help = gengetopt_args_info_full_help[9] ;
|
|
args_info->max_semphy_iter_help = gengetopt_args_info_full_help[11] ;
|
|
args_info->epsilonLikelihoodImprovement4iterNJ_help = gengetopt_args_info_full_help[12] ;
|
|
args_info->epsilonLikelihoodImprovement4pairwiseDistance_help = gengetopt_args_info_full_help[13] ;
|
|
args_info->epsilonLikelihoodImprovement4alphaOptimiz_help = gengetopt_args_info_full_help[14] ;
|
|
args_info->epsilonLikelihoodImprovement4BBL_help = gengetopt_args_info_full_help[15] ;
|
|
args_info->maxNumOfBBLIter_help = gengetopt_args_info_full_help[16] ;
|
|
args_info->consurf_help = gengetopt_args_info_full_help[17] ;
|
|
args_info->NJ_help = gengetopt_args_info_full_help[20] ;
|
|
args_info->homogeneousRatesDTME_help = gengetopt_args_info_full_help[21] ;
|
|
args_info->pairwiseGammaDTME_help = gengetopt_args_info_full_help[22] ;
|
|
args_info->commonAlphaDTME_help = gengetopt_args_info_full_help[24] ;
|
|
args_info->rate4siteDTME_help = gengetopt_args_info_full_help[25] ;
|
|
args_info->posteriorDTME_help = gengetopt_args_info_full_help[26] ;
|
|
args_info->BPrepeats_help = gengetopt_args_info_full_help[28] ;
|
|
args_info->BPconsensus_help = gengetopt_args_info_full_help[29] ;
|
|
args_info->BPonUserTree_help = gengetopt_args_info_full_help[30] ;
|
|
args_info->sequence_help = gengetopt_args_info_full_help[32] ;
|
|
args_info->tree_help = gengetopt_args_info_full_help[33] ;
|
|
args_info->constraint_help = gengetopt_args_info_full_help[34] ;
|
|
args_info->outputfile_help = gengetopt_args_info_full_help[35] ;
|
|
args_info->treeoutputfile_help = gengetopt_args_info_full_help[36] ;
|
|
args_info->gaps_help = gengetopt_args_info_full_help[37] ;
|
|
args_info->seed_help = gengetopt_args_info_full_help[38] ;
|
|
args_info->alphabet_help = gengetopt_args_info_full_help[40] ;
|
|
args_info->ratio_help = gengetopt_args_info_full_help[41] ;
|
|
args_info->ACGprob_help = gengetopt_args_info_full_help[42] ;
|
|
args_info->inputRate_help = gengetopt_args_info_full_help[43] ;
|
|
args_info->homogeneous_help = gengetopt_args_info_full_help[45] ;
|
|
args_info->alpha_help = gengetopt_args_info_full_help[46] ;
|
|
args_info->optimizeAlpha_help = gengetopt_args_info_full_help[47] ;
|
|
args_info->categories_help = gengetopt_args_info_full_help[48] ;
|
|
args_info->laguerre_help = gengetopt_args_info_full_help[49] ;
|
|
args_info->ssrv_help = gengetopt_args_info_full_help[50] ;
|
|
args_info->nu_help = gengetopt_args_info_full_help[51] ;
|
|
args_info->posteriorRates_help = gengetopt_args_info_full_help[52] ;
|
|
args_info->day_help = gengetopt_args_info_full_help[54] ;
|
|
args_info->jtt_help = gengetopt_args_info_full_help[55] ;
|
|
args_info->rev_help = gengetopt_args_info_full_help[56] ;
|
|
args_info->wag_help = gengetopt_args_info_full_help[57] ;
|
|
args_info->cprev_help = gengetopt_args_info_full_help[58] ;
|
|
args_info->nucjc_help = gengetopt_args_info_full_help[59] ;
|
|
args_info->aaJC_help = gengetopt_args_info_full_help[60] ;
|
|
args_info->k2p_help = gengetopt_args_info_full_help[61] ;
|
|
args_info->hky_help = gengetopt_args_info_full_help[62] ;
|
|
args_info->tamura92_help = gengetopt_args_info_full_help[63] ;
|
|
args_info->gtr_help = gengetopt_args_info_full_help[64] ;
|
|
args_info->modelfile_help = gengetopt_args_info_full_help[65] ;
|
|
args_info->verbose_help = gengetopt_args_info_full_help[67] ;
|
|
args_info->Logfile_help = gengetopt_args_info_full_help[68] ;
|
|
|
|
}
|
|
|
|
void
|
|
cmdline_parser_print_version (void)
|
|
{
|
|
printf ("%s %s\n",
|
|
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
|
|
CMDLINE_PARSER_VERSION);
|
|
}
|
|
|
|
static void print_help_common(void) {
|
|
cmdline_parser_print_version ();
|
|
|
|
if (strlen(gengetopt_args_info_purpose) > 0)
|
|
printf("\n%s\n", gengetopt_args_info_purpose);
|
|
|
|
if (strlen(gengetopt_args_info_usage) > 0)
|
|
printf("\n%s\n", gengetopt_args_info_usage);
|
|
|
|
printf("\n");
|
|
|
|
if (strlen(gengetopt_args_info_description) > 0)
|
|
printf("%s\n\n", gengetopt_args_info_description);
|
|
}
|
|
|
|
void
|
|
cmdline_parser_print_help (void)
|
|
{
|
|
int i = 0;
|
|
print_help_common();
|
|
while (gengetopt_args_info_help[i])
|
|
printf("%s\n", gengetopt_args_info_help[i++]);
|
|
}
|
|
|
|
void
|
|
cmdline_parser_print_full_help (void)
|
|
{
|
|
int i = 0;
|
|
print_help_common();
|
|
while (gengetopt_args_info_full_help[i])
|
|
printf("%s\n", gengetopt_args_info_full_help[i++]);
|
|
}
|
|
|
|
void
|
|
cmdline_parser_init (struct gengetopt_args_info *args_info)
|
|
{
|
|
clear_given (args_info);
|
|
clear_args (args_info);
|
|
init_args_info (args_info);
|
|
}
|
|
|
|
void
|
|
cmdline_parser_params_init(struct cmdline_parser_params *params)
|
|
{
|
|
if (params)
|
|
{
|
|
params->override = 0;
|
|
params->initialize = 1;
|
|
params->check_required = 1;
|
|
params->check_ambiguity = 0;
|
|
params->print_errors = 1;
|
|
}
|
|
}
|
|
|
|
struct cmdline_parser_params *
|
|
cmdline_parser_params_create(void)
|
|
{
|
|
struct cmdline_parser_params *params =
|
|
(struct cmdline_parser_params *)malloc(sizeof(struct cmdline_parser_params));
|
|
cmdline_parser_params_init(params);
|
|
return params;
|
|
}
|
|
|
|
static void
|
|
free_string_field (char **s)
|
|
{
|
|
if (*s)
|
|
{
|
|
free (*s);
|
|
*s = 0;
|
|
}
|
|
}
|
|
|
|
|
|
static void
|
|
cmdline_parser_release (struct gengetopt_args_info *args_info)
|
|
{
|
|
|
|
free_string_field (&(args_info->max_semphy_iter_orig));
|
|
free_string_field (&(args_info->epsilonLikelihoodImprovement4iterNJ_orig));
|
|
free_string_field (&(args_info->epsilonLikelihoodImprovement4pairwiseDistance_orig));
|
|
free_string_field (&(args_info->epsilonLikelihoodImprovement4alphaOptimiz_orig));
|
|
free_string_field (&(args_info->epsilonLikelihoodImprovement4BBL_orig));
|
|
free_string_field (&(args_info->maxNumOfBBLIter_orig));
|
|
free_string_field (&(args_info->BPrepeats_orig));
|
|
free_string_field (&(args_info->BPconsensus_orig));
|
|
free_string_field (&(args_info->sequence_arg));
|
|
free_string_field (&(args_info->sequence_orig));
|
|
free_string_field (&(args_info->tree_arg));
|
|
free_string_field (&(args_info->tree_orig));
|
|
free_string_field (&(args_info->constraint_arg));
|
|
free_string_field (&(args_info->constraint_orig));
|
|
free_string_field (&(args_info->outputfile_arg));
|
|
free_string_field (&(args_info->outputfile_orig));
|
|
free_string_field (&(args_info->treeoutputfile_arg));
|
|
free_string_field (&(args_info->treeoutputfile_orig));
|
|
free_string_field (&(args_info->seed_orig));
|
|
free_string_field (&(args_info->alphabet_orig));
|
|
free_string_field (&(args_info->ratio_orig));
|
|
free_string_field (&(args_info->ACGprob_arg));
|
|
free_string_field (&(args_info->ACGprob_orig));
|
|
free_string_field (&(args_info->inputRate_orig));
|
|
free_string_field (&(args_info->alpha_orig));
|
|
free_string_field (&(args_info->categories_orig));
|
|
free_string_field (&(args_info->nu_orig));
|
|
free_string_field (&(args_info->posteriorRates_arg));
|
|
free_string_field (&(args_info->posteriorRates_orig));
|
|
free_string_field (&(args_info->modelfile_arg));
|
|
free_string_field (&(args_info->modelfile_orig));
|
|
free_string_field (&(args_info->verbose_orig));
|
|
free_string_field (&(args_info->Logfile_arg));
|
|
free_string_field (&(args_info->Logfile_orig));
|
|
|
|
|
|
|
|
clear_given (args_info);
|
|
}
|
|
|
|
|
|
static void
|
|
write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
|
|
{
|
|
FIX_UNUSED (values);
|
|
if (arg) {
|
|
fprintf(outfile, "%s=\"%s\"\n", opt, arg);
|
|
} else {
|
|
fprintf(outfile, "%s\n", opt);
|
|
}
|
|
}
|
|
|
|
|
|
int
|
|
cmdline_parser_dump(FILE *outfile, struct gengetopt_args_info *args_info)
|
|
{
|
|
int i = 0;
|
|
|
|
if (!outfile)
|
|
{
|
|
fprintf (stderr, "%s: cannot dump options to stream\n", CMDLINE_PARSER_PACKAGE);
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
if (args_info->help_given)
|
|
write_into_file(outfile, "help", 0, 0 );
|
|
if (args_info->full_help_given)
|
|
write_into_file(outfile, "full-help", 0, 0 );
|
|
if (args_info->version_given)
|
|
write_into_file(outfile, "version", 0, 0 );
|
|
if (args_info->SEMPHY_given)
|
|
write_into_file(outfile, "SEMPHY", 0, 0 );
|
|
if (args_info->bbl_given)
|
|
write_into_file(outfile, "bbl", 0, 0 );
|
|
if (args_info->likelihood_given)
|
|
write_into_file(outfile, "likelihood", 0, 0 );
|
|
if (args_info->PerPosLike_given)
|
|
write_into_file(outfile, "PerPosLike", 0, 0 );
|
|
if (args_info->PerPosPosterior_given)
|
|
write_into_file(outfile, "PerPosPosterior", 0, 0 );
|
|
if (args_info->rate_given)
|
|
write_into_file(outfile, "rate", 0, 0 );
|
|
if (args_info->max_semphy_iter_given)
|
|
write_into_file(outfile, "max-semphy-iter", args_info->max_semphy_iter_orig, 0);
|
|
if (args_info->epsilonLikelihoodImprovement4iterNJ_given)
|
|
write_into_file(outfile, "epsilonLikelihoodImprovement4iterNJ", args_info->epsilonLikelihoodImprovement4iterNJ_orig, 0);
|
|
if (args_info->epsilonLikelihoodImprovement4pairwiseDistance_given)
|
|
write_into_file(outfile, "epsilonLikelihoodImprovement4pairwiseDistance", args_info->epsilonLikelihoodImprovement4pairwiseDistance_orig, 0);
|
|
if (args_info->epsilonLikelihoodImprovement4alphaOptimiz_given)
|
|
write_into_file(outfile, "epsilonLikelihoodImprovement4alphaOptimiz", args_info->epsilonLikelihoodImprovement4alphaOptimiz_orig, 0);
|
|
if (args_info->epsilonLikelihoodImprovement4BBL_given)
|
|
write_into_file(outfile, "epsilonLikelihoodImprovement4BBL", args_info->epsilonLikelihoodImprovement4BBL_orig, 0);
|
|
if (args_info->maxNumOfBBLIter_given)
|
|
write_into_file(outfile, "maxNumOfBBLIter", args_info->maxNumOfBBLIter_orig, 0);
|
|
if (args_info->consurf_given)
|
|
write_into_file(outfile, "consurf", 0, 0 );
|
|
if (args_info->NJ_given)
|
|
write_into_file(outfile, "NJ", 0, 0 );
|
|
if (args_info->homogeneousRatesDTME_given)
|
|
write_into_file(outfile, "homogeneousRatesDTME", 0, 0 );
|
|
if (args_info->pairwiseGammaDTME_given)
|
|
write_into_file(outfile, "pairwiseGammaDTME", 0, 0 );
|
|
if (args_info->commonAlphaDTME_given)
|
|
write_into_file(outfile, "commonAlphaDTME", 0, 0 );
|
|
if (args_info->rate4siteDTME_given)
|
|
write_into_file(outfile, "rate4siteDTME", 0, 0 );
|
|
if (args_info->posteriorDTME_given)
|
|
write_into_file(outfile, "posteriorDTME", 0, 0 );
|
|
if (args_info->BPrepeats_given)
|
|
write_into_file(outfile, "BPrepeats", args_info->BPrepeats_orig, 0);
|
|
if (args_info->BPconsensus_given)
|
|
write_into_file(outfile, "BPconsensus", args_info->BPconsensus_orig, 0);
|
|
if (args_info->BPonUserTree_given)
|
|
write_into_file(outfile, "BPonUserTree", 0, 0 );
|
|
if (args_info->sequence_given)
|
|
write_into_file(outfile, "sequence", args_info->sequence_orig, 0);
|
|
if (args_info->tree_given)
|
|
write_into_file(outfile, "tree", args_info->tree_orig, 0);
|
|
if (args_info->constraint_given)
|
|
write_into_file(outfile, "constraint", args_info->constraint_orig, 0);
|
|
if (args_info->outputfile_given)
|
|
write_into_file(outfile, "outputfile", args_info->outputfile_orig, 0);
|
|
if (args_info->treeoutputfile_given)
|
|
write_into_file(outfile, "treeoutputfile", args_info->treeoutputfile_orig, 0);
|
|
if (args_info->gaps_given)
|
|
write_into_file(outfile, "gaps", 0, 0 );
|
|
if (args_info->seed_given)
|
|
write_into_file(outfile, "seed", args_info->seed_orig, 0);
|
|
if (args_info->alphabet_given)
|
|
write_into_file(outfile, "alphabet", args_info->alphabet_orig, 0);
|
|
if (args_info->ratio_given)
|
|
write_into_file(outfile, "ratio", args_info->ratio_orig, 0);
|
|
if (args_info->ACGprob_given)
|
|
write_into_file(outfile, "ACGprob", args_info->ACGprob_orig, 0);
|
|
if (args_info->inputRate_given)
|
|
write_into_file(outfile, "inputRate", args_info->inputRate_orig, 0);
|
|
if (args_info->homogeneous_given)
|
|
write_into_file(outfile, "homogeneous", 0, 0 );
|
|
if (args_info->alpha_given)
|
|
write_into_file(outfile, "alpha", args_info->alpha_orig, 0);
|
|
if (args_info->optimizeAlpha_given)
|
|
write_into_file(outfile, "optimizeAlpha", 0, 0 );
|
|
if (args_info->categories_given)
|
|
write_into_file(outfile, "categories", args_info->categories_orig, 0);
|
|
if (args_info->laguerre_given)
|
|
write_into_file(outfile, "laguerre", 0, 0 );
|
|
if (args_info->ssrv_given)
|
|
write_into_file(outfile, "ssrv", 0, 0 );
|
|
if (args_info->nu_given)
|
|
write_into_file(outfile, "nu", args_info->nu_orig, 0);
|
|
if (args_info->posteriorRates_given)
|
|
write_into_file(outfile, "posteriorRates", args_info->posteriorRates_orig, 0);
|
|
if (args_info->day_given)
|
|
write_into_file(outfile, "day", 0, 0 );
|
|
if (args_info->jtt_given)
|
|
write_into_file(outfile, "jtt", 0, 0 );
|
|
if (args_info->rev_given)
|
|
write_into_file(outfile, "rev", 0, 0 );
|
|
if (args_info->wag_given)
|
|
write_into_file(outfile, "wag", 0, 0 );
|
|
if (args_info->cprev_given)
|
|
write_into_file(outfile, "cprev", 0, 0 );
|
|
if (args_info->nucjc_given)
|
|
write_into_file(outfile, "nucjc", 0, 0 );
|
|
if (args_info->aaJC_given)
|
|
write_into_file(outfile, "aaJC", 0, 0 );
|
|
if (args_info->k2p_given)
|
|
write_into_file(outfile, "k2p", 0, 0 );
|
|
if (args_info->hky_given)
|
|
write_into_file(outfile, "hky", 0, 0 );
|
|
if (args_info->tamura92_given)
|
|
write_into_file(outfile, "tamura92", 0, 0 );
|
|
if (args_info->gtr_given)
|
|
write_into_file(outfile, "gtr", 0, 0 );
|
|
if (args_info->modelfile_given)
|
|
write_into_file(outfile, "modelfile", args_info->modelfile_orig, 0);
|
|
if (args_info->verbose_given)
|
|
write_into_file(outfile, "verbose", args_info->verbose_orig, 0);
|
|
if (args_info->Logfile_given)
|
|
write_into_file(outfile, "Logfile", args_info->Logfile_orig, 0);
|
|
|
|
|
|
i = EXIT_SUCCESS;
|
|
return i;
|
|
}
|
|
|
|
int
|
|
cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info)
|
|
{
|
|
FILE *outfile;
|
|
int i = 0;
|
|
|
|
outfile = fopen(filename, "w");
|
|
|
|
if (!outfile)
|
|
{
|
|
fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename);
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
i = cmdline_parser_dump(outfile, args_info);
|
|
fclose (outfile);
|
|
|
|
return i;
|
|
}
|
|
|
|
void
|
|
cmdline_parser_free (struct gengetopt_args_info *args_info)
|
|
{
|
|
cmdline_parser_release (args_info);
|
|
}
|
|
|
|
/** @brief replacement of strdup, which is not standard */
|
|
char *
|
|
gengetopt_strdup (const char *s)
|
|
{
|
|
char *result = 0;
|
|
if (!s)
|
|
return result;
|
|
|
|
result = (char*)malloc(strlen(s) + 1);
|
|
if (result == (char*)0)
|
|
return (char*)0;
|
|
strcpy(result, s);
|
|
return result;
|
|
}
|
|
|
|
static void
|
|
reset_group_DistanceTableEstimationMethod(struct gengetopt_args_info *args_info)
|
|
{
|
|
if (! args_info->DistanceTableEstimationMethod_group_counter)
|
|
return;
|
|
|
|
args_info->NJ_given = 0 ;
|
|
args_info->homogeneousRatesDTME_given = 0 ;
|
|
args_info->pairwiseGammaDTME_given = 0 ;
|
|
args_info->commonAlphaDTME_given = 0 ;
|
|
args_info->rate4siteDTME_given = 0 ;
|
|
args_info->posteriorDTME_given = 0 ;
|
|
|
|
args_info->DistanceTableEstimationMethod_group_counter = 0;
|
|
}
|
|
|
|
static void
|
|
reset_group_Model(struct gengetopt_args_info *args_info)
|
|
{
|
|
if (! args_info->Model_group_counter)
|
|
return;
|
|
|
|
args_info->day_given = 0 ;
|
|
args_info->jtt_given = 0 ;
|
|
args_info->rev_given = 0 ;
|
|
args_info->wag_given = 0 ;
|
|
args_info->cprev_given = 0 ;
|
|
args_info->nucjc_given = 0 ;
|
|
args_info->aaJC_given = 0 ;
|
|
args_info->k2p_given = 0 ;
|
|
args_info->hky_given = 0 ;
|
|
args_info->tamura92_given = 0 ;
|
|
args_info->gtr_given = 0 ;
|
|
|
|
args_info->Model_group_counter = 0;
|
|
}
|
|
|
|
int
|
|
cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
|
|
{
|
|
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
|
|
}
|
|
|
|
int
|
|
cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
|
|
struct cmdline_parser_params *params)
|
|
{
|
|
int result;
|
|
result = cmdline_parser_internal (argc, argv, args_info, params, 0);
|
|
|
|
if (result == EXIT_FAILURE)
|
|
{
|
|
cmdline_parser_free (args_info);
|
|
exit (EXIT_FAILURE);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
int
|
|
cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
|
|
{
|
|
int result;
|
|
struct cmdline_parser_params params;
|
|
|
|
params.override = override;
|
|
params.initialize = initialize;
|
|
params.check_required = check_required;
|
|
params.check_ambiguity = 0;
|
|
params.print_errors = 1;
|
|
|
|
result = cmdline_parser_internal (argc, argv, args_info, ¶ms, 0);
|
|
|
|
if (result == EXIT_FAILURE)
|
|
{
|
|
cmdline_parser_free (args_info);
|
|
exit (EXIT_FAILURE);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
int
|
|
cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
|
|
{
|
|
FIX_UNUSED (args_info);
|
|
FIX_UNUSED (prog_name);
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
|
|
static char *package_name = 0;
|
|
|
|
/**
|
|
* @brief updates an option
|
|
* @param field the generic pointer to the field to update
|
|
* @param orig_field the pointer to the orig field
|
|
* @param field_given the pointer to the number of occurrence of this option
|
|
* @param prev_given the pointer to the number of occurrence already seen
|
|
* @param value the argument for this option (if null no arg was specified)
|
|
* @param possible_values the possible values for this option (if specified)
|
|
* @param default_value the default value (in case the option only accepts fixed values)
|
|
* @param arg_type the type of this option
|
|
* @param check_ambiguity @see cmdline_parser_params.check_ambiguity
|
|
* @param override @see cmdline_parser_params.override
|
|
* @param no_free whether to free a possible previous value
|
|
* @param multiple_option whether this is a multiple option
|
|
* @param long_opt the corresponding long option
|
|
* @param short_opt the corresponding short option (or '-' if none)
|
|
* @param additional_error possible further error specification
|
|
*/
|
|
static
|
|
int update_arg(void *field, char **orig_field,
|
|
unsigned int *field_given, unsigned int *prev_given,
|
|
char *value, const char *possible_values[],
|
|
const char *default_value,
|
|
cmdline_parser_arg_type arg_type,
|
|
int check_ambiguity, int override,
|
|
int no_free, int multiple_option,
|
|
const char *long_opt, char short_opt,
|
|
const char *additional_error)
|
|
{
|
|
char *stop_char = 0;
|
|
const char *val = value;
|
|
int found;
|
|
char **string_field;
|
|
FIX_UNUSED (field);
|
|
|
|
stop_char = 0;
|
|
found = 0;
|
|
|
|
if (!multiple_option && prev_given && (*prev_given || (check_ambiguity && *field_given)))
|
|
{
|
|
if (short_opt != '-')
|
|
fprintf (stderr, "%s: `--%s' (`-%c') option given more than once%s\n",
|
|
package_name, long_opt, short_opt,
|
|
(additional_error ? additional_error : ""));
|
|
else
|
|
fprintf (stderr, "%s: `--%s' option given more than once%s\n",
|
|
package_name, long_opt,
|
|
(additional_error ? additional_error : ""));
|
|
return 1; /* failure */
|
|
}
|
|
|
|
FIX_UNUSED (default_value);
|
|
|
|
if (field_given && *field_given && ! override)
|
|
return 0;
|
|
if (prev_given)
|
|
(*prev_given)++;
|
|
if (field_given)
|
|
(*field_given)++;
|
|
if (possible_values)
|
|
val = possible_values[found];
|
|
|
|
switch(arg_type) {
|
|
case ARG_FLAG:
|
|
*((int *)field) = !*((int *)field);
|
|
break;
|
|
case ARG_INT:
|
|
if (val) *((int *)field) = strtol (val, &stop_char, 0);
|
|
break;
|
|
case ARG_LONG:
|
|
if (val) *((long *)field) = (long)strtol (val, &stop_char, 0);
|
|
break;
|
|
case ARG_FLOAT:
|
|
if (val) *((float *)field) = (float)strtod (val, &stop_char);
|
|
break;
|
|
case ARG_STRING:
|
|
if (val) {
|
|
string_field = (char **)field;
|
|
if (!no_free && *string_field)
|
|
free (*string_field); /* free previous string */
|
|
*string_field = gengetopt_strdup (val);
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
};
|
|
|
|
/* check numeric conversion */
|
|
switch(arg_type) {
|
|
case ARG_INT:
|
|
case ARG_LONG:
|
|
case ARG_FLOAT:
|
|
if (val && !(stop_char && *stop_char == '\0')) {
|
|
fprintf(stderr, "%s: invalid numeric value: %s\n", package_name, val);
|
|
return 1; /* failure */
|
|
}
|
|
break;
|
|
default:
|
|
;
|
|
};
|
|
|
|
/* store the original value */
|
|
switch(arg_type) {
|
|
case ARG_NO:
|
|
case ARG_FLAG:
|
|
break;
|
|
default:
|
|
if (value && orig_field) {
|
|
if (no_free) {
|
|
*orig_field = value;
|
|
} else {
|
|
if (*orig_field)
|
|
free (*orig_field); /* free previous string */
|
|
*orig_field = gengetopt_strdup (value);
|
|
}
|
|
}
|
|
};
|
|
|
|
return 0; /* OK */
|
|
}
|
|
|
|
|
|
int
|
|
cmdline_parser_internal (
|
|
int argc, char **argv, struct gengetopt_args_info *args_info,
|
|
struct cmdline_parser_params *params, const char *additional_error)
|
|
{
|
|
int c; /* Character of the parsed option. */
|
|
|
|
int error = 0;
|
|
struct gengetopt_args_info local_args_info;
|
|
|
|
int override;
|
|
int initialize;
|
|
int check_required;
|
|
int check_ambiguity;
|
|
|
|
package_name = argv[0];
|
|
|
|
override = params->override;
|
|
initialize = params->initialize;
|
|
check_required = params->check_required;
|
|
check_ambiguity = params->check_ambiguity;
|
|
|
|
if (initialize)
|
|
cmdline_parser_init (args_info);
|
|
|
|
cmdline_parser_init (&local_args_info);
|
|
|
|
optarg = 0;
|
|
optind = 0;
|
|
opterr = params->print_errors;
|
|
optopt = '?';
|
|
|
|
while (1)
|
|
{
|
|
int option_index = 0;
|
|
|
|
static struct option long_options[] = {
|
|
{ "help", 0, NULL, 'h' },
|
|
{ "full-help", 0, NULL, 0 },
|
|
{ "version", 0, NULL, 'V' },
|
|
{ "SEMPHY", 0, NULL, 'S' },
|
|
{ "bbl", 0, NULL, 'n' },
|
|
{ "likelihood", 0, NULL, 'L' },
|
|
{ "PerPosLike", 0, NULL, 'P' },
|
|
{ "PerPosPosterior", 0, NULL, 'B' },
|
|
{ "rate", 0, NULL, 'R' },
|
|
{ "max-semphy-iter", 1, NULL, 'M' },
|
|
{ "epsilonLikelihoodImprovement4iterNJ", 1, NULL, 0 },
|
|
{ "epsilonLikelihoodImprovement4pairwiseDistance", 1, NULL, 0 },
|
|
{ "epsilonLikelihoodImprovement4alphaOptimiz", 1, NULL, 0 },
|
|
{ "epsilonLikelihoodImprovement4BBL", 1, NULL, 0 },
|
|
{ "maxNumOfBBLIter", 1, NULL, 0 },
|
|
{ "consurf", 0, NULL, 0 },
|
|
{ "NJ", 0, NULL, 'J' },
|
|
{ "homogeneousRatesDTME", 0, NULL, 0 },
|
|
{ "pairwiseGammaDTME", 0, NULL, 0 },
|
|
{ "commonAlphaDTME", 0, NULL, 0 },
|
|
{ "rate4siteDTME", 0, NULL, 0 },
|
|
{ "posteriorDTME", 0, NULL, 0 },
|
|
{ "BPrepeats", 1, NULL, 0 },
|
|
{ "BPconsensus", 1, NULL, 0 },
|
|
{ "BPonUserTree", 0, NULL, 0 },
|
|
{ "sequence", 1, NULL, 's' },
|
|
{ "tree", 1, NULL, 't' },
|
|
{ "constraint", 1, NULL, 'c' },
|
|
{ "outputfile", 1, NULL, 'o' },
|
|
{ "treeoutputfile", 1, NULL, 'T' },
|
|
{ "gaps", 0, NULL, 'g' },
|
|
{ "seed", 1, NULL, 'r' },
|
|
{ "alphabet", 1, NULL, 'a' },
|
|
{ "ratio", 1, NULL, 'z' },
|
|
{ "ACGprob", 1, NULL, 'p' },
|
|
{ "inputRate", 1, NULL, 0 },
|
|
{ "homogeneous", 0, NULL, 'H' },
|
|
{ "alpha", 1, NULL, 'A' },
|
|
{ "optimizeAlpha", 0, NULL, 'O' },
|
|
{ "categories", 1, NULL, 'C' },
|
|
{ "laguerre", 0, NULL, 0 },
|
|
{ "ssrv", 0, NULL, 0 },
|
|
{ "nu", 1, NULL, 0 },
|
|
{ "posteriorRates", 1, NULL, 0 },
|
|
{ "day", 0, NULL, 0 },
|
|
{ "jtt", 0, NULL, 0 },
|
|
{ "rev", 0, NULL, 0 },
|
|
{ "wag", 0, NULL, 0 },
|
|
{ "cprev", 0, NULL, 0 },
|
|
{ "nucjc", 0, NULL, 0 },
|
|
{ "aaJC", 0, NULL, 0 },
|
|
{ "k2p", 0, NULL, 0 },
|
|
{ "hky", 0, NULL, 0 },
|
|
{ "tamura92", 0, NULL, 0 },
|
|
{ "gtr", 0, NULL, 0 },
|
|
{ "modelfile", 1, NULL, 0 },
|
|
{ "verbose", 1, NULL, 'v' },
|
|
{ "Logfile", 1, NULL, 'l' },
|
|
{ 0, 0, 0, 0 }
|
|
};
|
|
|
|
c = getopt_long (argc, argv, "hVSnLPBRM:Js:t:c:o:T:gr:a:z:p:HA:OC:v:l:", long_options, &option_index);
|
|
|
|
if (c == -1) break; /* Exit from `while (1)' loop. */
|
|
|
|
switch (c)
|
|
{
|
|
case 'h': /* Print help and exit. */
|
|
cmdline_parser_print_help ();
|
|
cmdline_parser_free (&local_args_info);
|
|
exit (EXIT_SUCCESS);
|
|
|
|
case 'V': /* Print version and exit. */
|
|
cmdline_parser_print_version ();
|
|
cmdline_parser_free (&local_args_info);
|
|
exit (EXIT_SUCCESS);
|
|
|
|
case 'S': /* Do SEMPHY step. */
|
|
|
|
|
|
if (update_arg((void *)&(args_info->SEMPHY_flag), 0, &(args_info->SEMPHY_given),
|
|
&(local_args_info.SEMPHY_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "SEMPHY", 'S',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'n': /* Only optimize branch length. */
|
|
|
|
|
|
if (update_arg((void *)&(args_info->bbl_flag), 0, &(args_info->bbl_given),
|
|
&(local_args_info.bbl_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "bbl", 'n',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'L': /* Compute likelihood for fixed tree. */
|
|
|
|
|
|
if (update_arg((void *)&(args_info->likelihood_flag), 0, &(args_info->likelihood_given),
|
|
&(local_args_info.likelihood_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "likelihood", 'L',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'P': /* Compute likelihood per position for a fixed tree. */
|
|
|
|
|
|
if (update_arg((void *)&(args_info->PerPosLike_flag), 0, &(args_info->PerPosLike_given),
|
|
&(local_args_info.PerPosLike_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "PerPosLike", 'P',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'B': /* Compute likelihood per position and Bayesian posterior. */
|
|
|
|
|
|
if (update_arg((void *)&(args_info->PerPosPosterior_flag), 0, &(args_info->PerPosPosterior_given),
|
|
&(local_args_info.PerPosPosterior_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "PerPosPosterior", 'B',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'R': /* optimize rate of gene. */
|
|
|
|
|
|
if (update_arg((void *)&(args_info->rate_flag), 0, &(args_info->rate_given),
|
|
&(local_args_info.rate_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "rate", 'R',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'M': /* Max number of SEM iterations. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->max_semphy_iter_arg),
|
|
&(args_info->max_semphy_iter_orig), &(args_info->max_semphy_iter_given),
|
|
&(local_args_info.max_semphy_iter_given), optarg, 0, "100", ARG_INT,
|
|
check_ambiguity, override, 0, 0,
|
|
"max-semphy-iter", 'M',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'J': /* 'classic' Neighbor Joining (same as homogeneousRates). */
|
|
|
|
if (args_info->DistanceTableEstimationMethod_group_counter && override)
|
|
reset_group_DistanceTableEstimationMethod (args_info);
|
|
args_info->DistanceTableEstimationMethod_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->NJ_given),
|
|
&(local_args_info.NJ_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"NJ", 'J',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 's': /* Sequence file name. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->sequence_arg),
|
|
&(args_info->sequence_orig), &(args_info->sequence_given),
|
|
&(local_args_info.sequence_given), optarg, 0, "-", ARG_STRING,
|
|
check_ambiguity, override, 0, 0,
|
|
"sequence", 's',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 't': /* Tree file name. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->tree_arg),
|
|
&(args_info->tree_orig), &(args_info->tree_given),
|
|
&(local_args_info.tree_given), optarg, 0, 0, ARG_STRING,
|
|
check_ambiguity, override, 0, 0,
|
|
"tree", 't',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'c': /* Constraint Tree file name. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->constraint_arg),
|
|
&(args_info->constraint_orig), &(args_info->constraint_given),
|
|
&(local_args_info.constraint_given), optarg, 0, 0, ARG_STRING,
|
|
check_ambiguity, override, 0, 0,
|
|
"constraint", 'c',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'o': /* Output file. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->outputfile_arg),
|
|
&(args_info->outputfile_orig), &(args_info->outputfile_given),
|
|
&(local_args_info.outputfile_given), optarg, 0, "-", ARG_STRING,
|
|
check_ambiguity, override, 0, 0,
|
|
"outputfile", 'o',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'T': /* Tree output file. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->treeoutputfile_arg),
|
|
&(args_info->treeoutputfile_orig), &(args_info->treeoutputfile_given),
|
|
&(local_args_info.treeoutputfile_given), optarg, 0, "-", ARG_STRING,
|
|
check_ambiguity, override, 0, 0,
|
|
"treeoutputfile", 'T',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'g': /* Remove positions with gaps. */
|
|
|
|
|
|
if (update_arg((void *)&(args_info->gaps_flag), 0, &(args_info->gaps_given),
|
|
&(local_args_info.gaps_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "gaps", 'g',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'r': /* Seed random number generator. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->seed_arg),
|
|
&(args_info->seed_orig), &(args_info->seed_given),
|
|
&(local_args_info.seed_given), optarg, 0, 0, ARG_LONG,
|
|
check_ambiguity, override, 0, 0,
|
|
"seed", 'r',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'a': /* Alphabet Size. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->alphabet_arg),
|
|
&(args_info->alphabet_orig), &(args_info->alphabet_given),
|
|
&(local_args_info.alphabet_given), optarg, 0, "20", ARG_INT,
|
|
check_ambiguity, override, 0, 0,
|
|
"alphabet", 'a',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'z': /* Transition/Transversion ratio. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->ratio_arg),
|
|
&(args_info->ratio_orig), &(args_info->ratio_given),
|
|
&(local_args_info.ratio_given), optarg, 0, "2.0", ARG_FLOAT,
|
|
check_ambiguity, override, 0, 0,
|
|
"ratio", 'z',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'p': /* User input nucleotide frequencies. String separated list for A,C,G. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->ACGprob_arg),
|
|
&(args_info->ACGprob_orig), &(args_info->ACGprob_given),
|
|
&(local_args_info.ACGprob_given), optarg, 0, "0.25,0.25,0.25", ARG_STRING,
|
|
check_ambiguity, override, 0, 0,
|
|
"ACGprob", 'p',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'H': /* Don't use Gamma ASRV. */
|
|
|
|
|
|
if (update_arg((void *)&(args_info->homogeneous_flag), 0, &(args_info->homogeneous_given),
|
|
&(local_args_info.homogeneous_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "homogeneous", 'H',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'A': /* Set alpha for Gamma ASRV. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->alpha_arg),
|
|
&(args_info->alpha_orig), &(args_info->alpha_given),
|
|
&(local_args_info.alpha_given), optarg, 0, 0, ARG_FLOAT,
|
|
check_ambiguity, override, 0, 0,
|
|
"alpha", 'A',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'O': /* Optimize alpha for Gamma ASRV. */
|
|
|
|
|
|
if (update_arg((void *)&(args_info->optimizeAlpha_flag), 0, &(args_info->optimizeAlpha_given),
|
|
&(local_args_info.optimizeAlpha_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "optimizeAlpha", 'O',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'C': /* Number of categories to use with descrete Gamma ASRV. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->categories_arg),
|
|
&(args_info->categories_orig), &(args_info->categories_given),
|
|
&(local_args_info.categories_given), optarg, 0, "8", ARG_INT,
|
|
check_ambiguity, override, 0, 0,
|
|
"categories", 'C',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'v': /* Log report level (verbose). */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->verbose_arg),
|
|
&(args_info->verbose_orig), &(args_info->verbose_given),
|
|
&(local_args_info.verbose_given), optarg, 0, "1", ARG_INT,
|
|
check_ambiguity, override, 0, 0,
|
|
"verbose", 'v',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
case 'l': /* Log output file name. */
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->Logfile_arg),
|
|
&(args_info->Logfile_orig), &(args_info->Logfile_given),
|
|
&(local_args_info.Logfile_given), optarg, 0, "-", ARG_STRING,
|
|
check_ambiguity, override, 0, 0,
|
|
"Logfile", 'l',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
break;
|
|
|
|
case 0: /* Long option with no short option */
|
|
if (strcmp (long_options[option_index].name, "full-help") == 0) {
|
|
cmdline_parser_print_full_help ();
|
|
cmdline_parser_free (&local_args_info);
|
|
exit (EXIT_SUCCESS);
|
|
}
|
|
|
|
/* The threshold for optimization of likelihood of the tree, in iterative distance-based tree reconstruction. */
|
|
if (strcmp (long_options[option_index].name, "epsilonLikelihoodImprovement4iterNJ") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->epsilonLikelihoodImprovement4iterNJ_arg),
|
|
&(args_info->epsilonLikelihoodImprovement4iterNJ_orig), &(args_info->epsilonLikelihoodImprovement4iterNJ_given),
|
|
&(local_args_info.epsilonLikelihoodImprovement4iterNJ_given), optarg, 0, "0.01", ARG_FLOAT,
|
|
check_ambiguity, override, 0, 0,
|
|
"epsilonLikelihoodImprovement4iterNJ", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* The threshold for optimization of likelihood of a pair of sequences, in pairwise distance optimization. */
|
|
else if (strcmp (long_options[option_index].name, "epsilonLikelihoodImprovement4pairwiseDistance") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->epsilonLikelihoodImprovement4pairwiseDistance_arg),
|
|
&(args_info->epsilonLikelihoodImprovement4pairwiseDistance_orig), &(args_info->epsilonLikelihoodImprovement4pairwiseDistance_given),
|
|
&(local_args_info.epsilonLikelihoodImprovement4pairwiseDistance_given), optarg, 0, "0.0001", ARG_FLOAT,
|
|
check_ambiguity, override, 0, 0,
|
|
"epsilonLikelihoodImprovement4pairwiseDistance", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* The threshold for optimization of likelihood of the tree, in alpha optimization (also used for Nu optimization when using --ssrv). */
|
|
else if (strcmp (long_options[option_index].name, "epsilonLikelihoodImprovement4alphaOptimiz") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->epsilonLikelihoodImprovement4alphaOptimiz_arg),
|
|
&(args_info->epsilonLikelihoodImprovement4alphaOptimiz_orig), &(args_info->epsilonLikelihoodImprovement4alphaOptimiz_given),
|
|
&(local_args_info.epsilonLikelihoodImprovement4alphaOptimiz_given), optarg, 0, "0.01", ARG_FLOAT,
|
|
check_ambiguity, override, 0, 0,
|
|
"epsilonLikelihoodImprovement4alphaOptimiz", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* The threshold for optimization of likelihood of the tree, in branch-lengths optimization. */
|
|
else if (strcmp (long_options[option_index].name, "epsilonLikelihoodImprovement4BBL") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->epsilonLikelihoodImprovement4BBL_arg),
|
|
&(args_info->epsilonLikelihoodImprovement4BBL_orig), &(args_info->epsilonLikelihoodImprovement4BBL_given),
|
|
&(local_args_info.epsilonLikelihoodImprovement4BBL_given), optarg, 0, "0.01", ARG_FLOAT,
|
|
check_ambiguity, override, 0, 0,
|
|
"epsilonLikelihoodImprovement4BBL", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Number of BBL iterations in BBL+ALPHA optimization. */
|
|
else if (strcmp (long_options[option_index].name, "maxNumOfBBLIter") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->maxNumOfBBLIter_arg),
|
|
&(args_info->maxNumOfBBLIter_orig), &(args_info->maxNumOfBBLIter_given),
|
|
&(local_args_info.maxNumOfBBLIter_given), optarg, 0, "10", ARG_INT,
|
|
check_ambiguity, override, 0, 0,
|
|
"maxNumOfBBLIter", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* version for use in consurf. */
|
|
else if (strcmp (long_options[option_index].name, "consurf") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg((void *)&(args_info->consurf_flag), 0, &(args_info->consurf_given),
|
|
&(local_args_info.consurf_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "consurf", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* homogeneous rates MLE distance. */
|
|
else if (strcmp (long_options[option_index].name, "homogeneousRatesDTME") == 0)
|
|
{
|
|
|
|
if (args_info->DistanceTableEstimationMethod_group_counter && override)
|
|
reset_group_DistanceTableEstimationMethod (args_info);
|
|
args_info->DistanceTableEstimationMethod_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->homogeneousRatesDTME_given),
|
|
&(local_args_info.homogeneousRatesDTME_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"homogeneousRatesDTME", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Gamma-ASRV with alpha optimized for each pair. (must give either --alpha or --optimizeAlpha). */
|
|
else if (strcmp (long_options[option_index].name, "pairwiseGammaDTME") == 0)
|
|
{
|
|
|
|
if (args_info->DistanceTableEstimationMethod_group_counter && override)
|
|
reset_group_DistanceTableEstimationMethod (args_info);
|
|
args_info->DistanceTableEstimationMethod_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->pairwiseGammaDTME_given),
|
|
&(local_args_info.pairwiseGammaDTME_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"pairwiseGammaDTME", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Side information is the alpha parameter.(must use --optimizeAlpha; may give an initial alpha value in --alpha). */
|
|
else if (strcmp (long_options[option_index].name, "commonAlphaDTME") == 0)
|
|
{
|
|
|
|
if (args_info->DistanceTableEstimationMethod_group_counter && override)
|
|
reset_group_DistanceTableEstimationMethod (args_info);
|
|
args_info->DistanceTableEstimationMethod_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->commonAlphaDTME_given),
|
|
&(local_args_info.commonAlphaDTME_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"commonAlphaDTME", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Side information is the ML rate for each site. */
|
|
else if (strcmp (long_options[option_index].name, "rate4siteDTME") == 0)
|
|
{
|
|
|
|
if (args_info->DistanceTableEstimationMethod_group_counter && override)
|
|
reset_group_DistanceTableEstimationMethod (args_info);
|
|
args_info->DistanceTableEstimationMethod_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->rate4siteDTME_given),
|
|
&(local_args_info.rate4siteDTME_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"rate4siteDTME", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Side information is the posterior probabilities of the rates at each site. (must use --optimizeAlpha; may give an initial alpha value in --alpha). */
|
|
else if (strcmp (long_options[option_index].name, "posteriorDTME") == 0)
|
|
{
|
|
|
|
if (args_info->DistanceTableEstimationMethod_group_counter && override)
|
|
reset_group_DistanceTableEstimationMethod (args_info);
|
|
args_info->DistanceTableEstimationMethod_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->posteriorDTME_given),
|
|
&(local_args_info.posteriorDTME_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"posteriorDTME", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use bootstrap and set number of repeats. */
|
|
else if (strcmp (long_options[option_index].name, "BPrepeats") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->BPrepeats_arg),
|
|
&(args_info->BPrepeats_orig), &(args_info->BPrepeats_given),
|
|
&(local_args_info.BPrepeats_given), optarg, 0, 0, ARG_INT,
|
|
check_ambiguity, override, 0, 0,
|
|
"BPrepeats", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use bootstrap and compute a Consensus tree. */
|
|
else if (strcmp (long_options[option_index].name, "BPconsensus") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->BPconsensus_arg),
|
|
&(args_info->BPconsensus_orig), &(args_info->BPconsensus_given),
|
|
&(local_args_info.BPconsensus_given), optarg, 0, 0, ARG_INT,
|
|
check_ambiguity, override, 0, 0,
|
|
"BPconsensus", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use compute support for user provided tree. */
|
|
else if (strcmp (long_options[option_index].name, "BPonUserTree") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg((void *)&(args_info->BPonUserTree_flag), 0, &(args_info->BPonUserTree_given),
|
|
&(local_args_info.BPonUserTree_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "BPonUserTree", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Set External globalRate. */
|
|
else if (strcmp (long_options[option_index].name, "inputRate") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->inputRate_arg),
|
|
&(args_info->inputRate_orig), &(args_info->inputRate_given),
|
|
&(local_args_info.inputRate_given), optarg, 0, "1.0", ARG_FLOAT,
|
|
check_ambiguity, override, 0, 0,
|
|
"inputRate", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use Laguerre approximation of Gamma - CURRENTLY NOT IMPLIMENTED. */
|
|
else if (strcmp (long_options[option_index].name, "laguerre") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg((void *)&(args_info->laguerre_flag), 0, &(args_info->laguerre_given),
|
|
&(local_args_info.laguerre_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "laguerre", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use a Site-Specific Rate Variation model (SSRV). */
|
|
else if (strcmp (long_options[option_index].name, "ssrv") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg((void *)&(args_info->ssrv_flag), 0, &(args_info->ssrv_given),
|
|
&(local_args_info.ssrv_given), optarg, 0, 0, ARG_FLAG,
|
|
check_ambiguity, override, 1, 0, "ssrv", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Set Nu for the SSRV model. */
|
|
else if (strcmp (long_options[option_index].name, "nu") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->nu_arg),
|
|
&(args_info->nu_orig), &(args_info->nu_given),
|
|
&(local_args_info.nu_given), optarg, 0, "1.0", ARG_FLOAT,
|
|
check_ambiguity, override, 0, 0,
|
|
"nu", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* File with posterior distribution of the rate for each sequence site - for ASRV. */
|
|
else if (strcmp (long_options[option_index].name, "posteriorRates") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->posteriorRates_arg),
|
|
&(args_info->posteriorRates_orig), &(args_info->posteriorRates_given),
|
|
&(local_args_info.posteriorRates_given), optarg, 0, 0, ARG_STRING,
|
|
check_ambiguity, override, 0, 0,
|
|
"posteriorRates", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use 'day' model. */
|
|
else if (strcmp (long_options[option_index].name, "day") == 0)
|
|
{
|
|
|
|
if (args_info->Model_group_counter && override)
|
|
reset_group_Model (args_info);
|
|
args_info->Model_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->day_given),
|
|
&(local_args_info.day_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"day", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use 'jtt' model (default). */
|
|
else if (strcmp (long_options[option_index].name, "jtt") == 0)
|
|
{
|
|
|
|
if (args_info->Model_group_counter && override)
|
|
reset_group_Model (args_info);
|
|
args_info->Model_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->jtt_given),
|
|
&(local_args_info.jtt_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"jtt", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use 'rev' model. */
|
|
else if (strcmp (long_options[option_index].name, "rev") == 0)
|
|
{
|
|
|
|
if (args_info->Model_group_counter && override)
|
|
reset_group_Model (args_info);
|
|
args_info->Model_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->rev_given),
|
|
&(local_args_info.rev_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"rev", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use 'wag' model. */
|
|
else if (strcmp (long_options[option_index].name, "wag") == 0)
|
|
{
|
|
|
|
if (args_info->Model_group_counter && override)
|
|
reset_group_Model (args_info);
|
|
args_info->Model_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->wag_given),
|
|
&(local_args_info.wag_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"wag", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use 'cprev' model. */
|
|
else if (strcmp (long_options[option_index].name, "cprev") == 0)
|
|
{
|
|
|
|
if (args_info->Model_group_counter && override)
|
|
reset_group_Model (args_info);
|
|
args_info->Model_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->cprev_given),
|
|
&(local_args_info.cprev_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"cprev", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use nucleic acid JC model. */
|
|
else if (strcmp (long_options[option_index].name, "nucjc") == 0)
|
|
{
|
|
|
|
if (args_info->Model_group_counter && override)
|
|
reset_group_Model (args_info);
|
|
args_info->Model_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->nucjc_given),
|
|
&(local_args_info.nucjc_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"nucjc", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use amino acid JC model. */
|
|
else if (strcmp (long_options[option_index].name, "aaJC") == 0)
|
|
{
|
|
|
|
if (args_info->Model_group_counter && override)
|
|
reset_group_Model (args_info);
|
|
args_info->Model_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->aaJC_given),
|
|
&(local_args_info.aaJC_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"aaJC", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use 'k2p' model. */
|
|
else if (strcmp (long_options[option_index].name, "k2p") == 0)
|
|
{
|
|
|
|
if (args_info->Model_group_counter && override)
|
|
reset_group_Model (args_info);
|
|
args_info->Model_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->k2p_given),
|
|
&(local_args_info.k2p_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"k2p", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use 'hky' model. */
|
|
else if (strcmp (long_options[option_index].name, "hky") == 0)
|
|
{
|
|
|
|
if (args_info->Model_group_counter && override)
|
|
reset_group_Model (args_info);
|
|
args_info->Model_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->hky_given),
|
|
&(local_args_info.hky_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"hky", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use 'tamura92' model. */
|
|
else if (strcmp (long_options[option_index].name, "tamura92") == 0)
|
|
{
|
|
|
|
if (args_info->Model_group_counter && override)
|
|
reset_group_Model (args_info);
|
|
args_info->Model_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->tamura92_given),
|
|
&(local_args_info.tamura92_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"tamura92", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Use 'gtr' model (general reversible model). */
|
|
else if (strcmp (long_options[option_index].name, "gtr") == 0)
|
|
{
|
|
|
|
if (args_info->Model_group_counter && override)
|
|
reset_group_Model (args_info);
|
|
args_info->Model_group_counter += 1;
|
|
|
|
if (update_arg( 0 ,
|
|
0 , &(args_info->gtr_given),
|
|
&(local_args_info.gtr_given), optarg, 0, 0, ARG_NO,
|
|
check_ambiguity, override, 0, 0,
|
|
"gtr", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
/* Read replacement matrix from user input file. */
|
|
else if (strcmp (long_options[option_index].name, "modelfile") == 0)
|
|
{
|
|
|
|
|
|
if (update_arg( (void *)&(args_info->modelfile_arg),
|
|
&(args_info->modelfile_orig), &(args_info->modelfile_given),
|
|
&(local_args_info.modelfile_given), optarg, 0, 0, ARG_STRING,
|
|
check_ambiguity, override, 0, 0,
|
|
"modelfile", '-',
|
|
additional_error))
|
|
goto failure;
|
|
|
|
}
|
|
|
|
break;
|
|
case '?': /* Invalid option. */
|
|
/* `getopt_long' already printed an error message. */
|
|
goto failure;
|
|
|
|
default: /* bug: option not considered. */
|
|
fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : ""));
|
|
abort ();
|
|
} /* switch */
|
|
} /* while */
|
|
|
|
if (args_info->DistanceTableEstimationMethod_group_counter > 1)
|
|
{
|
|
fprintf (stderr, "%s: %d options of group DistanceTableEstimationMethod were given. At most one is required%s.\n", argv[0], args_info->DistanceTableEstimationMethod_group_counter, (additional_error ? additional_error : ""));
|
|
error = 1;
|
|
}
|
|
|
|
if (args_info->Model_group_counter > 1)
|
|
{
|
|
fprintf (stderr, "%s: %d options of group Model were given. At most one is required%s.\n", argv[0], args_info->Model_group_counter, (additional_error ? additional_error : ""));
|
|
error = 1;
|
|
}
|
|
|
|
|
|
|
|
|
|
cmdline_parser_release (&local_args_info);
|
|
|
|
if ( error )
|
|
return (EXIT_FAILURE);
|
|
|
|
return 0;
|
|
|
|
failure:
|
|
|
|
cmdline_parser_release (&local_args_info);
|
|
return (EXIT_FAILURE);
|
|
}
|