tests/testthat/test_COG_names.R

context("LCA_alg")
library(chordomics)

test_data <- data.frame(
  uniprots = c("P21514, P21515", "P41543"),
  other = c("other", "data"),
  Uniprot = c("P21514, P21515", "P41543"),
  AllCOGs = c("COG2200 COG2771 COG3124", ""),
  UniqueCOGs = c("COG2200 COG2771 COG3124", ""),
  stringsAsFactors = F
)
results <- structure(
  list(
    uniprots = c("P21514, P21515", "P41543"),
    other = c("other", "data"),
    Uniprot = c("P21514, P21515", "P41543"),
    AllCOGs = c("COG2200 COG2771 COG3124",  ""),
    UniqueCOGs = c("COG2200", NA),
    Code = c("T", NA),
    COG_Name = c("EAL domain, c-di-GMP-specific phosphodiesterase class I (or its enzymatically inactive variant)", NA),
    COG_Category = c("Signal transduction mechanisms",NA)),
  row.names = c(NA, -2L),
  class = "data.frame")
test_that("Check function fetching list of COGs for uniprot IDs", {
  expect_equal(
    chordomics:::COG_names(df=test_data, UniqueCOGs = "UniqueCOGs"),
    results
  )
})
KevinMcDonnell6/chordomicsTest6 documentation built on Nov. 6, 2023, 7:29 a.m.