
Convert single-letter amino acid code(s) to three-letter code(s)
Source:R/import_amrfp.R
convert_aa_code.RdThis function takes a single-letter amino acid code, a vector of single-letter codes, or a string representing a sequence of single-letter codes. It returns the corresponding three-letter code(s), concatenated directly for sequences.
Value
A character string (or vector of strings) with the three-letter amino acid code(s). For multi-character input strings, a single concatenated string is returned. Returns NA for individual unmatched codes.
Examples
# Single character input
convert_aa_code("A")
#> [1] "Ala"
# Vector of single characters
convert_aa_code(c("M", "A", "G", "Z")) # Z will be NA
#> [1] "Met" "Ala" "Gly" NA
# Multi-character sequence input
convert_aa_code("MAG")
#> [1] "MetAlaGly"
convert_aa_code("MAGL")
#> [1] "MetAlaGlyLeu"