From 1111479bf2423f6a7a1056af1f586618d72875e7 Mon Sep 17 00:00:00 2001 From: Thomas Manke Date: Thu, 18 Apr 2024 17:41:33 +0200 Subject: [PATCH] fix MA-calculation --- qmd/09_DataVisualization.qmd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qmd/09_DataVisualization.qmd b/qmd/09_DataVisualization.qmd index 2730e31..802b2be 100644 --- a/qmd/09_DataVisualization.qmd +++ b/qmd/09_DataVisualization.qmd @@ -77,11 +77,13 @@ Let's plot a MA-like plot for `GSM2545336` vs `GSM2545380`, first, we generate t ```{r} #| echo: true +# log2fc: M = log2(x/y) = log2(x) - log2(y) +# norm_mean: A = 1/2 ( log2(x) + log2(y) ) ma_data = rna %>% select(gene, GSM2545336, GSM2545380) %>% mutate( - norm_mean = log2(GSM2545336 + 1) + log2(GSM2545380 + 1) / 2, - log2fc = log2(GSM2545336 + 1) / log2(GSM2545380 + 1) + norm_mean = ( log2(GSM2545336 + 1) + log2(GSM2545380 + 1) ) / 2, + log2fc = log2(GSM2545336 + 1) - log2(GSM2545380 + 1) ) %>% select(gene, log2fc, norm_mean) ma_data