This function is used to calculate the noise threshold for a given expression matrix. It uses as input an expression profile, or just an expression matrix for a simple calculation based on density. A variety of methods are available to obtain a noise threshold using an input similarity threshold.

calculate_noise_threshold(
  expression,
  similarity.threshold = 0.25,
  method.chosen = "Boxplot-IQR",
  binsize = 0.1,
  minimum.observations.per.bin = NULL,
  ...
)

Arguments

expression

either an expression summary (as calculated by calculate_expression_similarity_counts or calculate_expression_similarity_transcript), which should be a list with 3 slots: expression.matrix, expression.levels, expression.levels.similarity; alternatively, just an expression matrix; only density based methods are available for the latter case

similarity.threshold

similarity (correlation or inverse distance) threshold to be used to find corresponding noise threshold; the default, 0.25 is usually suitable for the Pearson correlation (the default similarity measure)

method.chosen

method to use to obtain a vector of noise thresholds, must be one of get_methods_calculate_noise_threshold; defaults to Boxplot-IQR

binsize

size of each bin in the boxplot methods; defaults to 0.1 (on a log-scale)

minimum.observations.per.bin

minumum number of observations allowed in each bin of the boxplot; if a bin has fewer observations, it is merged with the one to its left; default is calculated as: ceiling(number of observations / number of bins / 10)

...

arguments passed on to other methods

Value

The output is a vector of noise thresholds, the same length as the number of columns in the expression matrix, or a single value in the case of density based methods.

See also

Examples

expression.summary <- calculate_expression_similarity_counts( expression.matrix = matrix(1:100, ncol=5), method = "correlation_pearson", n.elements.per.window = 3)
#> The input matrix has 20 rows and 5 cols
#> number of genes: 20
#> number of samples: 5
#> the number of elements per window is 3
#> the step size is 1
#> the selected similarity metric is correlation_pearson
#> Working with sample 1
#> Working with sample 2
#> Working with sample 3
#> Working with sample 4
#> Working with sample 5
calculate_noise_threshold(expression.summary)
#> Calculating noise thresholds for 5 samples...
#> similarity.threshold = 0.25
#> method.chosen = Boxplot-IQR
#> [1] 1 1 1 1 1