Skip to contents

This function denoises the expression matrix using the noisyR package and then normalises it. It is recommended to use this function before using generateShinyApp.

Usage

preprocessExpressionMatrix(
  expression.matrix,
  denoise = TRUE,
  output.plot = FALSE,
  normalisation.method = c("quantile", "rpm", "tmm", "deseq2", "median"),
  n_million = 1,
  ...
)

Arguments

expression.matrix

the expression matrix; rows correspond to genes and columns correspond to samples

denoise

whether to use noisyR to denoise the expression matrix; proceeding without denoising data is not recommended

output.plot

whether to create an expression-similarity plot for the noise analysis (printed to the console); default is FALSE

normalisation.method

the normalisation method to be used; default is quantile; any unrecognised input will result in no normalisation being applied, but proceeding with un-normalised data is not recommended; currently supported normalisation methods are:

quantile

Quantile normalisation using the normalize.quantiles function from the preprocessCore package

rpm

RPM (reads per million) normalisation, where each sample is scaled by 1 (or more using the n_million parameter) million and divided by the total number of reads in that sample

tmm

Trimmed Mean of M values normalisation using the calcNormFactors function from the edgeR package

deseq2

Size factor normalisation using the estimateSizeFactorsForMatrix function from the DESeq2 package

median

Normalisation using the median, where each sample is scaled by the median expression in the sample divided by the total number of reads in that sample

n_million

scaling factor for RPM normalisation; default is 1 million

...

optional arguments passed on to noisyr::noisyr_counts()

Value

The denoised, normalised expression matrix; some rows (genes) may have been removed by noisyR.

Examples

expression.matrix <- as.matrix(read.csv(
  system.file("extdata", "expression_matrix.csv", package = "bulkAnalyseR"), 
  row.names = 1
))[1:10, 1:4]
expression.matrix.preproc <- preprocessExpressionMatrix(expression.matrix)
#> >>> noisyR counts approach pipeline <<<
#> The input matrix has 10 rows and 4 cols
#>     number of genes: 10
#>     number of samples: 4
#> Calculating the number of elements per window
#>     the number of elements per window is 1
#>     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
#> Similarity calculation produced too many NAs, returning zero...
#> Denoising expression matrix...
#>     removing noisy genes
#>     adjusting matrix
#> >>> Done! <<<
#> Performing quantile normalisation...
#> Done!