Set the coverage-related parameters e and c from the given k-mer * coverage histogram. */
| 71 | /** Set the coverage-related parameters e and c from the given k-mer |
| 72 | * coverage histogram. */ |
| 73 | static inline |
| 74 | void setCoverageParameters(const Histogram& h) |
| 75 | { |
| 76 | if (!opt::coverageHistPath.empty() && opt::rank <= 0) { |
| 77 | std::ofstream histFile(opt::coverageHistPath.c_str()); |
| 78 | assert_good(histFile, opt::coverageHistPath); |
| 79 | histFile << h; |
| 80 | assert(histFile.good()); |
| 81 | } |
| 82 | |
| 83 | float minCov = calculateCoverageThreshold(h); |
| 84 | if (opt::rank <= 0) { |
| 85 | if (minCov == 0) |
| 86 | std::cout << "Unable to determine the " |
| 87 | "k-mer coverage threshold" << std::endl; |
| 88 | else |
| 89 | std::cout << "The k-mer coverage threshold is " << minCov |
| 90 | << std::endl; |
| 91 | } |
| 92 | if (minCov < 2) |
| 93 | minCov = 2; |
| 94 | |
| 95 | if ((int)opt::erode < 0) { |
| 96 | opt::erode = (unsigned)roundf(minCov); |
| 97 | if (opt::rank <= 0) |
| 98 | std::cout << "Setting parameter e (erode) to " |
| 99 | << opt::erode << std::endl; |
| 100 | } |
| 101 | if ((int)opt::erodeStrand < 0) { |
| 102 | opt::erodeStrand = minCov <= 2 ? 0 : 1; |
| 103 | if (opt::rank <= 0) |
| 104 | std::cout << "Setting parameter E (erodeStrand) to " |
| 105 | << opt::erodeStrand << std::endl; |
| 106 | } |
| 107 | if (opt::coverage < 0) { |
| 108 | opt::coverage = minCov; |
| 109 | if (opt::rank <= 0) |
| 110 | std::cout << "Setting parameter c (coverage) to " |
| 111 | << opt::coverage << std::endl; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /** Remove all k-mers with multiplicity lower than the given threshold */ |
| 116 | static inline |
no test coverage detected