Description Usage Arguments Value Author(s) Examples
annotateMz annotates m/z values using either a
compound definitions or a
CompDb() and a user provided list of potential
(expected) adducts. In detail, the function calculates for each input m/z
value the masses of the potential ion adducts and compares these with
(monoisotopic) masses provided in the reference annotation. A hit is returned
if the mass difference is smaller than
object being a
data.frame or equivalend
class, the function returns a
list of subsets of
compounds with rows
matching the adducts' mass. If no match is found for the mass of any
adducts, a row of
compounds with all values set to
NA is returned. Note
ofdata.frame's is returned.s
1 2 3 4 5 6 7 8
## S4 method for signature 'numeric,DataFrameOrEquivalent' annotateMz(object, compounds, adduct = adducts(), ppm = 10, ...) ## S4 method for signature 'DataFrameOrEquivalent,DataFrameOrEquivalent' annotateMz(object, compounds, adduct = adducts(), ppm = 10, mzcol = "mz", ...) ## S4 method for signature 'numericOrDataFrameOrEquivalent,CompDb' annotateMz(object, compounds, adduct = adducts(), ppm = 10, ...)
adduct definition. Either a
additional parameters for the
See description above for details.
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
## Read compound annotations from a package-internal SDF file containing ## a small subset of HMDB annotations fl <- system.file("sdf/HMDB_sub.sdf.gz", package = "CompoundDb") cmps <- compound_tbl_sdf(fl) cmps ## Annotate provided m/z values assuming they represent mass-to-charge ## values for [M+H]+ adducts. mzs <- c(105.0546, 75.09168, 127.0365, 113.04756, 113.1210) res <- annotateMz(mzs, cmps, adduct = "[M+H]+") ## res is a `list` with the matching hits for each m/z and the specified ## adduct. If no match was found the result contains only `NA` values. res ## Annotating using all adducts defined by `adducts()` and accepting a ## 20ppm difference between the masses annotateMz(mzs, cmps, ppm = 20) ## It is also possible to annotate an input data.frame, in which case each ## input will be duplicated depending on the number of hits for each m/z mzs_df <- data.frame(id = letters[1:5], mzmed = mzs) res <- annotateMz(mzs_df, cmps, mzcol = "mzmed", adduct = "[M+H]+") res ## Note that `compounds` could also be `CompDb` database, in which a search ## against the annotations provided in that database would be performed.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.