choose_threshold: Test gene expression variations for multiple thresholds in a...

View source: R/choose_param.R

choose_thresholdR Documentation

Test gene expression variations for multiple thresholds in a serie of samples

Description

This function makes for each patient the Penda test with different values for the treshold. It computes FDR, TPR and FPR for each patient and each threshold value.

Usage

choose_threshold(
  controls,
  L_H_list,
  iterations,
  simulation,
  threshold_values,
  quant_test = 0,
  factor_test = 1
)

Arguments

controls

A matrix with genes expressions in controls for all the patients.

L_H_list

The list of lower and higher expressed genes matrices in the control.

iterations

The maximal number of iterations for the test. If the dysregulation list no longer changes, iterations are stop before.

simulation

The simulation with the list of initial data $initial_data and modified data in $simulated_data.

threshold_values

A vector with different values to test for the threshold.

quant_test

The quantile for the test. When L and H lists are void, we use the naive method.

factor_test

The factor for the test. The limit L will be quant(gene)/factor, and the limit H quant(gene)*factor.

Value

This function returns a matrix with 5 columns : the patient number, the value of the threshold tested, the FDR, the TPR and the FPR of the test.

Examples

# First, load and define the data, make the simulation
controls = penda::penda_data_ctrl[1:10, 1:13]
median_gene = apply(controls, 1, median, na.rm = TRUE)
median_gene = sort(median_gene)
controls = controls[names(median_gene), ]
simu_data = controls[,11:13]
controls = controls[,-(11:13)]
simulation = penda::simplified_simulation(simu_data, proportion = 0.3, threshold = 60)
# Second, lower and higher lists are computed
L_H_list = penda::compute_lower_and_higher_lists(controls, threshold = 0.99, s_max = 50)
# Third, choose the vector of threshold to test
threshold_values = c(0.1, 0.2, 0.3, 0.4, 0.5)
# Fourth, make the test on simulation for different thresholds
which_threshold = penda::choose_threshold(controls,
                                          L_H_list,
                                          iterations = 20,
                                          simulation,
                                          threshold_values,
                                          quant_test = 0,
                                          factor_test = 1)

CDecamps/penda documentation built on March 29, 2024, 3:26 a.m.