Extract multiple ion chromatograms from mass spectrometry data.
Source:R/getMultipleBPC.R
getMultipleBPC.Rd
getMultipleBPC
will extract multiple BPCs from an `xcmsRaw`
or `xcmsRawLike` object for a vector of mz within the limits given by rt,
rt_dev and mz_dev.
Usage
getMultipleBPC(
x,
mz = NULL,
mz_dev = 0.005,
rt = NULL,
rt_dev = 2,
zeroVal = NA,
smooth = 0,
returnEIC = FALSE
)
Arguments
- x
`xcmsRaw` or `xcmsRawLike` object.
- mz
Numeric vector of masses or NULL (default) to return the overall BPC.
- mz_dev
Allowed mass deviations (can be a single numeric, a vector, a matrix with one row (lower bound, upper bound) or a matrix with
length(mz)
rows giving lower and upper bound for each mz).- rt
Target retention time or NULL (default) to use full time range.
- rt_dev
Allowed time deviation (if rt is specified).
- zeroVal
Set values <=0 to NA or keep as is with NULL.
- smooth
Window size for moving average smoother, 0 = no smoothing.
- returnEIC
Return EIC instead of BPC?
Value
A matrix with scan wise (rows) intensities for all requested masses (columns) as either EIC or BPC.
Details
While there are other functions to extract BPC information from raw data, this one is particularly useful to get all traces belonging to a isotopologue group. It will attach several derived values to the results object, i.e. describing the observed mass shift (deviation from expected value) which is helpful in QC for non-targeted tracer analyses. While the `mz` and `mz_dev` parameters can be vectorized, the `rt` and `rt_dev` values will be consistently used for all ion traces.
Examples
raw <- HiResTEC::raw
# search for mz = 556.263 and its isotopic traces
mz <- 556.263 + c(0:3) * 1.0034
getMultipleBPC(x = raw[[1]], mz = mz, mz_dev = 0.04, rt = 1026)
#> 556.263 557.2664 558.2698 559.2732
#> 1024 192 409 137 NA
#> 1024.11 108 442 285 185
#> 1024.22 218 689 264 174
#> 1024.33 182 376 212 199
#> 1024.44 203 474 318 248
#> 1024.55 176 281 227 NA
#> 1024.66 479 347 220 236
#> 1024.77 756 585 333 213
#> 1024.88 1067 634 314 312
#> 1024.98 2776 1399 716 284
#> 1025.09 6610 3098 1485 541
#> 1025.2 12169 6060 2964 977
#> 1025.31 25375 12122 6366 2332
#> 1025.42 46946 21670 10722 3032
#> 1025.53 72569 35616 18733 5730
#> 1025.64 124835 60170 28377 9419
#> 1025.75 193894 88264 45633 14346
#> 1025.86 311245 142143 68544 21378
#> 1025.97 441113 201026 97625 30563
#> 1026.08 545974 248761 122117 37187
#> 1026.19 692311 313574 149188 45408
#> 1026.29 781599 349588 173431 51490
#> 1026.4 835705 384270 185293 54482
#> 1026.52 885279 410974 196540 56425
#> 1026.62 844186 410959 192598 56592
#> 1026.73 864405 390477 182583 54265
#> 1026.84 816490 364957 168895 50189
#> 1026.95 707994 308642 144234 41869
#> 1027.06 595325 254635 123740 35046
#> 1027.17 457785 201628 93148 25830
#> 1027.28 342583 143835 67293 20131
#> 1027.39 224530 95186 44864 12414
#> 1027.5 138206 55236 27720 7816
#> 1027.61 85222 36381 17371 5349
#> 1027.71 55698 22611 11126 3105
#> 1027.83 31004 12899 6397 1905
#> 1027.93 17426 7050 3099 1011
#> attr(,"rt")
#> [1] 1024.003 1024.112 1024.221 1024.329 1024.440 1024.549 1024.658 1024.767
#> [9] 1024.876 1024.984 1025.093 1025.204 1025.312 1025.422 1025.531 1025.640
#> [17] 1025.750 1025.859 1025.967 1026.078 1026.187 1026.294 1026.404 1026.515
#> [25] 1026.624 1026.731 1026.842 1026.951 1027.059 1027.169 1027.279 1027.389
#> [33] 1027.497 1027.607 1027.714 1027.825 1027.932
#> attr(,"mz")
#> [1] 556.2630 557.2664 558.2698 559.2732
#> attr(,"mz_dev")
#> [1] 0.04
#> attr(,"maxBPC")
#> 1026.52
#> 24
#> attr(,"mass_defect")
#> [1] -1 -3 -8 -11