From 5fff23d36b2960b9876699145768fbf1b573a4bd Mon Sep 17 00:00:00 2001
From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr>
Date: Wed, 22 Jun 2022 10:26:50 +0200
Subject: [PATCH] src/03_ERCC_analysis_code.R: cosmetic changes

---
 src/03_ERCC_analysis_code.R | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/03_ERCC_analysis_code.R b/src/03_ERCC_analysis_code.R
index e0fae81..d819d0d 100644
--- a/src/03_ERCC_analysis_code.R
+++ b/src/03_ERCC_analysis_code.R
@@ -17,7 +17,10 @@ ercc_count_matrix <- get_count_matrix(
     0
 )[, colnames(data_count_matrix)]
 
-data_count_matrix <- data.frame(gene = rownames(data_count_matrix), data_count_matrix)
+data_count_matrix <- data.frame(
+    gene = rownames(data_count_matrix),
+    data_count_matrix
+)
 dir.create("./results/matrice_count/")
 write.table(data_count_matrix,
     file = "./results/matrice_count/coding_gene_matrices.txt",
@@ -26,7 +29,10 @@ write.table(data_count_matrix,
     row.names = F
 )
 
-ercc_count_matrix_new <- data.frame(gene = rownames(ercc_count_matrix), ercc_count_matrix)
+ercc_count_matrix_new <- data.frame(
+    gene = rownames(ercc_count_matrix),
+    ercc_count_matrix
+)
 write.table(ercc_count_matrix_new,
     file = "./results/matrice_count/ercc_matrices.txt",
     quote = F,
@@ -38,7 +44,10 @@ write.table(ercc_count_matrix_new,
 
 ercc_real_concentration <- read_tsv("./data/ercc_concentration.txt") %>%
     select(`ERCC ID`, `concentration in Mix 1 (attomoles/ul)`) %>%
-    rename(`ERCC ID` = "gene", `concentration in Mix 1 (attomoles/ul)` = "concentration")
+    rename(
+        `ERCC ID` = "gene",
+        `concentration in Mix 1 (attomoles/ul)` = "concentration"
+    )
 
 c_sup0 <- create_correlation_figures(ercc_count_matrix, 0)
 c_sup2 <- create_correlation_figures(ercc_count_matrix, 2)
@@ -88,8 +97,9 @@ data_sample <- get_sample_count(data_count_matrix)
 ercc_sample <- get_sample_count(ercc_count_matrix)
 relative_counts <- get_relative_count(data_sample, ercc_sample)
 relative_counts <- relative_counts %>% arrange(name)
-pdf("./results/ERCC_analysis/ratio_ercc_on_genecount.pdf", 
-    width = 12, height = 8)
+pdf("./results/ERCC_analysis/ratio_ercc_on_genecount.pdf",
+    width = 12, height = 8
+)
 ggplot(relative_counts, mapping = aes(x = name, y = relative_count)) +
     geom_boxplot() +
     theme(axis.text.x = element_text(angle = 90))
@@ -97,7 +107,9 @@ dev.off()
 
 # Normalisation
 full_matrix <- rbind(data_count_matrix, ercc_count_matrix)
-coldata <- data.frame(condition = relevel(as.factor(str_extract(colnames(data_count_matrix), "BRAF|DMSO")), "DMSO"))
+coldata <- data.frame(condition = relevel(
+    as.factor(str_extract(colnames(data_count_matrix), "BRAF|DMSO")), "DMSO"
+))
 rownames(coldata) <- colnames(data_count_matrix)
 dds <- DESeqDataSetFromMatrix(
     countData = full_matrix, colData = coldata,
-- 
GitLab