Learn R Programming

powerHaDeX (version 1.0)

get_noisy_deuteration_curves: Replicated deuterium uptake curves

Description

This function creates a list of lists of noisy deuteration curves based on theoretical spectra in order to imitate the data from the HDX experiments.

Usage

get_noisy_deuteration_curves(
  theoretical_spectra,
  compare_pairs = TRUE,
  reference = NA,
  n_replicates = 4,
  n_experiments = 100,
  mass_deviations = 50,
  intensity_deviations = NULL,
  per_run_deviations = NULL,
  relative = TRUE
)

Arguments

theoretical_spectra

a data table or a list of data tables of theoretical spectra created by the function simulate_theoretical_spectra.

compare_pairs

if FALSE, all groups (defined by the protection factor) will be considered jointly. If TRUE (default), each protection factor will be considered together with the protection factor given by the `reference` parameter.

reference

protection factor that will be used for comparison to other protection factors in. The function accepts either NA (for comparing all protection factors), a number (for comparing with reference value of protection factor) or "all" (for pairwise comparisons of all the possible combinations). Default NA.

n_replicates

number of technical replicates to create

n_experiments

number of replicates of an experiment for power calculation.

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.

per_run_deviations

optional, standard deviations of random noise that will be added to deuteration curves. 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.

relative

logical, if TRUE (default), each deuteration curve will start at 0 (relative mass will be returned). Default TRUE.

Value

a list (for paired states when compare_pairs is TRUE) of lists (repetitions of experiment for power calculations) of data tables of the variables:

- Sequence - provided amino acid sequence

- Rep - technical replication

- State - provided protection factor (the theoretical - in practice unknown - state of the protein)

- Exposure - exposure time

- Mass - mass or deuterium uptake when relative is TRUE.

- Charge - charge

- Experimental_state - the biological state (from the viewpoint of the experimenter) provided in the case when compare_pairs is TRUE.

Examples

Run this code
# NOT RUN {
theo_spectra_pf_100 <- simulate_theoretical_spectra(sequence = "LVRKDLQN",
                                                    charge = c(3, 5),
                                                    protection_factor = 100,
                                                    times = c(0.167, 5),
                                                    pH = 7.5,
                                                    temperature = 15,
                                                    n_molecules = 500,
                                                    time_step_const = 1,
                                                    use_markov = TRUE)

theo_spectra_pf_200 <- simulate_theoretical_spectra(sequence = "LVRKDLQN",
                                                    charge = c(3, 5),
                                                    protection_factor = 200,
                                                    times = c(0.167, 5),
                                                    pH = 7.5,
                                                    temperature = 15,
                                                    n_molecules = 500,
                                                    time_step_const = 1,
                                                    use_markov = TRUE)

theo_spectra_two_states <- rbind(theo_spectra_pf_100, theo_spectra_pf_200)

deut_curves_p_states <- get_noisy_deuteration_curves(theo_spectra_two_states,
                                                     n_replicates = 4,
                                                     n_experiments = 2,
                                                     compare_pairs = TRUE,
                                                     reference = "all")

# }

Run the code above in your browser using DataLab