get_original_peptide = function(x){
if(!is.tibble(x)){
stop("Input to clean_barracoda_data is not a tibble")
}
aa = c('A','R','N','D','C','Q','E','G','H','I',
'L','K','M','F','P','S','T','W','Y','V')
originals = tibble()
samples = x %>% pull(sample) %>% unique
for( id in samples ){
tmp = x %>% filter(sample==id,!str_detect(pep.number,"original")) %>% get_mut_pos %>% get_mut_res %>%
select(mut_pos,mut_res_one)
positions = tmp %>% pull(mut_pos) %>% unique %>% sort
org = ''
for( p_i in positions ){
substitions = tmp %>% filter(mut_pos == p_i) %>% pull(mut_res_one)
org_res = aa[!aa %in% substitions]
if( length(org_res) > 1 ){
warning(paste0("At peptide position '",p_i,"' in sample '",id,
"' the residue could not be unambiguously determined. ",
"Possibilities are '",paste(org_res, collapse = ','),
"'. Note, 'X' is assigned!"))
org_res = 'X'
}
org = paste0(org,org_res)
}
originals = originals %>% bind_rows(tibble(sample=id,original=org))
}
return(originals)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.