--- title: "Test_exp" output: html_document --- ```{r} library(dplyr) library(tidyverse) library(cowplot) library(ggpubr) ``` #Cell death frm three batches, WT2 (WT68) ```{r} setwd("Z:/16-Our Papers/In Preparation/PD_Diabetes_Alise/Figures/FigureS2/originals/B,C") data_LDH <- readr::read_csv("LDH_assay_Insulin_inputR.csv") ``` ```{r} #Data68<-subset(data_ins, data_ins$Cell_line %in% "WT_68") data_LDH %>% mutate(Day= 'D30')%>% mutate(Area = pi*(data_LDH$Diameter/2)^2)%>% mutate(Cell_death=Lum_norm/Area*10000)->newData #Luminescence is normalized to the mean RLU of the batch and multiply by 10000 factor to keep the scale newData %>% mutate(Treatment = case_when (str_detect(Condition, 'Ctrl') ~ 'Standard media', str_detect(Condition, '430nM') ~ 'Self-made N2 +430nM ins', str_detect(Condition, '-ins') ~ 'Self-made N2 w/o ins', TRUE ~ 'none'))-> dataTr dataTr$Treatment <- factor(dataTr$Treatment, levels=c("Standard media", "Self-made N2 +430nM ins","Self-made N2 w/o ins")) ggplot(dataTr, aes(x=Treatment, y=Cell_death))+ geom_boxplot(aes(fill=Treatment),width=0.5)+ #geom_violin(aes(fill=Treatment),show.legend = T, trim=T)+ scale_fill_manual(values=c('indianred','gold3','steelblue'))+ #RosyBrown geom_jitter(aes(color=Cell_line),position=position_jitter(0.2), cex=1)+ scale_color_manual(values = c("black")) + #ylim(0,0.25)+ geom_signif(comparisons = list(c("Standard media", "Self-made N2 +430nM ins")), test='t.test',#margin_top = 0.5, vjust=0, size=0.3, textsize=3, map_signif_level=c("***"=0.001, "**"=0.01, "*"=0.05), y_position = 0.025 ) + geom_signif(comparisons = list(c("Standard media", "Self-made N2 w/o ins")), test='t.test',#margin_top = 0.5, vjust=0, size=0.3, textsize=3, map_signif_level=c("***"=0.001, "**"=0.01, "*"=0.05), y_position = 0.028 ) + geom_signif(comparisons = list(c("Self-made N2 +430nM ins", "Self-made N2 w/o ins")), test='t.test',#margin_top = 0.5, vjust=0, size=0.3, textsize=3, map_signif_level=c("***"=0.001, "**"=0.01, "*"=0.05), y_position = 0.022 ) + theme_minimal()+ labs(title=" ", y = "LDH release, RLU/Area")+ theme(plot.title=element_text(size=15, face="bold", hjust=0.5), axis.text.x=element_blank(), axis.title.x=element_blank(), axis.title.y=element_text(size=20), axis.text.y=element_text(size=16, colour = "black"), legend.text = element_text(size=14), legend.title = element_text(size=15))->p print(p) ``` #ATP ```{r} setwd("Z:/16-Our Papers/In Preparation/PD_Diabetes_Alise/Figures/FigureS2/originals/B,C") dataATP <- readr::read_csv("ATP_assay_Insulin_treatment_inputR.csv") ``` ```{r} #data68<-subset(dataATP, dataATP$Cell_line %in% "WT_68") dataATP %>% mutate(Day= 'D30')%>% mutate(Area = pi*(dataATP$Diameter/2)^2)%>% mutate(ATP = Lum_norm/Area*10000)->newDataATP #Luminescence is normalized to the mean RLU of the batch and multiply by 10000 factor to keep the scale newDataATP %>% mutate(Treatment = case_when (str_detect(Condition, 'Ctrl') ~ 'Standard media', str_detect(Condition, '430nM') ~ 'Self-made N2 +430nM ins', str_detect(Condition, '-ins') ~ 'Self-made N2 w/o ins', TRUE ~ 'none')) -> dataTrATP dataTrATP$Treatment <- factor(dataTrATP$Treatment, levels=c("Standard media", "Self-made N2 +430nM ins","Self-made N2 w/o ins")) ggplot(dataTrATP, aes(x=Treatment, y=ATP))+ geom_boxplot(aes(fill=Treatment),width=0.5)+ #geom_violin(aes(fill=Treatment),show.legend = T, trim=T)+ scale_fill_manual(values=c('indianred','gold3','steelblue'))+ #RosyBrown geom_jitter(aes(color=Cell_line),position=position_jitter(0.2), cex=1)+ scale_color_manual(values = c("black")) + #ylim(0,0.25)+ geom_signif(comparisons = list(c("Standard media", "Self-made N2 +430nM ins")), test='t.test',#margin_top = 0.5, vjust=0, size=0.3, textsize=3, map_signif_level=c("***"=0.001, "**"=0.01, "*"=0.05), y_position = 0.023 ) + geom_signif(comparisons = list(c("Standard media", "Self-made N2 w/o ins")), test='t.test',#margin_top = 0.5, vjust=0, size=0.3, textsize=3, map_signif_level=c("***"=0.001, "**"=0.01, "*"=0.05), y_position = 0.026 ) + geom_signif(comparisons = list(c("Self-made N2 +430nM ins", "Self-made N2 w/o ins")), test='t.test',#margin_top = 0.5, vjust=0, size=0.3, textsize=3, map_signif_level=c("***"=0.001, "**"=0.01, "*"=0.05), y_position = 0.02 ) + theme_minimal()+ labs(title=" ", y = "ATP, RLU/Area")+ theme(plot.title=element_text(size=15, face="bold", hjust=0.5), axis.text.x=element_blank(), axis.title.x=element_blank(), axis.title.y=element_text(size=20), axis.text.y=element_text(size=16, colour = "black"), legend.text = element_text(size=14), legend.title = element_text(size=15))->p print(p) ``` #Organoid developmentfrom the same three batches ```{r} setwd("Z:/16-Our Papers/In Preparation/PD_Diabetes_Alise/Figures/FigureS2/originals/B,C") dataB1 <- readr::read_csv("Summary_size_B1.csv") dataB3 <- readr::read_csv("Summary_size_B3.csv") dataB4 <- readr::read_csv("Summary_size_B4.csv") ``` #Clean data to analyze the shared time pints between batches ```{r} dataB1[!grepl("D12", dataB1$Day),]->dataB1 dataB1[!grepl("D18", dataB1$Day),]->dataB1 dataB3[!grepl("D12", dataB3$Day),]->dataB3 dataB1[!grepl("Annas_protocol", dataB1$Treatment),]->dataB1 data<-rbind(dataB1, dataB3, dataB4) data[!grepl("WT_K7", data$Cell_line),]->data data[!grepl("Insulin_10nM", data$Treatment),]->data data %>% mutate(Condition = case_when (str_detect(Treatment, 'Optimized') ~ 'Standard media', str_detect(Treatment, 'Self_made_N2') ~ 'Self-made N2 +430nM ins', str_detect(Treatment, 'W/o_insulin') ~ 'Self-made N2 w/o ins', TRUE ~ 'none'))%>% mutate(Cell = case_when(str_detect(Cell_line, 'WT_68') ~ 'WT2', TRUE ~ 'none'))->dataSize dataSize$Condition <- factor(dataSize$Condition, levels=c("Standard media", "Self-made N2 +430nM ins","Self-made N2 w/o ins")) dataSize$Day <- factor(dataSize$Day, levels=c("D2","D6","D9", "D16")) ggplot(dataSize, aes(x=Condition, y=Area))+ geom_boxplot(aes(fill=Batch),width=1)+ scale_fill_manual(values=c('DarkGray','RosyBrown',"lightblue"))+ geom_jitter(aes(color=Cell_line),position=position_jitter(0.5))+ # scale_color_manual(values = c("SteelBlue","DarkGreen")) + facet_grid(~Day)+ theme_bw()+ labs(title="Organoid size", y = "Area, um")+ theme(plot.title=element_text(size=15, face="bold", hjust=0.5), axis.text.x=element_text(size = 12, angle=45, vjust = 1, hjust = 1), axis.title.x=element_blank(), axis.title.y=element_text(size=12)) -> p t<- cowplot::ggdraw(cowplot::add_sub(p, "Objective: D2-D6:4x, D9-D16:2.5x",hjust=-0.5, size=9)) print(t) #ggsave('Size comparison2.png', height = 6 , width = 9) ``` #take D30 Area from LDH Diameter (ATP and LDH Area is the same, bc both experiments done fr the same MOs) ```{r} data_ins2<-dataTr[,c("Batch","Cell_line","Day","Treatment", "Area")] dataSize2<-dataSize[,c("Batch","Cell","Day","Condition", "Area")] colnames(dataSize2)<-c("Batch","Cell_line","Day","Treatment","Area") data3<-rbind(data_ins2,dataSize2) data3$Day <- factor(data3$Day, levels=c("D2","D6","D9", "D16", "D30")) ``` ```{r} data3 %>% group_by(Day, Treatment) %>% dplyr::mutate(av = mean(Area, na.rm=TRUE)) %>% unique() %>% ggplot(aes(x=Day, y=av, group=Treatment, color=Treatment)) + scale_color_manual(values=c('indianred','gold3','steelblue'))+ stat_smooth(method='loess', formula ='y ~ x')+ labs(x="Days of organoid culture", y = "Area, μm", fill = "Treatment", title = " ") + theme_minimal() + theme( #axis.line = element_line(colour = 'black', size = 0.1) , axis.title.x = element_text(size = 20), axis.text.x = element_text(size = 16, colour = "black"), axis.title.y = element_text(size = 20), axis.text.y = element_text(size=16, color="black"), axis.ticks.y = element_line(), legend.position="right", legend.text = element_text(size = 14), legend.title = element_text(size=15), legend.key.size = unit(0.7, "cm"), legend.key.width = unit(0.6,"cm"), plot.title = element_text(size = 16, 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") ) -> p print(p) # ggsave(paste0(Sys.Date(), "_Timeline.pdf"), p) ```