Description Usage Arguments Details Value Note Author(s) See Also Examples
View source: R/functions-MSnExp.R
combineSpectraMovingWindow
combines signal from consecutive spectra within
a file. The resulting MSnExp
has the same total number of spectra than the
original object, but with each individual's spectrum information
representing aggregated data from the original spectrum and its neighboring
spectra. This is thus equivalent with a smoothing of the data in retention
time dimension.
Note that the function returns always a MSnExp
object, even if x
was an
OnDiskMSnExp
object.
1 2 3 4 5 6 7 8 9 10 |
x |
|
halfWindowSize |
|
intensityFun |
|
mzd |
|
timeDomain |
|
weighted |
|
ppm |
|
BPPARAM |
parallel processing settings. |
The method assumes same ions being measured in consecutive scans (i.e. LCMS data) and thus combines their signal which can increase the increase the signal to noise ratio.
Intensities (and m/z values) for signals with the same m/z value in
consecutive scans are aggregated using the intensityFun
.
m/z values of intensities from consecutive scans will never be exactly
identical, even if they represent signal from the same ion. The function
determines thus internally a similarity threshold based on differences
between m/z values within and between spectra below which m/z values are
considered to derive from the same ion. For robustness reasons, this
threshold is estimated on the 100 spectra with the largest number of
m/z - intensity pairs (i.e. mass peaks).
See meanMzInts()
for details.
Parameter timeDomain
: by default, m/z-intensity pairs from consecutive
scans to be aggregated are defined based on the square root of the m/z
values. This is because it is highly likely that in all QTOF MS instruments
data is collected based on a timing circuit (with a certain variance) and
m/z values are later derived based on the relationship t = k * sqrt(m/z)
.
Differences between individual m/z values will thus be dependent on the
actual m/z value causing both the difference between m/z values and their
scattering being different in the lower and upper m/z range. Determining
m/z values to be combined on the sqrt(mz)
reduces this dependency. For
non-QTOF MS data timeDomain = FALSE
might be used instead.
MSnExp
with the same number of spectra than x
.
The function has to read all data into memory for the spectra combining
and thus the memory requirements of this function are high, possibly
preventing its usage on large experimental data. In these cases it is
suggested to perform the combination on a per-file basis and save the
results using the writeMSData()
function afterwards.
Johannes Rainer, Sigurdur Smarason
meanMzInts()
for the function combining spectra provided in
a list
.
estimateMzScattering()
for a function to estimate m/z value scattering in
consecutive spectra.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | library(MSnbase)
library(msdata)
## Read a profile-mode LC-MS data file.
fl <- dir(system.file("sciex", package = "msdata"), full.names = TRUE)[1]
od <- readMSData(fl, mode = "onDisk")
## Subset the object to the retention time range that includes the signal
## for proline. This is done for performance reasons.
rtr <- c(165, 175)
od <- filterRt(od, rtr)
## Combine signal from neighboring spectra.
od_comb <- combineSpectraMovingWindow(od)
## The combined spectra have the same number of spectra, same number of
## mass peaks per spectra, but the signal is larger in the combined object.
length(od)
length(od_comb)
peaksCount(od)
peaksCount(od_comb)
## Comparing the chromatographic signal for proline (m/z ~ 116.0706)
## before and after spectra data combination.
mzr <- c(116.065, 116.075)
chr <- chromatogram(od, rt = rtr, mz = mzr)
chr_comb <- chromatogram(od_comb, rt = rtr, mz = mzr)
par(mfrow = c(1, 2))
plot(chr)
plot(chr_comb)
## Chromatographic data is "smoother" after combining.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.