optimize_information_level: Attempt to optimize information level

Description Usage Arguments Value Examples

View source: R/compute_ici.R

Description

The information level information to the ICI computation algorithm is curcial for the selection of markers. This function attempts to find an ideal information level by computing the "variability" of ICI scores between sequential information scores, controlling this level at a user- defined rate (var_tol), and then finding the information level that maximizes the ICI signal under this variability. This function is experimental.

Usage

1
2
3
optimize_information_level(expression_data, spec_table,
  information_range = seq(0, 100, 0.5), min_spec_score = 0.15,
  n_samples = 100, var_tol = 0.2)

Arguments

expression_data

data frame with at least one column, "Locus", and additional columns containing expression values for each cell.

spec_table

a data.frame containing at least 4 columns:

  • Locus

  • Cell_Type

  • spec (the Specificity score calculated using compute_spec_table)

  • mean_expr (the mean expression level for that locus/cell type combination used to generated spec scores)

information_range

numeric vector, range of information scores to loop over

min_spec_score

minimum useful information score (default, 0.15)

n_samples

number of sub-samples to take (useful for limiting computational resources required; default 100)

var_tol

numeric (between 0 and 1), the percentile of variation. After computing spec scores for the sampled cells for all cell types at all information levels supplied in information_range, this function then computes the variation (euclidean distance of normalized spec scores over all cell types for a given cell between information levels that differ by 1). All *unique* variation values are then determined among all the cells, and sorted. The value in var_tol is then multiplied by the length of all unique values to determine the variation threshold. Tthe information levels that have maximum variation scores below this threshold are then used to maximize the ICI signal. The maximum information level with the maximum ICI score and variation below this cutoff is returned.

Value

numeric, information level that should maximize ICI signal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Try to find the optimum information level
spec_table <- compute_spec_table(test_spec, l = 5, u = 3)
information_level <- optimize_information_level(expression_data = test_ici,
                                                spec_table = spec_table,
                                                information_range = seq(0.5,5,0.5),
                                                min_spec_score = 0,
                                                n_samples = 15,
                                                var_tol = 0.2)

# Gather information for all information levels
info_data <- gather_information_level_data(test_ici,
                                           spec_table,
                                           information_range = seq(0.5,5,0.5),
                                           min_spec_score = 0,
                                           n_samples = 15)

b-coli/ICITools documentation built on Dec. 27, 2021, 7:40 a.m.