regulation_test: Test gene expression variation for a given gene

View source: R/testing.R

regulation_testR Documentation

Test gene expression variation for a given gene

Description

This function makes the test of expression dysregulation of one gene for a patient compared to control. It's an hybrid method, which use the rank method and the quantile method in addition when there is no significant lower or higher list.

Usage

regulation_test(gene, L_H_list, sample, threshold, n_min = 10)

Arguments

gene

The name of the gene to analyze.

L_H_list

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

sample

The vector of genes expressions for one patient.

threshold

If Ll/Lh and Hh/Hl are under this threshold, the expression not change.

n_min

The number minimal of genes in the L H list to switch to the quantile method.

Value

This function returns 0 if the gene expression has not changed, 1 if the gene is up-regulated and -1 if the gene is down-regulated.

Examples

# First, load and define the data
dataset = penda::make_dataset(
  penda::penda_data_ctrl[1:10, 1:10], 
  penda::penda_data_case[1:10, 1:2]
)
controls = dataset$data_ctrl
sample = dataset$data_case[,1]
gene = names(sample)[1]
# Second, lower and higher list are computed
L_H_list = penda::compute_lower_and_higher_lists(controls, threshold = 0.99, s_max = 50)
# Third, test is the expression is deregulated for a given gene.
#   When this function is called, quantiles are already computed
quant_test = 0
factor_test = 1
quantile_genes = apply(controls, 1, quantile, c(quant_test,(1-quant_test)), na.rm = TRUE)
quantile_genes[1,] = quantile_genes[1,] / factor_test
quantile_genes[2,] = quantile_genes[2,] * factor_test

expression = penda::regulation_test(gene,
                                    L_H_list,
                                    sample,
                                    threshold = 0.03)

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