superimposeNoise: Superimpose noise over MSI data

View source: R/superimposeNoise.R

superimposeNoiseR Documentation

Superimpose noise over MSI data

Description

This contaminates MSI data with additive noise at certain m/z locations. This is used for testing purposes.

Usage

superimposeNoise(
  x = NULL,
  spData = NULL,
  method,
  mz,
  fwhm,
  noiseFactor = 1,
  searchFactor = 3,
  sigmainterference = 2,
  mzTrim = 0,
  numSpikedPeaks = 10,
  returnMat = FALSE,
  verbose = FALSE
)

Arguments

x:

dataset, a list of MALDIquant::MassPeaks objects.

spData:

a corresponding sparse MSI matrix of type 'sparseIntensityMatrix'.

method:

character string, the method used to add noise c("Poisson", "Gaussian","intensityArtifacts","interference").

mz:

numeric, m/z value where the noise will be added.

fwhm:

numeric, the fwhm at the specified m/z.

noiseFactor:

integer, this will be multiplied by the standard deviation of intensities at mz which will be plugged into rnorm to generate the intensities of the Gaussian noise.

searchFactor:

integer, search tolerance, how many standard deviations (sigma) around mz to include in the search of mz peak presence.

sigmainterference:

integer, how many standard deviations (sigma) away from mz to place the interfering peak.

mzTrim:

numeric, this will trim the m/z axis to only include [mz-mzTrim,mz+mzTrim]. Skipped if set to 0 (default) or length(mz) > 1.

numSpikedPeaks:

integer, number of spiked peaks for intensityArtifacts method.

returnMat:

if TRUE returns a sparse MSI matrix of type 'sparseIntensityMatrix'. Otherwise, returns a list of MALDIquant::MassPeaks objects (default).

verbose:

whether to print progress.

Value

A list of 'MassPeaks' objects contaminated with noise, if returnMat = FALSE) or a sparse matrix of type Matrix::dgCMatrix otherwise.


CeMOS-Mannheim/moleculaR documentation built on April 14, 2025, 8:27 a.m.