counts_normalization: Calculate CPM Normalization for Raw Gene Expression Counts

View source: R/counts_normalization.R

counts_normalizationR Documentation

Calculate CPM Normalization for Raw Gene Expression Counts

Description

Calculate CPM Normalization for Raw Gene Expression Counts

Usage

counts_normalization(
  raw_counts,
  MARGIN = c("row", "col"),
  log2 = TRUE,
  plot = TRUE,
  norm_method = c("TMM", "TMMwsp", "none", "RLE", "upperquartile")
)

Arguments

raw_counts

numeric matrix or data frame of raw gene expression counts.

MARGIN

"row" or "col" to identify the place of sample (library size). If the raw_counts matrix has a nxG size, put "row" if it's opposite put "col".

log2

a logical indicating whether the normalized counts will be transformed in log2. Default is TRUE.

plot

a logical indicating whether a graph will be displayed for the normalization check. Default is TRUE.

norm_method

a character string indicating which method to use to normalize the data. See normLibSizes for details. Default method is TMM.

Value

normalized counts matrix

Author(s)

Mélanie Huchon & Quentin Laval

Examples


#Generate data
sim_Genes <- c(runif(90,0,1), rbinom(60,2,0.4), runif(30,1250,2000), runif(20,100,300))
raw_data <- matrix(sim_Genes, nrow = 10)
colnames(raw_data) <- paste0("G", sample(1:ncol(raw_data), ncol(raw_data), replace = FALSE))
rownames(raw_data) <- paste0("Sample_", 1:nrow(raw_data))

#Use the method
norm_data <- counts_normalization(raw_counts = data.frame(raw_data), MARGIN = "row")

sistm/sistmr documentation built on June 11, 2025, 1:33 a.m.