本文整理汇总了C++中OptionParser::help_requested方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionParser::help_requested方法的具体用法?C++ OptionParser::help_requested怎么用?C++ OptionParser::help_requested使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionParser
的用法示例。
在下文中一共展示了OptionParser::help_requested方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: opt_parse
int
main(int argc, const char **argv) {
try {
string prb_file;
string seqfile;
string outfile;
size_t n_reads = 1000;
size_t read_width = 25;
size_t max_errors = 0;
size_t random_number_seed = numeric_limits<size_t>::max();
bool VERBOSE = false;
bool FASTQ_OUTPUT = false;
/****************** COMMAND LINE OPTIONS ********************/
static OptionParser opt_parse("simreads",
"program for generating simulated reads"
" with simulated quality scores",
"<fasta-chrom-files>");
opt_parse.add_opt("output", 'o', "Name of output file (default: stdout)",
false , outfile);
opt_parse.add_opt("reads", 'n', "number of reads to simulate",
false, n_reads);
opt_parse.add_opt("width", 'w', "width of reads to simulate",
false, read_width);
opt_parse.add_opt("err", 'e', "maximum number of simulated sequencing errors",
false, max_errors);
opt_parse.add_opt("verbose", 'v', "print more run info",
false, VERBOSE);
opt_parse.add_opt("fastq", 'q', "write FASTQ format reads",
false, FASTQ_OUTPUT);
opt_parse.add_opt("prob", 'p', "prb output file",
false, prb_file);
opt_parse.add_opt("seed", 'S', "random number seed",
false, random_number_seed);
vector<string> leftover_args;
opt_parse.parse(argc, argv, leftover_args);
if (argc == 1 || opt_parse.help_requested()) {
cerr << opt_parse.help_message() << endl;
return EXIT_SUCCESS;
}
if (opt_parse.about_requested()) {
cerr << opt_parse.about_message() << endl;
return EXIT_SUCCESS;
}
if (opt_parse.option_missing()) {
cerr << opt_parse.option_missing_message() << endl;
return EXIT_SUCCESS;
}
if (leftover_args.empty()) {
cerr << opt_parse.help_message() << endl;
return EXIT_SUCCESS;
}
vector<string> filenames(leftover_args);
/****************** END COMMAND LINE OPTIONS *****************/
if (FASTQ_OUTPUT && !prb_file.empty())
throw SMITHLABException("fastq output is incompatible "
"with specifying a prb file");
const Runif rng(random_number_seed);
vector<string> reads, read_names;
vector<vector<vector<double> > > probs;
vector<size_t> filesizes;
double total = 0;
for (size_t i = 0; i < filenames.size(); ++i) {
filesizes.push_back(get_filesize(filenames[i]));
total += filesizes.back();
}
if (VERBOSE)
cerr << "[OBTAINING READ SAMPLE DISTRIBUTION]";
vector<size_t> samples;
for (size_t i = 0; i < filesizes.size(); ++i)
samples.push_back(n_reads*filesizes[i]/total);
if (VERBOSE) cerr << "[DONE]" << endl;
if (!outfile.empty())
ofstream out(outfile.c_str());
if (!prb_file.empty())
ofstream prb(prb_file.c_str());
for (size_t i = 0; i < filenames.size(); ++i) {
if (isdir(filenames[i].c_str()))
throw SMITHLABException("\"" + filenames[i] +
"\" not a FASTA format sequence file?");
if (VERBOSE)
cerr << "[LOADING=" << filenames[i] << "]";
vector<string> names, sequences;
read_fasta_file(filenames[i].c_str(), names, sequences);
if (VERBOSE) cerr << "[DONE]" << endl;
double sub_total = 0;
for (size_t k = 0; k < sequences.size(); ++k)
sub_total += sequences[i].length();
//.........这里部分代码省略.........
示例2: SMITHLABException
int
main(int argc, const char **argv) {
try {
string prb_file;
string seqfile;
string outfile;
size_t n_reads = 1000;
size_t read_width = 25;
size_t max_errors = 0;
double meth_rate = 0.0;
double bs_rate = 1.0;
size_t random_number_seed = numeric_limits<size_t>::max();
bool VERBOSE = false;
bool FASTQ_OUTPUT = false;
bool AG_WILDCARD = false;
/****************** COMMAND LINE OPTIONS ********************/
static OptionParser
opt_parse("simreadsbs",
"program for generating simulated bisulfite treated reads with "
"simulated quality scores",
"<fasta-chrom-files>");
opt_parse.add_opt("output", 'o', "Name of output file (default: stdout)", false , outfile);
opt_parse.add_opt("reads", 'n', "number of reads to simulate", false , n_reads);
opt_parse.add_opt("width", 'w', "width of reads to simulate", false, read_width);
opt_parse.add_opt("err", 'e', "maximum number of simulated sequencing errors",
false, max_errors);
opt_parse.add_opt("verbose", 'v', "print more run info",
false, VERBOSE);
opt_parse.add_opt("fastq", 'q', "write FASTQ format reads",
false, FASTQ_OUTPUT);
opt_parse.add_opt("prob", 'p', "prb output file", false, prb_file);
opt_parse.add_opt("meth", 'm', "rate of CpG methylation",
false, meth_rate);
opt_parse.add_opt("bs", 'b', "rate of bisulfite conversion",
false, bs_rate);
opt_parse.add_opt("ag", 'A', "generate A/G wildcard reads",
false, AG_WILDCARD);
opt_parse.add_opt("seed", 'S', "random number seed",
false, random_number_seed);
vector<string> leftover_args;
opt_parse.parse(argc, argv, leftover_args);
if (argc == 1 || opt_parse.help_requested()) {
cerr << opt_parse.help_message() << endl;
return EXIT_SUCCESS;
}
if (opt_parse.about_requested()) {
cerr << opt_parse.about_message() << endl;
return EXIT_SUCCESS;
}
if (opt_parse.option_missing()) {
cerr << opt_parse.option_missing_message() << endl;
return EXIT_SUCCESS;
}
if (leftover_args.empty()) {
cerr << opt_parse.help_message() << endl;
return EXIT_SUCCESS;
}
vector<string> filenames(leftover_args);
/****************** END COMMAND LINE OPTIONS *****************/
if (FASTQ_OUTPUT && !prb_file.empty())
throw SMITHLABException("fastq output is incompatible "
"with specifying a prb file");
const Runif rng(random_number_seed);
vector<string> reads, read_names;
vector<vector<vector<double> > > probs;
vector<size_t> filesizes;
double total = 0;
for (size_t i = 0; i < filenames.size(); ++i) {
filesizes.push_back(get_filesize(filenames[i]));
total += filesizes.back();
}
vector<size_t> samples;
for (size_t i = 0; i < filesizes.size(); ++i)
samples.push_back(n_reads*filesizes[i]/total);
if (!outfile.empty())
ofstream out(outfile.c_str());
if (!prb_file.empty())
ofstream prb(prb_file.c_str());
for (size_t i = 0; i < filenames.size(); ++i) {
if (VERBOSE)
cerr << filenames[i] << endl;
vector<string> names, sequences;
read_fasta_file(filenames[i].c_str(), names, sequences);
for (size_t j = 0; j < names.size(); ++j) {
const size_t offset = names[j].find(':');
const string name(names[j].substr(0, offset));
//.........这里部分代码省略.........