R Under development (unstable) (2024-02-29 r86017 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > assert_valid_alphabet <- seguid:::assert_valid_alphabet > assert_in_alphabet <- seguid:::assert_in_alphabet > assert_alphabet <- seguid:::assert_alphabet > > seq <- "ABCDEFGH" > alphabet <- c("A", "C", "G", "T") > > assert_valid_alphabet(alphabet) > res <- tryCatch({ + assert_valid_alphabet("!") + }, error = identity) > stopifnot(inherits(res, "error")) > > assert_in_alphabet("ACGT", alphabet = alphabet) > assert_in_alphabet("AAAA", alphabet = alphabet) > assert_in_alphabet("", alphabet = alphabet) [1] "" > > res <- tryCatch({ + assert_in_alphabet("x", alphabet = alphabet) + }, error = identity) > stopifnot(inherits(res, "error")) > > res <- tryCatch({ + assert_in_alphabet("ACGTx", alphabet = alphabet) + }, error = identity) > stopifnot(inherits(res, "error")) > > > > alphabet <- c(G = "C", A = "T", T = "A", C = "G") > assert_alphabet(alphabet) > > res <- tryCatch({ + alphabet <- c(G = "C", A = "T", T = "A", x = "G") + assert_alphabet(alphabet) + }, error = identity) > stopifnot(inherits(res, "error")) > > proc.time() user system elapsed 0.20 0.09 0.25