Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(tidyverse)
- # Function ----------------------------------------------------------------
- convert <- function(three_aa_seq = NULL) {
- pep_dat <- structure(list(full = c(
- "Alanine", "Arginine", "Asparagine",
- "Aspartate", "Cysteine", "Glutamine", "Glutamate", "Glycine",
- "Histidine", "Isoleucine", "Leucine", "Lysine", "Methionine",
- "Phenylalanine", "Proline", "Serine", "Threonine", "Tryptophan",
- "Tyrosine", "Valine"
- ), three = c(
- "Ala", "Arg", "Asn", "Asp",
- "Cys", "Gln", "Glu", "Gly", "His", "Ile", "Leu", "Lys", "Met",
- "Phe", "Pro", "Ser", "Thr", "Trp", "Tyr", "Val"
- ), one = c(
- "A",
- "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F",
- "P", "S", "T", "W", "Y", "V"
- )), .Names = c("full", "three", "one"), class = c("tbl_df", "tbl", "data.frame"), row.names = c(
- NA,
- -20L
- ))
- str_split(three_aa_seq, pattern = "-")[[1]] %>%
- as.tibble() %>%
- rename(three = value) %>%
- inner_join(pep_dat, by = "three") %>%
- pull(one) %>%
- paste(., collapse = "")
- }
- tribble(
- ~ pep_name, ~ three_seq,
- "PA_19", "His-Ser-Leu-Gly-Lys-Trp-Leu-Gly-His-Pro-Asp-Lys-Phe",
- "PA_20", "Thr-Ala-Pro-Arg-Ser-Leu-Arg-Arg-Ser-Ser-Cys-Phe-Gly-Gly-Arg-Met-Asp-Arg-Ile-Gly-Ala-Gln-Ser-Gly-Leu-Gly-Cys-Asn-Ser-Phe-Arg-Tyr"
- ) %>%
- mutate(pep = convert(three_aa_seq = three_seq))
Add Comment
Please, Sign In to add comment