generated from seqan/library-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] Include relaxed FPR into the DP algorithm. (#224)
* [FIX] Include relaxed FPR into the DP algorithm. * [REVIEW] Put relaxed_fpr_correction into data_store * [REVIEW] Remove maximum_bin_tracker::choose_max_bin * [REVIEW] Fix return value of get_weight Otherwise, returns double, and may cause integer-to-double promotion --------- Co-authored-by: Enrico Seiler <[email protected]>
- Loading branch information
1 parent
bdeadea
commit 14026d0
Showing
9 changed files
with
125 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// SPDX-FileCopyrightText: 2006-2024, Knut Reinert & Freie Universität Berlin | ||
// SPDX-FileCopyrightText: 2016-2024, Knut Reinert & MPI für molekulare Genetik | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#pragma once | ||
|
||
#include <cstddef> // for size_t | ||
|
||
#include <hibf/platform.hpp> | ||
|
||
namespace seqan::hibf::layout | ||
{ | ||
|
||
/*!\brief Contains parameters for compute_relaxed_fpr_correction. | ||
* \ingroup hibf_layout | ||
* \qualifier strong | ||
*/ | ||
struct relaxed_fpr_correction_parameters | ||
{ | ||
double fpr{}; | ||
double relaxed_fpr{}; | ||
size_t hash_count{}; | ||
}; | ||
|
||
/*!\brief Precompute size correction factor for merged bins which are allowed to have a relaxed FPR. | ||
* \ingroup hibf_layout | ||
*/ | ||
[[nodiscard]] double compute_relaxed_fpr_correction(relaxed_fpr_correction_parameters const & params); | ||
|
||
} // namespace seqan::hibf::layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-FileCopyrightText: 2006-2024, Knut Reinert & Freie Universität Berlin | ||
// SPDX-FileCopyrightText: 2016-2024, Knut Reinert & MPI für molekulare Genetik | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
#include <cassert> // for assert | ||
#include <cmath> // for log1p, exp, log | ||
|
||
#include <hibf/layout/compute_relaxed_fpr_correction.hpp> // for compute_fpr_correction | ||
|
||
namespace seqan::hibf::layout | ||
{ | ||
|
||
double compute_relaxed_fpr_correction(relaxed_fpr_correction_parameters const & params) | ||
{ | ||
assert(params.fpr > 0.0 && params.fpr <= 1.0); | ||
assert(params.relaxed_fpr > 0.0 && params.relaxed_fpr <= 1.0); | ||
assert(params.hash_count > 0u); | ||
assert(params.fpr <= params.relaxed_fpr); | ||
|
||
double const numerator = std::log1p(-std::exp(std::log(params.fpr) / params.hash_count)); | ||
double const denominator = std::log1p(-std::exp(std::log(params.relaxed_fpr) / params.hash_count)); | ||
double const relaxed_fpr_correction = numerator / denominator; | ||
|
||
assert(relaxed_fpr_correction > 0.0 && relaxed_fpr_correction <= 1.0); | ||
return relaxed_fpr_correction; | ||
} | ||
|
||
} // namespace seqan::hibf::layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.