diff --git a/include/hibf/config.hpp b/include/hibf/config.hpp index d282fcdb..8a19ba81 100644 --- a/include/hibf/config.hpp +++ b/include/hibf/config.hpp @@ -177,8 +177,6 @@ struct config */ double relaxed_fpr{0.3}; - double relaxed_fpr_correction_factor{}; - /*!\brief The number of threads to use during construction. [RECOMMENDED_TO_ADAPT] * * Using more threads increases the memory consumption during construction because the threads hold local diff --git a/include/hibf/layout/hierarchical_binning.hpp b/include/hibf/layout/hierarchical_binning.hpp index 0c49073b..be76d953 100644 --- a/include/hibf/layout/hierarchical_binning.hpp +++ b/include/hibf/layout/hierarchical_binning.hpp @@ -26,6 +26,8 @@ class hierarchical_binning private: //!\brief The user config passed down from the command line. seqan::hibf::config config{}; + //!\brief The correction factor for merged bins which are allowed to have a relaxed FPR + double relaxed_fpr_correction_factor{}; //!\brief Stores all data that is needed to compute the layout, e.g. the counts, sketches and the layout::layout. data_store * data{nullptr}; @@ -87,8 +89,8 @@ class hierarchical_binning std::log1p(-std::exp(std::log(config_.maximum_fpr) / config_.number_of_hash_functions)); double const denominator = std::log1p(-std::exp(std::log(config_.relaxed_fpr) / config_.number_of_hash_functions)); - config.relaxed_fpr_correction_factor = numerator / denominator; - assert(config.relaxed_fpr_correction_factor <= 1.0); + relaxed_fpr_correction_factor = numerator / denominator; + assert(relaxed_fpr_correction_factor <= 1.0); assert(data != nullptr); } diff --git a/src/layout/hierarchical_binning.cpp b/src/layout/hierarchical_binning.cpp index ac53c3ff..552915db 100644 --- a/src/layout/hierarchical_binning.cpp +++ b/src/layout/hierarchical_binning.cpp @@ -118,7 +118,7 @@ void hierarchical_binning::initialization(std::vector> & mat for (size_t j = 1; j < num_user_bins; ++j) { sum += (*data->kmer_counts)[data->positions[j]]; - matrix[0][j] = data->union_estimates[j] * config.relaxed_fpr_correction_factor; + matrix[0][j] = data->union_estimates[j] * relaxed_fpr_correction_factor; ll_matrix[0][j] = max_merge_levels(j + 1) * sum; trace[0][j] = {0u, j - 1}; // unnecessary? } @@ -130,7 +130,7 @@ void hierarchical_binning::initialization(std::vector> & mat assert(j < data->positions.size()); assert(data->positions[j] < data->kmer_counts->size()); sum += (*data->kmer_counts)[data->positions[j]]; - matrix[0][j] = sum * config.relaxed_fpr_correction_factor; + matrix[0][j] = sum * relaxed_fpr_correction_factor; ll_matrix[0][j] = max_merge_levels(j + 1) * sum; trace[0][j] = {0u, j - 1}; // unnecessary? } @@ -212,7 +212,7 @@ void hierarchical_binning::recursion(std::vector> & matrix, // union_estimates[j_prime] is the union of {j_prime, ..., j} // the + 1 is necessary because j_prime is decremented directly after weight is updated size_t const uncorrected = config.disable_estimate_union ? weight : data->union_estimates[j_prime + 1]; - return config.relaxed_fpr_correction_factor * uncorrected; + return relaxed_fpr_correction_factor * uncorrected; }; // if the user bin j-1 was not split into multiple technical bins! @@ -279,7 +279,7 @@ void hierarchical_binning::backtrack_merged_bin(size_t trace_j, if (!config.disable_estimate_union) kmer_count = sketch.estimate(); // overwrite kmer_count high_level_max_id/size bin - max_tracker.update_max(bin_id, kmer_count * config.relaxed_fpr_correction_factor); + max_tracker.update_max(bin_id, kmer_count * relaxed_fpr_correction_factor); // std::cout << "]: " << kmer_count << std::endl; }