rnaseq_norm: RNAseq normalization methods

View source: R/bulk_rnaseq.R

rnaseq_normR Documentation

RNAseq normalization methods

Description

Perform various RNAseq normalization methods on a count table.

Usage

rnaseq_norm(
  data,
  gene_lengths = NULL,
  method = c("DESeq2_norm_counts", "edgeR_TMM", "TPM"),
  gene_names = rownames(data),
  gene_names_col_id = "ensembl_id",
  sample_names = colnames(data)
)

Arguments

data

[Required] Integer based count table. Rows represent genes (features), columns represent samples (observations).

gene_lengths

[Default: NULL] The nucleotide count (length) of each gene. Required for TPM method.

method

[Default: c("DESeq2_norm_counts", "edgeR_TMM", "TPM")] Method of RNAseq normalization.

gene_names

[Default: rownames(data)] Character vector of gene names.

gene_names_col_id

[Default: "ensembl_id"] String column name that should be used for output table.

sample_names

[Default: colnames(data)] Character vector of sample names.

Value

A tibble::tibble data frame object of normalized counts. The first column will be a character type of gene names. Remaining columns will represent sample names.

Good info about normalization methods: [https://hbctraining.github.io/DGE_workshop/lessons/02_DGE_count_normalization.html](https://hbctraining.github.io/DGE_workshop/lessons/02_DGE_count_normalization.html) [https://www.biostars.org/p/317701](https://www.biostars.org/p/317701) [https://www.biostars.org/p/317417](https://www.biostars.org/p/317417) [https://www.biostars.org/p/210447](https://www.biostars.org/p/210447)

Examples

set.seed(1)
nrow = 10000
ncol = 6
min = 0
max = 1000
gene_lengths = sample(400:10000, nrow, TRUE)
my_counts <- matrix(sample(min:max, nrow*ncol, TRUE), 
    nrow = nrow, ncol = ncol, 
    dimnames = list(paste0("gene", 1:nrow), paste0("sample", 1:ncol)))

my_counts_norm <- rnaseq_norm(my_counts, method = "DESeq2_norm_counts")
my_counts_norm <- rnaseq_norm(my_counts, method = "edgeR_TMM")
my_counts_norm <- rnaseq_norm(my_counts, gene_lengths = gene_lengths, method = "TPM")



toddknutson/toddr documentation built on Aug. 28, 2023, 2:45 a.m.