Fix loss of precision for distance between a subseq and itself#860
Merged
seanlaw merged 13 commits intoMay 8, 2023
Conversation
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #860 +/- ##
=======================================
Coverage 99.28% 99.28%
=======================================
Files 83 83
Lines 13683 13699 +16
=======================================
+ Hits 13585 13601 +16
Misses 98 98
☔ View full report in Codecov by Sentry. |
Collaborator
Author
seanlaw
reviewed
May 6, 2023
seanlaw
reviewed
May 6, 2023
NimaSarajpoor
commented
May 7, 2023
seanlaw
reviewed
May 7, 2023
NimaSarajpoor
commented
May 7, 2023
80c051c to
1c4b158
Compare
Contributor
|
@NimaSarajpoor It looks like this is ready to be merged. Can you please confirm? |
Collaborator
Author
|
I think it is ready. (FYI: I did not change the added test function. So, the ref value is coming from Naive func as usual.) |
Contributor
|
@NimaSarajpoor Thank you for addressing this! |
This was referenced Jul 10, 2026
aamp_match does not forward query_idx to core.mass_absolute, so the self-match is never zeroed
#1151
Closed
seanlaw
pushed a commit
that referenced
this pull request
Jul 10, 2026
…1152) core._find_matches seeds candidate_idx = query_idx and then breaks when D[candidate_idx] > atol + max_distance, so it relies on D[query_idx] == 0. core.mass_absolute establishes that, but aamp_match never passed query_idx to it, unlike motifs.match which passes it to core.mass. query_idx was added to core.mass and core.mass_absolute in #860; #856 wired it into core.mass from motifs.match the next day, but aamp_motifs.py was not updated. core.mass_absolute's query_idx branches have been unreachable since, which is why they carry `# pragma: no cover`. They are now covered, so the pragmas are removed. For a correct self-join the fix is a no-op: cdist returns exactly 0.0 for the identical row, so D[query_idx] was already the minimum. What it restores is the "self-match is returned first" guarantee and the "Subsequences `Q` and `T[query_idx:query_idx+m]` are different" warning when query_idx does not describe Q -- neither of which could happen on the non-normalized path.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
According to this error, we can realize that there is a loss of precision in self match in core.mass. This can result in loss-of-precision in the output of
motifs.We first add a test function to expose this error.