|
18 | 18 | * <http://www.gnu.org/licenses/>. |
19 | 19 | */ |
20 | 20 |
|
21 | | -const auto about_msg = R"( |
22 | | -preseq bound_pop: Estimate the size of the underlying population based on |
23 | | -counts of observed species in an initial sample. |
24 | | -)"; |
25 | | - |
26 | 21 | #include "bound_pop.hpp" |
27 | 22 |
|
28 | 23 | #include "common.hpp" |
@@ -81,22 +76,22 @@ report_bootstrapped_moments(const std::vector<double> &bootstrap_moments, |
81 | 76 | } |
82 | 77 |
|
83 | 78 | // bounding n_0 |
84 | | -int |
85 | | -bound_pop_main(int argc, char *argv[]) { // NOLINT (*-avoid-c-arrays) |
| 79 | +auto |
| 80 | +bound_pop::main(int argc, char *argv[]) -> int { // NOLINT (*-avoid-c-arrays) |
86 | 81 | try { |
87 | | - bool verbose = false; |
88 | | - bool PAIRED_END = false; |
89 | | - bool HIST_INPUT = false; |
90 | | - bool VALS_INPUT = false; |
91 | | - bool QUICK_MODE = false; |
| 82 | + bool verbose{false}; |
| 83 | + bool PAIRED_END{false}; |
| 84 | + bool HIST_INPUT{false}; |
| 85 | + bool VALS_INPUT{false}; |
| 86 | + bool QUICK_MODE{false}; |
92 | 87 |
|
93 | 88 | std::string input_file_name; |
94 | 89 | std::string outfile; |
95 | 90 | std::string histogram_outfile; |
96 | 91 |
|
97 | 92 | #ifdef HAVE_HTSLIB |
98 | | - bool BAM_FORMAT_INPUT = false; |
99 | | - std::size_t MAX_SEGMENT_LENGTH = 5000; |
| 93 | + bool BAM_FORMAT_INPUT{false}; |
| 94 | + std::size_t MAX_SEGMENT_LENGTH{5000}; |
100 | 95 | std::uint32_t n_threads{1}; |
101 | 96 | #endif |
102 | 97 |
|
@@ -128,17 +123,17 @@ bound_pop_main(int argc, char *argv[]) { // NOLINT (*-avoid-c-arrays) |
128 | 123 | app.add_option("-c,--clevel", c_level, "level for confidence intervals"); |
129 | 124 | app.add_flag("-P,--pe", PAIRED_END, "input is paired end read file"); |
130 | 125 | app.add_flag("-H,--hist", HIST_INPUT, |
131 | | - "input is a text file containing the observed histogram"); |
| 126 | + "input is a text file containing the observed histogram"); |
132 | 127 | app.add_flag("-V,--vals", VALS_INPUT, |
133 | | - "input is a text file containing only the observed duplicate counts"); |
| 128 | + "input is a text file containing only the observed duplicate counts"); |
134 | 129 | #ifdef HAVE_HTSLIB |
135 | 130 | app.add_flag("-B,--bam", BAM_FORMAT_INPUT, |
136 | | - "input is in BAM format"); |
| 131 | + "input is in BAM format"); |
137 | 132 | app.add_option("-l,--seg_len", MAX_SEGMENT_LENGTH, |
138 | 133 | "maximum segment length when merging paired end bam reads"); |
139 | 134 | #endif |
140 | 135 | app.add_flag("-Q,--quick", QUICK_MODE, |
141 | | - "quick mode, estimate without bootstrapping"); |
| 136 | + "quick mode, estimate without bootstrapping"); |
142 | 137 | app.add_option("-r,--seed", seed, "seed for random number generator"); |
143 | 138 | app.add_flag("-v,--verbose", verbose, "print more info"); |
144 | 139 | // clang-format on |
@@ -193,7 +188,7 @@ bound_pop_main(int argc, char *argv[]) { // NOLINT (*-avoid-c-arrays) |
193 | 188 | std::size_t idx = 1; |
194 | 189 | while (idx < std::size(counts_hist) && counts_hist[idx]) { |
195 | 190 | // idx + 1 because function calculates (x-1)! |
196 | | - measure_moments.push_back(std::exp(factorial(idx + 1) + |
| 191 | + measure_moments.push_back(std::exp(log_factorial(idx + 1) + |
197 | 192 | std::log(counts_hist[idx]) - |
198 | 193 | std::log(counts_hist[1]))); |
199 | 194 | if (!std::isfinite(measure_moments.back())) { |
@@ -324,7 +319,7 @@ bound_pop_main(int argc, char *argv[]) { // NOLINT (*-avoid-c-arrays) |
324 | 319 | std::vector<double> bootstrap_moments(1, 1.0); |
325 | 320 | // moments[r] = (r + 1)! n_{r+1} / n_1 |
326 | 321 | for (std::size_t i = 0; i < 2 * max_num_points; i++) |
327 | | - bootstrap_moments.push_back(std::exp(factorial(i + 3) + |
| 322 | + bootstrap_moments.push_back(std::exp(log_factorial(i + 3) + |
328 | 323 | std::log(sample_hist[i + 2]) - |
329 | 324 | std::log(sample_hist[1]))); |
330 | 325 |
|
|
0 commit comments