estnoise: Local Noise Estimation

estnoiseR Documentation

Local Noise Estimation

Description

Estimate the noise across a signal.

Usage

# Quantile-based noise estimation
estnoise_quant(x, n = 25L, prob = 0.95, niter = 3L)

# Derivative-based noise estimation
estnoise_diff(x, nbins = 1L, dynamic = FALSE)

# Dynamic noise level filtering
estnoise_filt(x, nbins = 1L, msnr = 2,
    threshold = 0.5, peaks = FALSE)

# SD-based noise estimation
estnoise_sd(x, n = 25L, wavelet = ricker)

# MAD-based noise estimation
estnoise_mad(x, n = 25L, wavelet = ricker)

Arguments

x

A numeric vector.

n

The number of sample points in the rolling estimation of quantile, standard deviation, or median absolute deviation.

prob

The quantile used to estimate the noise.

niter

The number of iterations of nonlinear diffusion smoothing to be applied to the signal.

nbins

The number of bins to divide the signal into before estimating the noise. The noise is estimated locally in each bin.

dynamic

Should the bins be equally spaced (FALSE) or dynamically spaced (TRUE) based on the local signal?

msnr

The minimum signal-to-noise ratio for distinguishing signal peaks from noise peaks.

threshold

The required signal-to-noise difference for the first non-noise peak.

peaks

Does x represent a signal profile (FALSE) or peaks (TRUE)?

wavelet

The wavelet to be convolved with the signal to produce the noise estimate. This should be a function that takes as its first argument the width of the wavelet (in number of points). If this is NULL, then no convolution is performed, and the raw signal is used.

Details

estnoise_quant() estimates the local noise by first smoothing the signal with a nonlinear diffusion filter, and then subtracting the raw signal from the smoothed signal to isolate the noise component. A rolling quantile of this noise component is used to estimate the local noise in the signal.

estnoise_diff() estimates the local noise from the mean absolute deviation of the signal from the mean of its derivative in each bin. For noisy signals, the derivative is dominated by the noise, making it a useful estimator of the noise.

estnoise_filt() uses the dynamic noise level filtering algorithm of Xu and Freitas (2010) based on the local signal in an approach similar to Gallia et al. (2013). The peaks in the signal are sorted, and the smallest peak is assumed to be noise and is used to estimate the noise level. Each peak is then compared to the previous peak. A peak is labeled a signal peak only if it exceeds a minimum signal-to-noise ratio. Otherwise, the peak is labeled noise, and the noise level is re-estimated. This process continues until a signal peak is found, and the noise level is estimated from the noise peaks.

estnoise_sd() and estnoise_mad() estimate the local noise from the standard deviation (SD) or median absolute deviation (MAD), respectively, after (optionally) convolving the signal with a wavelet.

Value

A numeric vector the same length as x with the estimated local noise level.

Author(s)

Kylie A. Bemis

References

H. Xu and M. A. Freitas. “A Dynamic Noise Level Algorithm for Spectral Screening of Peptide MS/MS Spectra.” BMC Bioinformatics, vol. 11, no. 436, Aug. 2010.

J. Gallia, K. Lavrich, A. Tan-Wilson, and P. H. Madden. “Filtering of MS/MS data for peptide identification.” BMC Genomics, vol. 14, suppl. 7, Nov. 2013.

Examples

# simple signal
set.seed(1)
n <- 500
x <- rnorm(n)
x <- x + 90 * dnorm(seq_along(x), mean=n/4)
x <- x + 80 * dnorm(seq_along(x), mean=n/2)
x <- x + 70 * dnorm(seq_along(x), mean=3*n/4)

ns <- estnoise_quant(x)
plot(x, type="l")
lines(ns, col="blue")

# simulated spectrum
set.seed(1)
x <- simspec(size=5000)

ns <- estnoise_quant(x, n=101)
plot(x, type="l")
lines(ns, col="blue")

kuwisdelu/matter documentation built on May 1, 2024, 5:17 a.m.