From add7a3fc0ff0908003c2b9e91479303a2048c7dd Mon Sep 17 00:00:00 2001 From: Candace Savonen Date: Wed, 31 Jan 2024 12:17:18 -0500 Subject: [PATCH] Fix normalization calculation --- R/00-setup_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/00-setup_data.R b/R/00-setup_data.R index 609a564..914f139 100644 --- a/R/00-setup_data.R +++ b/R/00-setup_data.R @@ -56,7 +56,7 @@ setup_data <- function(counts = NULL, pg_metadata = NULL, sample_metadata = NULL new_data$coverage <- new_data$counts_per_sample/nrow(counts) # Transform the data - new_data$transformed_data$count_norm <- -log10((counts + 1)/sum(counts)) + new_data$transformed_data$count_norm <- apply(counts, 2, function(x) -log10((x+1)/sum(x))) new_data$transformed_data$cpm <- apply(counts, 2, function(x) (x/new_data$counts_per_sample)*1e6) new_data$transformed_data$log2_cpm <- log2(new_data$cpm +1)