Closed wkumler closed 1 year ago
Code for determining the above:
mz_group <- function(mz_vals, ppm){
group_vec <- numeric(length(mz_vals))
group_num <- 1L
init_vec <- mz_vals
names(init_vec) <- seq_along(init_vec)
while(length(init_vec)>0){
mz_i <- init_vec[1]
err <- mz_i*ppm/1000000
mz_idxs <- init_vec>mz_i-err & init_vec<mz_i+err
group_vec[as.numeric(names(mz_idxs)[mz_idxs])] <- group_num
init_vec <- init_vec[!mz_idxs]
group_num <- group_num+1L
}
group_vec
}
library(dplyr)
"https://raw.githubusercontent.com/IngallsLabUW/Ingalls_" %>%
paste0("Standards/master/Ingalls_Lab_Standards.csv") %>%
read.csv() %>%
filter(Compound_Type!="Internal Standard") %>%
filter(Column=="HILIC") %>%
filter(z<0) %>%
mutate(mz_group=mz_group(mz, 10)) %>%
group_by(mz_group) %>%
mutate(n=n()) %>%
arrange(desc(n), mz_group, RT_minute) %>%
select(1:6, mz_group, n) %>%
filter(n>1) %>% split(.$mz_group)
We've been throwing around the idea of remaking our HILIC standard mixes for a while now and I'm putting together a wishlist of which compounds would be great to have in the other mix to make assignment easier. If a peak is in one standard mix and not the other, you can be pretty sure it's the compound belonging to that mix instead of an isomer. To do this, we need to have the isomers in different standard mixes and ideally alternating in retention time. I've put together a list of isomers and a wishlist for which the compounds to switch into the different mix. If there's two compounds listed either one could be switched.