addRI: Add retention index information to an msp object

Description Usage Arguments Value Note Author(s) Examples

View source: R/addRI.R

Description

Given an msp object and the retention times and indices of a series of reference compounds, the function adds an RI field to every entry of the msp object. This will only be done if there is not already an RI field: existing information will not be overwritten.

Usage

1
addRI(mspobj, RIstandards, isMSP = TRUE)

Arguments

mspobj

An msp object.

RIstandards

A two-column matrix containing for the standards defining the RI scale both retention times and retention indices.

isMSP

Logical: if TRUE, then the spectra are stored in slot pspectrum; otherwise the spectra are simply the list elements of DB - matrices with three columns.

Value

An msp object, now also containing an RI slot.

Note

If the retention time of a compound is outside the range of the RI standards, NA will be used as RI value.

Author(s)

Ron Wehrens

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
if (require(metaMSdata)) {
  manual.fname <- list.files(system.file("extdata", package = "metaMSdata"),
                             pattern = "msp", full.names = TRUE)
  manual <- read.msp(manual.fname)
  RIstandards <- cbind("rt" = c(1.54, 1.68, 1.99, 2.7, 4.36, 6.81, 9.43,
                                11.88, 14.17, 16.34, 18.39, 20.33, 22.18,
                                23.93, 25.5, 27.18, 28.72, 30.26, 31.75,
                                33.19, 34.58, 35.95),
                       "RI" = (6:27)*100)

  manualRI <- addRI(manual, RIstandards)
}

metaMS documentation built on Nov. 8, 2020, 8:21 p.m.