Skip to content

Commit

Permalink
reHC*, improved help messages and default option values.
Browse files Browse the repository at this point in the history
  • Loading branch information
yp committed Sep 29, 2011
1 parent 14e6c60 commit c3bbff5
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 45 deletions.
52 changes: 26 additions & 26 deletions include/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,38 +176,38 @@ class application_t {
po::notify(vm);
DEBUG("Program parameters successfully parsed.");

// Check parameter values
DEBUG("Checking program parameters...");
bool po_check= true;
std::string po_failing_desc= "";
try {
po_check= check_options(vm);
} catch (std::logic_error& e) {
FATAL("EXCEPTION OCCURRED: " << e.what());
po_failing_desc= e.what();
po_check= false;
}
if (!po_check) {
DEBUG("Check failed.");
if (vm["help"].as<bool>()) {
// Generate the help message and exit
std::cout << _name << std::endl;
std::cout << std::endl <<
"*** Invalid parameters!" << std::endl;
if (po_failing_desc != "") {
std::cout << "Reason: " << po_failing_desc << std::endl;
}
std::cout << std::endl;
std::cout << desc << std::endl;
result= EXIT_FAILURE;
result= EXIT_SUCCESS;
} else {
// Execute
DEBUG("Check successfully completed.");
DEBUG("Beginning execution...");
// Generate the help message and exit
if (vm["help"].as<bool>()) {
// Check parameter values
DEBUG("Checking program parameters...");
bool po_check= true;
std::string po_failing_desc= "";
try {
po_check= check_options(vm);
} catch (std::logic_error& e) {
FATAL("EXCEPTION OCCURRED: " << e.what());
po_failing_desc= e.what();
po_check= false;
}
if (!po_check) {
DEBUG("Check failed.");
std::cout << _name << std::endl;
std::cout << std::endl <<
"*** Invalid parameters!" << std::endl;
if (po_failing_desc != "") {
std::cout << "Reason: " << po_failing_desc << std::endl;
}
std::cout << std::endl;
std::cout << desc << std::endl;
result= EXIT_SUCCESS;
result= EXIT_FAILURE;
} else {
// Execute
DEBUG("Check successfully completed.");
DEBUG("Beginning execution...");
result= execution(argc, argv, vm);
}
DEBUG("Execution successfully completed.");
Expand Down
38 changes: 19 additions & 19 deletions src/application/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class rehcstar_application_t: public application_t {
virtual po::options_description
get_named_options() const {
po::options_description modes("Program Modes",
po::options_description::m_default_line_length,
po::options_description::m_default_line_length-16);
po::options_description::m_default_line_length+12,
po::options_description::m_default_line_length-12);
#ifndef ONLY_INTERNAL_SAT_SOLVER
modes.add_options()
("create,1", po::bool_switch(),
Expand All @@ -85,8 +85,8 @@ class rehcstar_application_t: public application_t {
"Execute the integrated SAT solver.");
#endif // INTERNAL_SAT_SOLVER
po::options_description files("Input/Output",
po::options_description::m_default_line_length,
po::options_description::m_default_line_length-16);
po::options_description::m_default_line_length+12,
po::options_description::m_default_line_length-12);
files.add_options()
("pedigree,p",
po::value< std::string >()->default_value("pedigree.ped"),
Expand All @@ -110,7 +110,7 @@ class rehcstar_application_t: public application_t {
"File storing additional assumptions/constraints that must hold in the "
"reconstructed haplotype configuration.\n"
"Each assumption is in a single row composed by 4 white-spaced fields:\n"
"\t<kind of variable> <individual index> <locus index> <bool value (0/1)>\n");
"\t<kind of variable> <individual index> <locus index> <bool value (0/1)>");
#ifndef ONLY_INTERNAL_SAT_SOLVER
files.add_options()
("sat-cmdline,c",
Expand Down Expand Up @@ -138,13 +138,13 @@ class rehcstar_application_t: public application_t {
"Pipe the SAT instance to the external solver instead of using an intermediate file.");
#endif // ONLY_INTERNAL_SAT_SOLVER
po::options_description errors("Error Management Options",
po::options_description::m_default_line_length,
po::options_description::m_default_line_length-16);
po::options_description::m_default_line_length+12,
po::options_description::m_default_line_length-12);
errors.add_options()
("global-error", po::bool_switch()->default_value(false),
"Enable GLOBAL error handling (i.e., the global error rate in the whole pedigree is "
"less than or equal to the specified error rate, computed over genotyped loci).")
("global-error-rate", po::value< double >()->default_value(0.03),
("global-error-rate", po::value< double >()->default_value(0.005),
"Maximum error rate in all the genotypes, computed only over genotyped loci "
"(used only if '--global-error' is specified, cannot be used with '--global-error-number').")
("global-error-number", po::value< unsigned int >()->default_value(1),
Expand All @@ -153,7 +153,7 @@ class rehcstar_application_t: public application_t {
("individual-error", po::bool_switch()->default_value(false),
"Enable INDIVIDUAL error handling (i.e., the error rate in each genotype is less than "
"or equal to the specified error rate, computed over genotyped loci).")
("individual-error-rate", po::value< double >()->default_value(0.03),
("individual-error-rate", po::value< double >()->default_value(0.01),
"Maximum error rate in each genotype, computed only over genotyped loci "
"(used only if '--individual-error' is specified).")
("uniform-error", po::bool_switch()->default_value(false),
Expand All @@ -162,20 +162,20 @@ class rehcstar_application_t: public application_t {
("max-errors-in-window", po::value< unsigned int >()->default_value(4),
"Maximum number of errors in each window "
"(used only if '--uniform-error' is specified).\n"
"*MUST* be less than or equal to half window size.")
"NOTE: It *must* be less than or equal to half window size.")
("error-window-length", po::value< unsigned int >()->default_value(16),
"Number of typed loci that compose a window "
"(used only if '--uniform-error' is specified).\n"
"*MUST* be a power of 2 and *MUST* be greater than 2.\n"
"NOTE: It *must* be a power of 2 and *must* be greater than 2.\n"
"Windows overlap each other by half their length.");
po::options_description recombs("Recombination Management Options",
po::options_description::m_default_line_length,
po::options_description::m_default_line_length-16);
po::options_description::m_default_line_length+12,
po::options_description::m_default_line_length-12);
recombs.add_options()
("global-recomb", po::bool_switch()->default_value(false),
"Enable GLOBAL recombination handling (i.e., the global recombination rate in the whole "
"pedigree is less than or equal to the specified recombination rate, computed over *ALL* loci).")
("global-recomb-rate", po::value< double >()->default_value(0.03),
("global-recomb-rate", po::value< double >()->default_value(0.01),
"Maximum recombination rate in all the genotypes "
"(used only if '--global-recomb' is specified, cannot be used with '--global-recomb-number').")
("global-recomb-number", po::value< unsigned int >()->default_value(1),
Expand All @@ -191,7 +191,7 @@ class rehcstar_application_t: public application_t {
("individual-recomb", po::bool_switch()->default_value(false),
"Enable INDIVIDUAL recombination handling (i.e., the recombination rate in each genotype is "
"less than or equal to the specified recombination rate, computed over *ALL* loci).")
("individual-recomb-rate", po::value< double >()->default_value(0.03),
("individual-recomb-rate", po::value< double >()->default_value(0.01),
"Maximum recombination rate in each genotype "
"(used only if '--individual-recomb' is specified).")
("uniform-recomb", po::bool_switch()->default_value(false),
Expand All @@ -200,17 +200,17 @@ class rehcstar_application_t: public application_t {
("max-recombs-in-window", po::value< unsigned int >()->default_value(4),
"Maximum number of recombinations in each window "
"(used only if '--uniform-recomb' is specified).\n"
"*MUST* be less than or equal to half window size.")
"NOTE: It *must* be less than or equal to half window size.")
("recomb-window-length", po::value< unsigned int >()->default_value(16),
"Number of loci that compose a window "
"(used only if '--uniform-recomb' is specified).\n"
"*MUST* be a power of 2 and *MUST* be greater than 2.\n"
"NOTE: It *must* be a power of 2 and *must* be greater than 2.\n"
"Windows overlap each other by half their length.")
;

po::options_description exec_opt("Execution Management Options",
po::options_description::m_default_line_length,
po::options_description::m_default_line_length-16);
po::options_description::m_default_line_length+12,
po::options_description::m_default_line_length-12);
exec_opt.add_options()
("time-limit", po::value< unsigned int >()->default_value(0),
"Maximum (approximated) execution time in seconds (0=no limit).")
Expand Down

0 comments on commit c3bbff5

Please sign in to comment.