# load packages
library(isoorbi) # for orbitrap function
library(dplyr) # for mutating data frames
library(stringr) # for extarcting text information
library(forcats) # for recoding factors
library(ggplot2) # for data visualization
library(cowplot) # arrange multipanel plots
Replicates
This notebook processes replicate Orbitrap IRMS analyses of MRFA and generates Figure 11 of Kantnerova et al. (2024)
Setup
Using R version 4.5.0 (2025-04-11) , tidyverse version 2.0.0, and isoorbi version 1.5.1.
Data from RAW (recommend)
# read files
<-
raw_files "data/replicates" |>
orbi_find_raw() |>
orbi_read_raw(include_spectra = 1) |>
orbi_aggregate_raw() |>
orbi_identify_isotopocules("data/replicates/isotopologs.tsv") |>
orbi_filter_isotopocules()
# get replicate information from file name
$file_info$replicate <- raw_files$file_info$filename |>
raw_filesstr_extract("Replicate_\\d") |> str_replace("_", " ")
Bonus Figure: MFRA Spectra
# Arginine mass window
|> orbi_plot_spectra(mz_min = 102, mz_max = 110) raw_files
Data from ISOX (legacy)
# originally, this is how the data was read in
<-
isox_files_aas "data/replicates" |>
orbi_find_isox() |>
orbi_read_isox()
Calculations
# isotopocules data
<-
data_all |>
raw_files orbi_flag_satellite_peaks() |>
orbi_flag_weak_isotopocules(min_percent = 90) |>
# tight agc data, discard anything that's 5% above or below the mean
orbi_flag_outliers(agc_fold_cutoff = 1.05)
# summarize data
<- data_all |>
ratios # define base peak
orbi_define_basepeak("M0") |>
# pull out data with `replicate` from file info added
orbi_get_data(file_info = "replicate", scans = everything(), peaks = everything()) |>
# so we can add it to the grouping
orbi_summarize_results(ratio_method = "sum", .by = "replicate")
Figure 11 top panel
<- data_all |>
p_top orbi_plot_raw_data(
isotopocules = "M0",
x_breaks = c(5, 10),
y = intensity,
y_scale = "linear",
color = compound,
show_outliers = FALSE
+
) facet_wrap(~replicate, nrow = 1) +
labs(x = "time / min", y = "EIC / arb. unit") +
theme(strip.text = element_text(size = 16))
p_top
Figure 11 bottom panel
<-
p_bottom |> filter(isotopocule == "13C") |>
ratios ggplot() +
aes(
color = compound, shape = compound,
replicate, ratio, ymin = ratio - ratio_sem, ymax = ratio + ratio_sem
+
) # standard deviations
geom_rect(
data = function(df)
|> group_by(compound) |>
df summarize(ratio_mean = mean(ratio), ratio_sd = sd(ratio)),
map = aes(
ymin = ratio_mean - ratio_sd, ymax = ratio_mean + ratio_sd,
x = NULL, y = NULL, xmin = -Inf, xmax = +Inf, color = NULL),
fill = "gray90", show.legend = FALSE
+
) # averages
geom_hline(
data = function(df)
|> group_by(compound) |>
df summarize(ratio_mean = mean(ratio)),
map = aes(yintercept = ratio_mean, color = compound),
show.legend = FALSE
+
) # data points
geom_errorbar(width = 0.1, show.legend = FALSE) +
geom_point(fill = "white", size = 3) +
facet_grid(compound ~ ., scales = "free_y") +
# scales
scale_color_brewer(palette = "Dark2") +
scale_shape_manual(values = c(21:25)) +
scale_y_continuous(breaks = scales::pretty_breaks(3)) +
# labels
labs(x = NULL, color = NULL, shape = NULL,
y = expression("ratio ("^13*C/M0*")")) +
# theme
theme_bw() +
theme(
text = element_text(size = 16),
panel.grid = element_blank(),
strip.background = element_blank(),
strip.text = element_blank(),
axis.ticks.x = element_blank(),
legend.position = "top"
) p_bottom
Figure 11 combined
plot_grid(
+ theme(legend.position = "none"), p_bottom,
p_top ncol = 1, rel_heights = c(1, 2), align = "v", axis = "lr"
)