augment_barracoda_data = function(x){
# Get original peptides for each sample
originals = x %>% get_original_peptide
# Split the data into mutation data and original data
mut_dat = x %>% filter(pep.number %>% str_detect("original") %>% `!`)
org_dat = x %>% filter(pep.number %>% str_detect("original"))
# Create augmented mutation data
mut_dat_aug = mut_dat %>% get_mut_pos %>% get_mut_res %>% mutate(pep_type = 'mutant')
# Get unique samples
samples = originals %>% pull(sample)
# Create augmented original data
org_dat_aug = tibble()
for( id in samples ){
org = originals %>% filter(sample==id) %>% pull(original)
for( i in 1:nchar(org) ){
res = org %>% str_sub(start = i, end = i)
tmp = org_dat %>% filter(sample == id) %>%
mutate(mut_pos = i,
mut_res_three = res %>% residue_name(to = 'three'),
mut_res_one = res,
pep_type = 'original')
org_dat_aug = org_dat_aug %>% bind_rows(tmp)
}
}
# Merge augmented mutation data with augmented original data
d_clean_aug = mut_dat_aug %>% bind_rows(org_dat_aug) %>%
arrange(sample,mut_res_three,mut_pos)
# Done, return!
return(d_clean_aug)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.