View source: R/general_bioinfo.R
normalise_counts | R Documentation |
Reads Per Kilo Base Per Million (RPKM) and Tags Per Million (TPM) are two most waidely used normalisation methods in RNA-seq experiments. This function convert raw read counts either into RPKM or TPM values.
normalise_counts(x, .vars = NULL, method = "TPM")
x |
A dataframe of raw counts along with mandatory columns which are |
.vars |
A character vector containing columns from |
method |
A character string, default TPM. Choices are one of TPM, RPKM. |
implemntaion of RPKM and TPM can be seen in functions get_tpm()
and get_rpkm()
respectively.
A dataframe with all mandatory columns along with columns mentioned in .vars
. Remaining columns from x
will be dropped.
get_tpm()
get_rpkm()
set.seed(123)
tt <- tibble::tibble(gene_id = c(paste("Gene_",1:5,sep = "")),
chr = "Chr1",
start = sample(1:100, 5),
end = sample(100:200,5),
strand = sample(c("+" ,"-"), 5, replace = TRUE),
length = (end - start )+ 1 )
tt %<>% dplyr::mutate(sample_1 = sample(c(1:100),5)*10 ,
sample_2 = sample(c(1:100),5)*10 ,
sample_3 = sample(c(1:100),5)*100,
sample_4 = sample(c(1:100),5)*100 )
normalise_counts(x = tt ,method = "RPKM")
normalise_counts(x = tt, .vars = c("sample_1","sample_2") ,method = "TPM")
normalise_counts(x = tt, .vars = c("sample_1","sample_2") ,method = "RPKM")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.