Skip to contents

This function calculates the ratio of two isotopocules (the numerator and denominator). If ratio_method = "direct", this method calculates the vector ratios for each individual numerator and denominator value pair. For all other ratio_method values, this function averages multiple measurements of each using the ratio_method and returns a single value. Normally this function is not called directly by the user, but via the function orbi_summarize_results(), which calculates isotopocule ratios and other results for an entire dataset.


  ratio_method = c("direct", "mean", "sum", "median", "geometric_mean", "slope",



Column(s) used as numerator; contains ion counts


Column used as denominator; contains ion counts


Method for computing the ratio. Please note well: the formula used to calculate ion ratios matters! Do not simply use arithmetic mean. The best option may depend on the type of data you are processing (e.g., MS1 versus M+1 fragmentation). ratio_method can be one of the following:

  • direct: no averaging, direct calculationg of numerator/denominator

  • mean: arithmetic mean of ratios from individual scans.

  • sum: sum of all ions of the numerator across all scans divided by the sum of all ions observed for the denominator across all scans.

  • geometric_mean: geometric mean of ratios from individual scans.

  • slope: The ratio is calculated using the slope obtained from a linear regression model that is weighted by the numerator x, using stats::lm(x ~ y + 0, weights = x).

  • weighted_sum: A derivative of the sum option. The weighing function ensures that each scan contributes equal weight to the ratio calculation, i.e. scans with more ions in the Orbitrap do not contribute disproportionately to the total sum of x and y that is used to calculate x/y.


Single value ratio between the isotopocules defined as numerator and denominator calculated using the ratio_method.


df <-
  system.file("extdata", "testfile_flow.isox", package = "isoorbi") |>
#> orbi_read_isox() is loading .isox data from 1 file(s)...
#> - loaded 6449 peaks for 1 compounds (HSO4-) with 5 isotopocules (M0, 33S,
#>    17O, 34S, 18O) from testfile_flow.isox in 0.26 seconds.

ions_18O <- dplyr::filter(df, isotopocule == "18O")$ions.incremental
ions_M0 <- dplyr::filter(df, isotopocule == "M0")$ions.incremental

  numerator = ions_18O, denominator = ions_M0, ratio_method = "direct"
) |> head()
#> [1] 0.011521212 0.010355176 0.011210761 0.009899539 0.010193668 0.010897927

  numerator = ions_18O, denominator = ions_M0, ratio_method = "sum"
#> [1] 0.01066211

  numerator = ions_18O, denominator = ions_M0, ratio_method = "slope"
#> [1] 0.01071427