R/to_netmhcpan_name.R

Defines functions to_netmhcpan_name

Documented in to_netmhcpan_name

#' Convert a formal haplotype name to its NetMHCpan notation
#'
#' Convert a formal MHC haplotype name to the notation used by NetMHCpan.
#' @inheritParams default_params_doc
#' @export
to_netmhcpan_name <- function(mhc_haplotype) {
  s <- stringr::str_replace_all(
    mhc_haplotype,
    "\\*",
    ""
  )

  #Need commented-out code only for DLA-starting alleles
  is_dla <- stringr::str_detect(mhc_haplotype, "DLA-")
  dla_indices <- which(is_dla)
  s[dla_indices] <- stringr::str_replace_all(
    s[dla_indices],
    ":",
    ""
  )
  s
}
tzina97/netMHCpanW documentation built on April 26, 2022, 1:18 a.m.