Skip to content

Commit

Permalink
Fix identify_matches bug for when both NA or Inf log10LRs
Browse files Browse the repository at this point in the history
  • Loading branch information
zenalapp committed Sep 8, 2023
1 parent 1e941db commit 66badd5
Show file tree
Hide file tree
Showing 2 changed files with 8 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 @@ -34,7 +34,7 @@ identify_one_match_set <- function(log10_lrs, bloodmeal_id) {
"all log10LRs NA or Inf",
paste0("all log10LRs NA or Inf", ";", notes)
))
} else if (max(log10_lrs$log10_lr[!is.infinite(log10_lrs$log10_lr)]) < 1.5 &&
} else if (max(log10_lrs$log10_lr[!is.na(log10_lrs$log10_lr) & !is.infinite(log10_lrs$log10_lr)]) < 1.5 &&
is.na(notes)) {
matches_thresh <- matches |>
dplyr::mutate(notes = "all log10LRs < 1.5")
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-identify_matches.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ test_that("identify_matches works", {
)
)

expect_no_error(identify_one_match_set(
lrs |>
dplyr::slice_head(n = 3) |>
dplyr::mutate(log10_lr = c(1, NA, Inf)),
"evid1"
))

expect_snapshot(identify_one_match_set(lrs, "evid1"))

expect_snapshot(identify_one_match_set(lrs, "evid2"))
Expand Down

0 comments on commit 66badd5

Please sign in to comment.