counts_normalization: Calulate CPM Normalization for Raw Gene Expression Counts

View source: R/counts_normalization.R

counts_normalizationR Documentation

Calulate CPM Normalization for Raw Gene Expression Counts

Description

Calulate CPM Normalization for Raw Gene Expression Counts

Usage

counts_normalization(
  raw_counts,
  MARGIN = c("row", "col"),
  log2 = TRUE,
  plot = TRUE
)

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.

Value

normalized counts matrix

Author(s)

Mélanie Huchon

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 March 8, 2024, 3:05 a.m.