--- title: "CellROX Dopaminergic neurons" author: "Claudia Saraiva" date: "2023-07-24" output: html_document --- ```{r} library(tidyverse) library(ggforce) library(ggsignif) library(shiny) library(ggpubr) library(ggplot2) library(dplyr) #install.packages("hrbrthemes") #installr::check.for.updates.R() library(hrbrthemes) #install.packages("viridisLite") library(viridisLite) library(viridis) library(gdata) library(readxl) library(tidyverse) library(ggsignif) #install.packages("janitor") library(janitor) #install.packages("xgboost") library(xgboost) #install.packages("vioplot") library(vioplot) #install.packages("outliers") library(outliers) library(ggpubr) library(rstatix) ``` ```{r} #work directory and data loading setwd("Z:/16-Our Papers/In Preparation/Miro1_AxPD_Claudia/Figures/Figure2/Partials/e") dataDAN <- readr::read_csv("RplottingCellRox2D.csv") #Checking for data normality within the dataset #30days shapiro.test(dataDAN$`CellroxMean normalized to isogenic control`) #If shapiro test is significant, then data is not normal and Kruskal Willis test is done #30days kruskal.test(`CellroxMean normalized to isogenic control` ~ Condition, data = dataDAN) stat.test.dunn <- dunn_test(dataDAN, `CellroxMean normalized to isogenic control` ~ Condition, p.adjust.method = "BH") stat.test.dunn ``` ```{r} ``` ```{r} #Ploting the feature of interest 30days dataDAN$Condition <- factor (dataDAN$Condition, level=c("Ctrl", "PD", "iCtrl")) dataDAN$NomenclatureManuscript <- factor (dataDAN$NomenclatureManuscript, level=c("Ctrl1", "PD", "iCtrl")) dataDAN %>% ggplot( aes(x = factor(Condition), y=`CellroxMean normalized to isogenic control`) ) + geom_boxplot(aes(fill=Condition),width=0.5,outlier.shape=NA) + scale_fill_manual(values= c(alpha("#008176",0.7),"#c1272d",alpha("#0000a7",0.7)),name = "Condition") + geom_jitter(aes(colour = NomenclatureManuscript), position=position_jitter(0), cex=2)+ scale_color_manual(values= (c(alpha("black", 0.8), alpha("black", 0.8), alpha("black", 0.8))))+ stat_compare_means() + #default Kruskall-Wallis stat_pvalue_manual( stat.test.dunn, y.position = 3.4, step.increase = 0.1, label = "p.adj.signif", hide.ns =T )+ labs(x = "Ctrl", "PD", "iCtrl", y = "MFI CellROX \n Normalized iCtrl (set to 1)", fill = "Conditions", title = "") + scale_y_continuous(limits=c(0, 4)) + theme_classic() + theme( axis.line = element_line(colour = 'black', size = 0.1) , axis.title.x = element_blank(), axis.text.x = element_blank(), axis.title.y = element_text(size = 14), axis.text.y = element_text(size=12, color="black"), axis.ticks.y = element_line(), legend.position="right", legend.text = element_text(size = 12, face = "bold") , legend.title = element_blank(), legend.key.size = unit(0.7, "cm"), legend.key.width = unit(0.6,"cm"), plot.title = element_text(size = 15, hjust=0.5, vjust= 1, face = "bold"), plot.subtitle = element_blank(),#element_text(size = 2, hjust=0.5) # strip.text = element_text(size=12, vjust=0.5), # strip.background = element_rect(fill="lightgray"), # panel.border = element_rect(fill = NA, color = "black"), # panel.spacing.y = unit(0.8, "lines"), # strip.switch.pad.wrap=unit(20, "lines"), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), panel.background = element_blank() )+ theme(aspect.ratio = 1.25 / 0.75) -> p print(p) ggsave("CellROX_DAN_30days.pdf", useDingbats=FALSE, plot=p, height = 4, width = 5) ggsave("CellROX_DAN_30days.tiff", plot=p) ```