mapSpectrum: Map Spectrum to _m/z_ Vector

Description Usage Arguments Value Warning Author(s) References See Also Examples

View source: R/mapSpectrum.R

Description

Fills in the columns of the empty data frame created using createSpecDF. Mass to charge values from pairwise spectral data are compared to the full_mz vector. All peaks within the thresh of one another are binned, and only the maximum intensity of that bin is filled into the mapped spectrum.

Usage

1
2
3
4
5
6
7
8
9
mapSpectrum(
  dat,
  massCol,
  intenseCol,
  dig = 4,
  thresh = 1e-04,
  spec_df,
  colName
)

Arguments

dat

A pairwise data frame containing your spectral data. Should contain two columns: one for m/z and one for intensity.

massCol

A character string; the name of the m/z column in dat.

intenseCol

A character string; the name of the intensity column in dat.

dig

Number of decimal places to round the m/z data to; must match the same value used in createSpecDF in order for the columns to fill. Default = 4.

thresh

Single numeric value; all m/z values within thresh of each other are binned under that with the maximum intensity. Default = 5e-5.

spec_df

An empty data frame created using createSpecDF.

colName

A character string; the name of the column that should be filled with the spectral data.

Value

Returns a vector that is used to fill in the colName column of the mapped spectral data frame.

Warning

It is important that the values for thresh and dig are equal to that of res and dig used in createSpecDF(). Otherwise the data will fail to map.

Author(s)

Kristen Yeh <kristenyeh@trentu.ca> Wesley Burr <wesleyburr@trentu.ca>

References

https://github.com/wesleyburr/subMaldi

See Also

createSpecDF

Examples

1
2
3
4
5
6
7
8
9
## Load sample dataset "Blank1.rda"
data("lank1")

## Create empty spectral data frame to map to
spec_df <- createSpecDF(min_mz = 53.76, max_mz = 1100, res = 0.0001, dig = 4)

## Map binary spectral data to empty spectral data frame
spec_df <- mapSpectrum(dat = Blank1, massCol = "mass", intenseCol = "Intensity", 
            spec_df = spec_df, colName = "Sample", thresh = 1e-04, dig = 4)

wesleyburr/subMaldi documentation built on Oct. 1, 2021, 7:07 a.m.