Skip to content

Commit

Permalink
Update unit tests to account for TrEMBL ID results
Browse files Browse the repository at this point in the history
- SomaScan.db currently returns both SwissProt (manually
  reviewed/curated) and TrEMBL (uncurated) IDs from UniProt, while the
  SomaLogic online menu tool only uses SwissProt IDs
- future releases of SomaScan.db will (ideally) exclusively return
  SwissProt IDs as well - the current tests comparing online tool and
  SomaScan.db are failing, but these tests are vulnerable to changes
  caused by AnnotationDbi
- tests are now skipped, but will be retained as they will be more
  relevant in the future
  • Loading branch information
amanda-hi committed Apr 19, 2024
1 parent 08b3f6d commit 5c72bbf
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions tests/testthat/test-menu.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,35 @@ test_that("`select()` returns same results as online menu tool for `10012-5`", {
online_res <- c("10012-5", "O95238", "SPDEF")

# Results should be the same for this SeqId, regardless of menu
pkg_res_7k <- quiet(select(SomaScan.db, "10012-5", cols)) |>
as.character()
pkg_res_11k <- quiet(select(SomaScan.db, "10012-5", cols, menu = "11k")) |>
as.character()
pkg_res_7k <- quiet(select(SomaScan.db, "10012-5", cols))
pkg_res_11k <- quiet(select(SomaScan.db, "10012-5", cols, menu = "11k"))

expect_identical(pkg_res_7k, pkg_res_11k)
expect_identical(online_res, pkg_res_11k)
expect_identical(as.character(pkg_res_11k[1,]), online_res)
})

test_that("`select()` returns different results from online menu tool using key `10010-10`", {
skip("Test results differ due to presence of TrEMBL IDs in SomaScan.db")
# Returns only reviewed Uniprot accessions
online_res <- c("10010-10", "Q14457", "BECN1")
online_res <- c("10010-10", "Q14457", "BECN1")
# Returns unreviewed + reviewed Uniprot accessions
pkg_res <- quiet(select(SomaScan.db, "10010-10", cols, menu = "11k"))
d <- setdiff(pkg_res$UNIPROT, online_res[2])

expect_equal(d, c("A0A024R1X5", "W0FFG4", "B4DQ36", "E7EV84"))
expect_false(identical(online_res, pkg_res$UNIPROT))
expect_equal(d, c("A0A024R1X5", "B2R6N7", "O75595", "Q53F78", "Q9UNA8",
"W0FFG4", "B4DQ36", "E7EV84"))
expect_false(identical(pkg_res$UNIPROT, online_res))
})

# Using Gene Symbols as query keys
test_that("`select()` returns same symbols as online menu tool for `PTGR1`", {
skip("Test results differ due to presence of TrEMBL IDs in SomaScan.db")
online_res <- data.frame(
Sequence_ID = c("13543-7", "19617-5"),
Symbol = c("PTGR1", "PTGR1"),
Uniprot_ID = c("Q14914", "Q14914")
)
pkg_res <- quiet(
pkg_res_11k <- quiet(
select(SomaScan.db,
keys = "PTGR1",
keytype = "SYMBOL",
Expand All @@ -47,9 +48,9 @@ test_that("`select()` returns same symbols as online menu tool for `PTGR1`", {
)
)

expect_identical(online_res$Symbol, pkg_res$SYMBOL)
expect_identical(online_res$Sequence_ID, pkg_res$PROBEID)
expect_identical(online_res$Uniprot_ID, pkg_res$UNIPROT)
expect_identical(pkg_res$SYMBOL, online_res$Symbol)
expect_identical(pkg_res$PROBEID, online_res$Sequence_ID)
expect_identical(pkg_res$UNIPROT, online_res$Uniprot_ID)
})

# Using Uniprot IDs as query keys
Expand All @@ -70,7 +71,7 @@ test_that("`select()` returns same UniProt IDs as online menu tool for `P15692`"
menu = "7k"
)
)
expect_identical(online_res$Symbol, pkg_res$SYMBOL)
expect_identical(online_res$Sequence_ID, pkg_res$PROBEID)
expect_identical(online_res$Uniprot_ID, pkg_res$UNIPROT)
expect_identical(pkg_res$SYMBOL, online_res$Symbol)
expect_identical(pkg_res$PROBEID, online_res$Sequence_ID)
expect_identical(pkg_res$UNIPROT, online_res$Uniprot_ID)
})

0 comments on commit 5c72bbf

Please sign in to comment.