Hi,
The plot from "PlotadjustedRtime", show there is one sample with great deviation and I want to find which sample this is.
With adjustedRtime(df)
and rtime(df)
I can compare the adj rt for each feature.
I though I could check which features they are (the one with the extreme diff in rt) and then see in which sample they are present after correspondence, but then features are merged and they have got other names.
Does anyone have a suggestion on how I can identify the sample?
Many thanks!
:)
I did this a few days ago for a colleague exactly the way that you describe.
Replace `
xcms_p_POS_g_r_g` with your object.
library(xcms)
library(dplyr)
library(tidyr)
investigate_data <- tibble(rtime = rtime(xcms_p_POS_g_r_g, adjusted = FALSE, bySample = TRUE),
adjustedRtime = rtime(xcms_p_POS_g_r_g, adjusted = TRUE, bySample = TRUE),
file = basename(fileNames(xcms_p_POS_g_r_g))
) %>%
unnest(c(rtime, adjustedRtime)) %>%
mutate(diff = adjustedRtime - rtime)
investigate_data %>%
filter(abs(adjustedRtime-250)<1) %>% # <-- focus on a small RT range where the outlier is clear
group_by(file) %>%
arrange(diff) %>% # <-- use desc if looking for a positive difference
slice(1) %>%
ungroup %>%
arrange(diff) # <-- use desc if looking for a positive difference
Now a ggplot that you can pass to plotly to get an interactive plot where you can hover over and see which file it is:
https://github.com/sneumann/xcms/issues/551#issuecomment-1281144616