calculateFragments-methods {MSnbase} | R Documentation

## Calculate ions produced by fragmentation.

### Description

These method calculates a-, b-, c-, x-, y- and z-ions produced by fragmentation.

### Arguments

`sequence` | `character`, peptide sequence.
`object` | Object of class `"Spectrum2"` or `"missing"` .
`tolerance` | `numeric` tolerance between the theoretical and measured MZ values (only available if `object` is not `missing`).
`method` | `method` used for for duplicated matches. Choose `"highest"` or `"closest"` to select the peak with the highest intensity respectively the closest MZ in the tolerance range. If `"all"` is given all possible matches in the tolerance range are reported (only available if `object` is not `missing`).
`type` | `character` vector of target ions; possible values: `c("a", "b", "c", "x", "y", "z")`; default: `type=c("b", "y")`.
`z` | `numeric` desired charge state; default `z=1`.
`modifications` | named `numeric` vector of used modifications. The name must correspond to the one-letter-code of the modified amino acid and the `numeric` value must represent the mass that should be added to the original amino accid mass, default: Carbamidomethyl `modifications=c(C=57.02146)`. Use `Nterm` or `Cterm` as names for modifications that should be added to the amino respectively carboxyl-terminus.
`neutralLoss` | `list`, it has to have two named elments, namely `water` and `ammonia` that contain a `character` vector which type of neutral loss should be calculated. Currently neutral loss on the C terminal `"Cterm"`, at the amino acids `c("D", "E", "S", "T")` for `"water"` (shown with an `_`) and `c("K", "N", "Q", "R")` for `"ammonia"` (shown with an `*`) are supported. There is a helper function `defaultNeutralLoss` that returns the correct list. It has two arguments `disableWaterLoss` and `disableAmmoniaLoss` to remove single neutral loss options. See the example section for use cases.
`verbose` | `logical` if `TRUE` (default) the used modifications are printed.

### Methods

`signature(sequence = "character", object = "missing", ...)`

  Calculates the theoretical fragments for a peptide `sequence`. Returns a `data.frame` with the columns `c("mz", "ion", "type", "pos", "z", "seq")`.

`signature(sequence = "character", object = "Spectrum2", ...)`

  Calculates and matches the theoretical fragments for a peptide `sequence` and a `"Spectrum2"` `object`. The `...` arguments are passed to the internal functions. Currently `tolerance`, `method` and `relative` are supported. You could change the `tolerance` (default `25e-6`) and decide whether this tolerance should be applied relative (default `relative = TRUE`) or absolute (`relative = FALSE`) to match the theoretical fragment MZ with the MZ of the spectrum. In cases of multiple matches use `method` to select the peak with the highest intensity (`method = "highest"`, default) respectively closest MZ (`method = "closes"`). If `method = "all"` is set all possible matches in the current tolerance range are reported. Returns the same `data.frame` as above but the `mz` column represents the matched MZ values of the spectrum. Additionally there is a column `error` that contains the difference between the observed MZ (from the spectrum) to the theoretical fragment MZ.

### Author(s)

Sebastian Gibb <mail@sebastiangibb.de>

### Examples

    ## find path to a mzXML file
    file <- dir(system.file(package = "MSnbase", dir = "extdata"),
                full.name = TRUE, pattern = "mzXML$")

    ## create basic MSnExp
    msexp <- readMSData(file, centroided = FALSE)

    ## centroid them
    msexp <- pickPeaks(msexp)

    ## calculate fragments for ACE with default modification
    calculateFragments("ACE", modifications=c(C=57.02146))

    ## calculate fragments for ACE with an addition N-terminal modification
    calculateFragments("ACE", modifications=c(C=57.02146, Nterm=229.1629))

    ## calculate fragments for ACE without any modifications
    calculateFragments("ACE", modifications=NULL)

    calculateFragments("VESITARHGEVLQLRPK",
                       type=c("a", "b", "c", "x", "y", "z"),
                       z=1:2)

    calculateFragments("VESITARHGEVLQLRPK", msexp[[1]])

    ## neutral loss
    defaultNeutralLoss()

    ## disable water loss on the C terminal
    defaultNeutralLoss(disableWaterLoss="Cterm")

    ## real example
    calculateFragments("PQR")
    calculateFragments("PQR",
                       neutralLoss=defaultNeutralLoss(disableWaterLoss="Cterm"))
    calculateFragments("PQR",
                       neutralLoss=defaultNeutralLoss(disableAmmoniaLoss="Q"))

    ## disable neutral loss completely
    calculateFragments("PQR", neutralLoss=NULL)

[Package MSnbase version 2.6.4 Index]