Calculate isotopocule ratioSource:
This function calculates the ratio of two isotopocules (the
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.
orbi_calculate_ratio( numerator, denominator, ratio_method = c("direct", "mean", "sum", "median", "geometric_mean", "slope", "weighted_sum") )
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_methodcan 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
sumoption. 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
ythat is used to calculate
Single value ratio between the isotopocules defined as
denominator calculated using the
df <- system.file("extdata", "testfile_flow.isox", package = "isoorbi") |> orbi_read_isox() #> 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 orbi_calculate_ratio( numerator = ions_18O, denominator = ions_M0, ratio_method = "direct" ) |> head() #>  0.011521212 0.010355176 0.011210761 0.009899539 0.010193668 0.010897927 orbi_calculate_ratio( numerator = ions_18O, denominator = ions_M0, ratio_method = "sum" ) #>  0.01066211 orbi_calculate_ratio( numerator = ions_18O, denominator = ions_M0, ratio_method = "slope" ) #>  0.01071427