This function takes the intensity values in the blank column of the mapped spectral data frame and subtracts them from the intensity values in the sample column. If the intensity value in the blank spectrum is greater than that in the sample spectrum, the intensity of the sample peak is given an intensity of 0.

subSpectra(dat, Blank_Var, Sample, Sub_Sample, showNeg = FALSE)

Arguments

dat

The spectral data frame, containing full_mz in the first column and intensity data in the subsequent columns.

Blank_Var

A character string; the name of the blank column that will be subtracted from the sample column.

Sample

A character string; the name of the sample column that the blank data will be subtracted from.

Sub_Sample

A character string; the name of the column to be filled with the subtracted spectrum.

showNeg

Logical; if showNeg = TRUE, then negative values produced by the subtraction will be kept in the dataset. If showNeg = FALSE, then negative values created by the subtraction are set to 0 in the output dataset.

Value

Returns a vector of intensity values that are filled into the Sub_Sample column of the mapped data frame at the corresponding rows of full_mz.

References

https://github.com/wesleyburr/subMaldi

See also

Author

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

Examples

## Load sample datasets "Master.rda" data("Master") ## Make subtraction column for new data Master <- transform(Master, "Subtracted" = 0) ## Subtract Blank1 from Before1 Master <- subSpectra(dat = Master, Blank_Var = "Blank1", Sample = "Before1", Sub_Sample = "Subtracted")