comparison mykrobe_parser.R @ 5:deebc6410d13 draft

planemo upload for repository https://github.com/phac-nml/mykrobe-parser commit bbf7dd6b56e8ee77cff1f98a42a5abadd681b7ac
author nml
date Thu, 09 May 2019 14:16:34 -0400
parents 8529045f0fdf
children 8e7e5a660942
comparison
equal deleted inserted replaced
4:8529045f0fdf 5:deebc6410d13
289 mutate(tempcols = paste(drug, "R_mutations", sep = "_")) %>% 289 mutate(tempcols = paste(drug, "R_mutations", sep = "_")) %>%
290 mutate(R_mutations = variants) %>% 290 mutate(R_mutations = variants) %>%
291 mutate(variants = strsplit(variants, "__")) %>% # Split the mutations across rows (list first then split across rows) 291 mutate(variants = strsplit(variants, "__")) %>% # Split the mutations across rows (list first then split across rows)
292 unnest(variants) %>% 292 unnest(variants) %>%
293 separate(variants, c("gene", "mutation"), "_") %>% 293 separate(variants, c("gene", "mutation"), "_") %>%
294 mutate(columnname = ifelse(gene %in% c("tlyA", "rrs", "eis", "gid"), # Check for columns that include the drug name or not and paste accordingly 294 mutate(columnname = ifelse(gene %in% c("gyrA", "tlyA", "rrs", "eis", "gid"), # Check for columns that include the drug name or not and paste accordingly
295 paste("Mykrobe", drug, gene, sep = "_"), 295 paste("Mykrobe", drug, gene, sep = "_"),
296 paste("Mykrobe", gene, sep = "_"))) %>% 296 paste("Mykrobe", gene, sep = "_"))) %>%
297 # Extract out the mutation information with a regex that covers all potential genes 297 # Extract out the mutation information with a regex that covers all potential genes
298 # This regex looks for whatever is ahead of the first colon and after the last hyphen 298 # This regex looks for whatever is ahead of the first colon and after the last hyphen
299 mutate(mutation = str_match(mutation, "(.*)-.*:")[,2]) %>% 299 mutate(mutation = str_match(mutation, "(.*)-.*:")[,2]) %>%