#' Translate Amino Acid Sequences to Topology Sequences
#'
#' @param x an amino acid sequence to be translated to a topology sequence
#'
#' @return a topology sequence (I = inside, M = membrane, O = outside)
#' @export
#'
#' @examples
#' translate("AAA")
#'
#' @importFrom stringr str_replace_all
#' @importFrom stringr str_replace
#' @importFrom stringr str_split
#' @importFrom HMM viterbi
translate <- function(x) {
x <-
stringr::str_replace_all(x, "([aA-zZ])", " \\1") %>%
stringr::str_replace(" ([aA-zZ])", "\\1") %>%
stringr::str_split(" ") %>%
base::unlist()
HMM::viterbi(HMM, x) %>%
base::paste(sep = "", collapse = "")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.