Skip to contents

EvaluatePairsFromXCMSSet will analyze an `xcmsSet` result or a generic peak list from a mass spectrometry experiment for mass pairs (mz1, mz2) with changes due to any tracer incorporation.

Usage

EvaluatePairsFromXCMSSet(
  xg = NULL,
  tp = NULL,
  gr = NULL,
  drt = 1,
  dmz = 0.025,
  mz_iso = 1.00335,
  n = 6,
  method = c("APCI", "ESI")[1],
  specific_row = NULL,
  testing = FALSE,
  silent = FALSE
)

Arguments

xg

xcmsSet object with group information. Alternatively, can be a numeric matrix containing `mz` and `rt` information in the first two columns followed by peak intensities of all samples in the same order as in parameters `tp` and `gr`.

tp

Time point information for all samples (obviously required, internally converted to factor).

gr

Group information for all samples, e.g. different genotypes or concentrations (optional, factor).

drt

Allowed rt deviation in time units of xcmsSet (usually seconds) to test for candidates.

dmz

Allowed mass deviation in Da.

mz_iso

Mass defect of the isotope under investigation (use 1.00335 for ^13^C experiments.

n

Number of maximal incorporated carbons to test.

method

Currently APCI or ESI. If APCI, dmz will be modified depending on n (see details).

specific_row

A single row of the peak list to process.

testing

Stop in function using browser() if specific_row is specified; can be a isotope number, i.e. 3 will stop at third isotope.

silent

Suppress warnings and console output if TRUE.

Value

A dataframe with all observable pairs within the provided xg object (usually an `xcmsSet` peak) list including mean group intensities and P values.

Details

Using 'APCI' as method assumes that (i) you analyze TMS-derivatized compounds and (ii) your MS resolution does not allow to separate Si and C isotopes but reports an intermediate mass as m/z. In this case you will find carbon isotopes below there expected masses, i.e. M+1 would be 1.001 mDa apart from M+0 instead of 1.003. The effect is increased with isotope number, i.e. M+6 will be ~20 mDa below the expected value. Hence, selecting method 'APCI' will combine your selected dmz with a allowed deviation due to mass shifts caused by Si isotopes. Use 'ESI' if you are not sure if this effect takes place in your settings.

Examples

# The example measurement data provided with HiResTEC contain a peak at 1026s
raw <- HiResTEC::raw
sam <- HiResTEC::sam
mz <- c(556.26, 561.26, 564.26)

# extract the peak intensities for 3 m/z of this peak
int <- sapply(raw, function(x) {
  tmp <- getMultipleBPC(x = x, mz = mz, mz_dev = 0.04, rt = 1026)
  tmp[attr(tmp, "maxBPC"),]
})
colnames(int) <- sam$ID; rownames(int) <- NULL
xg <- data.frame(
 "mz" = mz,
 "rt" = rep(1026.5, 3),
 int
)

# evaluate this peak list for interesting pairs
EvaluatePairsFromXCMSSet(xg=xg, tp=sam$TP, gr=sam$Group, silent=TRUE, n=8)
#>   peak_idx     rt    mz1    mz2            P    dR dRT     I1_0_G1 I1_10_G1
#> 1        1 1026.5 556.26 561.26 2.862525e-16 59.81   0 1791706.333 435445.7
#> 2        1 1026.5 556.26 564.26 1.590651e-08  8.34   0 1791706.333 435445.7
#> 3        2 1026.5 561.26 564.26 2.176209e-01  2.70   0    4980.667  28153.0
#>   I1_1440_G1 I1_0_G2 I1_10_G2 I1_1440_G2  I2_0_G1 I2_10_G1 I2_1440_G1 I2_0_G2
#> 1   302688.3 2180305  1080194   426861.7 4980.667    28153  854365.67  5968.0
#> 2   302688.3 2180305  1080194   426861.7  151.000     1751   49367.67   153.5
#> 3   854365.7    5968    48839   373715.0  151.000     1751   49367.67   153.5
#>    I2_10_G2 I2_1440_G2
#> 1 48839.000  373715.00
#> 2  2771.667   19084.33
#> 3  2771.667   19084.33