R: Compute a matching between a peptide sequence and a MS2...

psm {protViz} | R Documentation

## Compute a matching between a peptide sequence and a MS2 spectrum

### Description

The function computes a matching between a given peptide sequence and a given tandem mass spectrum (MS2). `psm` determines for each fragment ion mass peak the smallest mass error to a peak in the theretical spectrum from the peptide sequence. If the mass error is below the given `fragmentIonError` the match is considered a hit. `psm` returns a list of computed fragment ions and a vector of the mass error (Da and ppm). `psm` uses a generic `ANSI-C` function to determines the nearest mass peak of array of double values. If the `plot` is set to `TRUE` an error plot is drawn.

The function `psm` reqires the arguments `sequence` and `spec`. All other arguments are optional.

### Usage

        psm(sequence,
            spec,
            FUN=defaultIon,
            plot=TRUE,
            fi=fragmentIon(sequence, FUN=FUN)[[1]],
            fragmentIonError)

### Arguments

`sequence` | peptide sequence encoded as character sequence using the 20 amino acid letters.
`spec` | MS2 which is a R list having a sorted mZ vector and an intensity vector of the same size.
`FUN` | this function is passed to the `fragmentIon` function. the function to be applied to compute further ions. If no function is assigned `fragmentIon` will use `defaultIon`.
`plot` | boolean if the error plot function is to be called.
`fi` | fragment ion table, if not specified `fragmentIon(sequence, FUN=FUN)[[1]]` is called.
`fragmentIonError` | fragment ion error cut-off. default is 0.6 Da.

### Details

This function can be very useful to make assignements to spectra. Moreover it is used for validation or clairifying ambiguities between different sequences assigned to the same spectrum. Additinally it can be used to generate spectral libraries.

### Value

returns a psm match.

### Author(s)

Christian Panse 2007, 2008, 2009, 2010, 2012, 2017

### See Also

`peakplot` and `fragmentIon`

### Examples

    spec <- list(scans=1138,
        title="178: (rt=22.3807) [20080816_23_fetuin_160.RAW]",
        rtinseconds=1342.8402,
        charge=2,
        mZ=c(195.139940, 221.211970, 239.251780, 290.221750,
        316.300770, 333.300050, 352.258420, 448.384360, 466.348830,
        496.207570, 509.565910, 538.458310, 547.253380, 556.173940,
        560.358050, 569.122080, 594.435500, 689.536940, 707.624790,
        803.509240, 804.528220, 822.528020, 891.631250, 909.544400,
        916.631600, 973.702160, 990.594520, 999.430580, 1008.583600,
        1017.692500, 1027.605900),
        intensity=c(931.8, 322.5, 5045, 733.9, 588.8, 9186, 604.6,
        1593, 531.8, 520.4, 976.4, 410.5, 2756, 2279, 5819, 2.679e+05,
        1267, 1542, 979.2, 9577, 3283, 9441, 1520, 1310, 1.8e+04,
        587.5, 2685, 671.7, 3734, 8266, 3309)
        )

    m <- psm('HTLNQIDSVK', spec,plot=TRUE)
    hist(m$mZ.Da.error)
    hist(m$mZ.ppm.error)

[Package protViz version 0.6.8 Index]