Learn R Programming

powerHaDeX (version 1.0)

add_noise_to_one_spectrum: Add noise to a single spectrum

Description

This function adds noise to intensities and/or masses in a spectrum.

Usage

add_noise_to_one_spectrum(
  spectrum,
  undeuterated_mass,
  mass_deviations = 50,
  intensity_deviations = NULL
)

Arguments

spectrum

a single spectrum from the list obtained using make_experimental_design.

undeuterated_mass

the value of mass of an undeuterated peptide computed by get_undeuterated_mass.

mass_deviations

mass deviation in parts per million. Either a single number (then the error at each time point will be the same) or a vector of the same length as number of unique time points in the experiment. The error will be sampled from normal distribution with standard deviation equal to $$mass_deviations * undeuterated_mass/1e6$$ Default to 50.

intensity_deviations

optional, standard deviations of random noise that will be added to intensities. Either a single number (then the error at each time point will be the same) or a vector of the same length as number of unique time points in the experiment. The error will be sampled from normal distribution with these standard deviations.Default NULL.

Value

data.table containing a single noisy spectrum

Details

The deviations are calculated as follows $$sd = mass_deviations * undeuterated_mass/10^6$$. To add noise this function uses add_noise_to_one_timepoint and add_noise_to_intensities.