Skip to content

Commit

Permalink
Fix bug in identify_one_match to handle Inf log10LRs
Browse files Browse the repository at this point in the history
  • Loading branch information
zenalapp committed Sep 6, 2023
1 parent e47fd28 commit 48c5f86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/identify_matches.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ identify_one_match_set <- function(log10_lrs, bloodmeal_id) {
thresh_low = NA
)

if (all(is.na(log10_lrs$log10_lr))) {
if (all(is.na(log10_lrs$log10_lr) | is.infinite(log10_lrs$log10_lr))) {
matches_thresh <- matches
} else if (max(log10_lrs$log10_lr[!is.infinite(log10_lrs$log10_lr)]) < 1.5 &&
is.na(notes)) {
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-identify_matches.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ test_that("identify_matches works", {
)

expect_snapshot(identify_matches(lrs))

expect_no_error(lrs |>
dplyr::mutate(log10_lr = Inf) |>
identify_matches())
})

0 comments on commit 48c5f86

Please sign in to comment.