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. > get_alphabet <- seguid:::get_alphabet > make_alphabet <- seguid:::make_alphabet > > alphabet <- get_alphabet("{DNA}") > stopifnot(length(alphabet) == 4L) > > alphabet <- get_alphabet("{RNA}") > stopifnot(length(alphabet) == 4L) > > alphabet <- get_alphabet("{DNA-extended}") > stopifnot(length(alphabet) == 15L) > > alphabet <- get_alphabet("{RNA-extended}") > stopifnot(length(alphabet) == 15L) > > alphabet <- get_alphabet("{protein}") > stopifnot(length(alphabet) == 22L) > > alphabet <- get_alphabet("{protein-extended}") > stopifnot(length(alphabet) == 26L) > > ## Unknown alphabet > res <- tryCatch({ + alphabet <- get_alphabet("unknown") + }, error = identity) > stopifnot(inherits(res, "error")) > > > truth <- get_alphabet("{DNA}") > alphabet <- make_alphabet("CG,AT") > stopifnot(identical(sort(alphabet), sort(truth))) > > truth <- get_alphabet("{RNA}") > alphabet <- make_alphabet("CG,AU") > stopifnot(identical(sort(alphabet), sort(truth))) > > truth <- get_alphabet("{protein}") > alphabet <- make_alphabet("A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,O,U") > stopifnot(identical(sort(alphabet), sort(truth))) > > truth <- get_alphabet("{DNA-extended}") > alphabet <- make_alphabet("CG,AT,WW,SS,MK,RY,BV,DH,VB,NN") > stopifnot(identical(sort(alphabet), sort(truth))) > > truth <- get_alphabet("{RNA-extended}") > alphabet <- make_alphabet("CG,AU,WW,SS,MK,RY,BV,DH,VB,NN") > stopifnot(identical(sort(alphabet), sort(truth))) > > truth <- get_alphabet("{protein-extended}") > alphabet <- make_alphabet("A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,O,U,B,J,Z,X") > stopifnot(identical(sort(alphabet), sort(truth))) > > ## Invalid components; should be either one or two characters > res <- tryCatch({ + alphabet <- make_alphabet("ATT") + }, error = identity) > stopifnot(inherits(res, "error")) > > ## Incompatible components > res <- tryCatch({ + alphabet <- make_alphabet("AT,T") + }, error = identity) > stopifnot(inherits(res, "error")) > > truth <- c(get_alphabet("{DNA}"), a = "u", u = "a") > alphabet <- get_alphabet("{DNA},au,ua") > stopifnot(identical(sort(alphabet), sort(truth))) > > proc.time() user system elapsed 0.15 0.12 0.26