This function quantifies proteoform ions in a mass spectrometric (MS) data
file, which comprises several mass spectra recorded at different time points
during a chromatographic run. To this end, quantify_ions() employs a
two-step integration approach: First, each of the \(i\) ions is quantified
in each of the \(n\) mass spectra by integrating intensity in the m/z
tolerance window associated with the respective ion. This step yields an
\(i \times n\) matrix of abundances (areas under the curve), with
one row per ion and one column per scan. Rows in this matrix correspond to
extracted ion currents (XICs). Second, each XIC is integrated within the
\(r\) given retention time limits. This step yields an \(i \times
r\) matrix of abundances, with one row per ion and one column per
retention time window.
quantify_ions( ms_data, ions, rt_limits = c(-Inf, +Inf), filter_ms1 = TRUE, ifun_spectrum = c("adaptive", "trapezoidal"), ifun_xic = c("trapezoidal", "adaptive") )
| ms_data | Mass spectrometric data stored in an |
|---|---|
| ions | A data frame specifying ions (see details). |
| rt_limits | A specification of retention time limits (see details). |
| filter_ms1 | If true, only scans from MS level 1 are integrated. |
| ifun_spectrum | Integration method for spectra (see details). |
| ifun_xic | Integration method for XICs (see details). |
A list of class quaxi with seven elements:
ms_filePath of the MS data file.
ifunsCharacter vector denoting the integration methods used for spectra and XICs, respectively.
ionsData frame passed to the argument ions describing \(i\)
ions, with an additional column ion_id prepended (this column contains a
unique identifier for each ion).
rt_limitsData frame with \(r\) retention time limits (columns
rt_min and rt_max) and scan indices enclosed by these limits (columns
scan_min and scan_max).
rtNumeric vector containing \(n\) retention times associated with the \(n\) scans in the MS data file.
xicsAn \(i \times n\) matrix containing XIC intensity values, with one row per ion and one column per scan.
abundancesAn \(i \times r\) matrix containing abundances, with one row per ion and one column per retention time window.
Ions are provided via a data frame that must contain two columns mz_min
and mz_max specifying the lower and upper integration limit for each ion.
The data frame may contain additional columns, which are ignored.
rt_limits accepts one of the following:
a numeric vector with two elements specifying a single retention time window
a data frame with two colums rt_min and rt_max (other columns are
ignored) specifying one retention time window per row
a data type that can be converted to a data frame, such as a named list
The values -Inf and +Inf are replaced by the minimum and maximum
retention time, respectively.
The integration method may be selected separately for the spectrum
integration step (by ifun_spectrum) and the XIC integration step (by
ifun_xic).
"adaptive"Default method for spectrum integration (step 1).
Adaptive quadrature via approxfun() and stats::integrate(). This method
is faster, but may yield wrong results if the integrand is zero over nearly
all its range (which typically occurs if XICs are integrated over the whole
chromatogram).
"trapezoidal"Default method for XIC integration (step 2). Trapezoidal integration, i.e., the exact area under the polygonal chain formed by (mz or retention time, intensity) tuples. This method is slower, but always gives correct results for XIC integration.
ms_data <- mzR::openMSfile( system.file("extdata", "mzml", "mab1.mzML", package = "fragquaxi") ) proteins <- define_proteins( system.file("extdata", "mab_sequence.fasta", package = "fragquaxi"), .disulfides = 16 ) modcoms <- define_ptm_compositions(sample_modcoms) pfm_ions <- assemble_proteoforms(proteins, modcoms) %>% ionize(36L:40L) # no rentention time limits: use all spectra quantify_ions(ms_data, pfm_ions)#>#>#>#>#> #>#>#>#> #> #> #> #> #> #> #> #> #>#>#>#> #> #> #>#>#>#>#> #> #> #> #> #>#>#>#>#>#> #>#>#>#> #> #> #> #> #> #> #> #> #>#>#>#> #> #> #>#>#>#>#> #> #> #> #> #># define several retention time windows; # instead of a list, you may also pass a data frame to rt_limits quantify_ions(ms_data, pfm_ions, rt_limits = list(rt_min = c(0, 240), rt_max = c(60, 330)))#>#>#>#>#> #>#>#>#> #> #> #> #> #> #> #> #> #>#>#>#> #> #> #> #>#>#>#>#> #> #> #> #> #> #>