convert2MSP {MetCirc} | R Documentation

## Convert deconvoluted matrix into `MSP`-object

### Description

Convert deconvoluted matrix into `MSP`-object

### Usage

    convert2MSP(mm, splitPattern = "_", splitIndMZ = 1, splitIndRT = NULL,
     rt = FALSE, names = FALSE, information = FALSE, classes = FALSE, adduct = FALSE)

### Arguments

`mm` | `matrix`, `mm` has to have three columns with colnames "mz", "intensity" and "id" (order is not important). The column comprises information about the precursor ion which will be assessed by `splitPattern` and `splitInd`. Optionally, `mm` can have colnames "rt", "names", "information", "classes" and "adduct".
`splitPattern` | `character`, `splitPattern` is the pattern which separates elements and precursor m/z
`splitIndMZ` | `numeric`, the position of the precursor m/z in the character string concerning separation by `splitPattern`
`splitIndRT` | `numeric` or `NULL`, the position of the retention time in the `character` string concerning separation by `splitPattern`, if `NULL` the retention time will be the mean of all retention time values of the MS/MS feature fragments
`rt` | `logical`, should retention times be retrieved? If set to `TRUE`, `convert2MSP` will access the column "rt" in `mm` which contains the retention time values for each fragment when `splitIndRT` is `NULL`, if `rt` is set to `TRUE` and `splitIndRT` is `numeric`, `convert2MSP` will access the column "id" to get the retention time at position `splitIndRT` when splitting with `splitPattern`
`names` | `logical`, should names be retrieved? If set to `TRUE`, `convert2MSP` will access the column "names" in `mm` which contains the names of the metabolites
`information` | `logical`, should further information of metabolites be retrieved? If set to `TRUE`, `convert2MSP` will access the column "information" in `mm` which contains information about the metabolites
`classes` | `logical`, should classes of metabolites be retrieved? If set to `TRUE`, `convert2MSP` will access the column "classes" in `mm` which contains the names of the metabolites
`adduct` | `logical`, should adduct ion names of metabolites be retrieved? If set to `TRUE`, `convert2MSP` will access the column "adduct" in `mm` which contains the adduct ion names of the metabolites

### Details

The function `convert2MSP` creates a data entry for each precursor ion. Each entry in the return object has the following information: Num Peaks and a list of fragments together with their intensities; it will further contain information on m/z values of the precursor ion, the retention time, metabolite names, classes, adduct ion name and further information. `convert2MSP` will access the columns "rt", "names", "information", "classes" and "adduct", respectively, if arguments are set to `TRUE`. The column "id" has to contain a unique identifier for each MS/MS feature. It is obligatory that each element in the column "id" contains the precursor m/z value, but may contain furhter elements (e.g. peak correlation value or retention time of the precursor ion). Information about the m/z value will be assessed by `splitPattern` and `splitInd`. E.g. items in the column "id" can be in the form of "1_163.23", which has to be accessed by setting `splitPattern = "_"` and `splitInd = 2` to access the m/z value of the precursor ion (here: 162.23). If `rt` is set to `TRUE` and `splitIndRT` is `NULL`, `convert2MSP` will access the column "rt" to get the retention time values corresponding to each fragment and calculate the mean value, if `rt` is set to `TRUE` and `splitIndRT` `numeric`, `convert2MSP` will retrieve the retention time value from column "id".

### Value

`convert2MSP` returns an object of class `MSP`

### Author(s)

Thomas Naake, thomasnaake@googlemail.com

### Examples

    data("sd02_deconvoluted", package = "MetCirc")
    convert2MSP(mm = sd02_deconvoluted, splitPattern = " _ ", splitIndMZ = 2,
     splitIndRT = NULL, rt = FALSE, names = FALSE, information = FALSE,
     classes = FALSE, adduct = FALSE)

[Package MetCirc version 1.14.0 Index]