Normalize count or other data.

Normalization(
  counts,
  normalization = c("cosine", "lognorm", "none"),
  normalize_factor = 10000,
  zero_percent = 0.7,
  verbose = FALSE
)

Arguments

counts

Data to normalize. An N x M matrix with N rows of features and M columns of data points.

normalization

Normalization method used. Default is cosine.

  • cosine, cosine normalization: feature counts for each data point are divided by the L2 norm of them.

  • lognorm, log normalization: feature counts for each data point are divided by the total sum of them. Then the data is multiplied by the scale.factor before taking a log-transformed by log(1+x).

  • none, additional normalization is not performed.

normalize_factor

Normalization factor used with lognorm method. Default is 10000.

zero_percent

Zero-entry percentage threshold. If the number of zeros in the returned matrices is above this number, a sparse matrix will be returned. Default is 0.7 aka 70%.

verbose

Whether to display a process bar. Default is FALSE.

Value

Returns the normalized data.

Examples

{
data.use <- matrix(runif(100), 10)
normalized.data <- Normalization(data.use)
}