| 
																	
																	
																		
																			
																		
																	
																	
																 | 
																@ -78,7 +78,7 @@ server <- function(input, output) { | 
															
														
														
													
														
															
																 | 
																 | 
																              t_substr<-merge(t_substr, unique(dades$taula[c("Mice","Groups")]), id="Mice") | 
																 | 
																 | 
																              t_substr<-merge(t_substr, unique(dades$taula[c("Mice","Groups")]), id="Mice") | 
															
														
														
													
														
															
																 | 
																 | 
																              t_substr$Groups<-as.factor(t_substr$Groups) | 
																 | 
																 | 
																              t_substr$Groups<-as.factor(t_substr$Groups) | 
															
														
														
													
														
															
																 | 
																 | 
																            }             | 
																 | 
																 | 
																            }             | 
															
														
														
													
														
															
																 | 
																 | 
																             | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																            t_substr_gp<-t_substr | 
																 | 
																 | 
																            t_substr_gp<-t_substr | 
															
														
														
													
														
															
																 | 
																 | 
																            t_substr_gp[3:ncol(t_substr)]<-apply(t_substr[3:ncol(t_substr)], 2, function(x) gsub(".",",",x, fixed=T)) | 
																 | 
																 | 
																            t_substr_gp[3:ncol(t_substr)]<-apply(t_substr[3:ncol(t_substr)], 2, function(x) gsub(".",",",x, fixed=T)) | 
															
														
														
													
														
															
																 | 
																 | 
																            t_substr_gp<-t_substr_gp[order(factor(t_substr_gp$Mice, levels = unique(table$Mice))),] | 
																 | 
																 | 
																            t_substr_gp<-t_substr_gp[order(factor(t_substr_gp$Mice, levels = unique(table$Mice))),] | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																			
																		
																	
																 | 
																@ -87,7 +87,7 @@ server <- function(input, output) { | 
															
														
														
													
														
															
																 | 
																 | 
																            write.xlsx(doc, "data4graphpad.xlsx",rowNames=T) | 
																 | 
																 | 
																            write.xlsx(doc, "data4graphpad.xlsx",rowNames=T) | 
															
														
														
													
														
															
																 | 
																 | 
																             | 
																 | 
																 | 
																             | 
															
														
														
													
														
															
																 | 
																 | 
																            t<-melt(t_substr[,!colnames(t_substr) %in% c(ctrl, mock)]) | 
																 | 
																 | 
																            t<-melt(t_substr[,!colnames(t_substr) %in% c(ctrl, mock)]) | 
															
														
														
													
														
															
																 | 
																 | 
																             | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																
 | 
															
														
														
													
														
															
																 | 
																 | 
																            if (input$showstats == F){ | 
																 | 
																 | 
																            if (input$showstats == F){ | 
															
														
														
													
														
															
																 | 
																 | 
																                t_stats<-as.data.frame(matrix(nrow=0, ncol=6)) | 
																 | 
																 | 
																                t_stats<-as.data.frame(matrix(nrow=0, ncol=6)) | 
															
														
														
													
														
															
																 | 
																 | 
																                colnames(t_stats)<-c("variable", "group1", "group2", "p.adj", "p.signif", "Method") | 
																 | 
																 | 
																                colnames(t_stats)<-c("variable", "group1", "group2", "p.adj", "p.signif", "Method") | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																			
																		
																	
																 | 
																@ -96,10 +96,8 @@ server <- function(input, output) { | 
															
														
														
													
														
															
																 | 
																 | 
																                colnames(t_maps$label)<-c("x", "y") | 
																 | 
																 | 
																                colnames(t_maps$label)<-c("x", "y") | 
															
														
														
													
														
															
																 | 
																 | 
																                t_maps[["brackets"]]<-as.data.frame(matrix(nrow = 0, ncol=4)) | 
																 | 
																 | 
																                t_maps[["brackets"]]<-as.data.frame(matrix(nrow = 0, ncol=4)) | 
															
														
														
													
														
															
																 | 
																 | 
																                colnames(t_maps$brackets)<-c("y1", "y2", "x1", "x2") | 
																 | 
																 | 
																                colnames(t_maps$brackets)<-c("y1", "y2", "x1", "x2") | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																             | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																            set.seed(123) | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																            if (input$positive == T){ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                dades$stats<<-t_stats | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            }else{ | 
															
														
														
													
														
															
																 | 
																 | 
																              if (input$test == "T-test (adj Holm)"){ | 
																 | 
																 | 
																              if (input$test == "T-test (adj Holm)"){ | 
															
														
														
													
														
															
																 | 
																 | 
																                t_stats<-multi_stats(t, "value", "variable", "Groups", stat.test = "ttest") | 
																 | 
																 | 
																                t_stats<-multi_stats(t, "value", "variable", "Groups", stat.test = "ttest") | 
															
														
														
													
														
															
																 | 
																 | 
																              } | 
																 | 
																 | 
																              } | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																			
																		
																	
																 | 
																@ -111,20 +109,23 @@ server <- function(input, output) { | 
															
														
														
													
														
															
																 | 
																 | 
																              t_stats<-t_stats %>% filter(p.signif != "ns") | 
																 | 
																 | 
																              t_stats<-t_stats %>% filter(p.signif != "ns") | 
															
														
														
													
														
															
																 | 
																 | 
																               | 
																 | 
																 | 
																               | 
															
														
														
													
														
															
																 | 
																 | 
																              t_maps<-generate_labstats(t_stats, t, "value", "variable", "Groups") | 
																 | 
																 | 
																              t_maps<-generate_labstats(t_stats, t, "value", "variable", "Groups") | 
															
														
														
													
														
															
																 | 
																 | 
																               | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																              ggplot(melt(t_substr, id=c("Mice", ctrl, "Groups")), aes(variable, value))+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  labs(x="", y="Spots/2.5*10^5 cells")+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  # geom_errorbar(stat="summary", position=position_dodge(width=0.9), width=0.5, aes(fill=Groups))+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  geom_hline(data=mock_mean, aes(color=Groups, yintercept = `.`))+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  # geom_bar(stat="summary", position="dodge", color="black", aes(fill=Groups))+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  geom_boxplot(color="black", aes(fill=Groups), alpha=0.4, outlier.alpha = 0)+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  geom_jitter(position=position_jitterdodge(jitter.width = 0.2), shape=21, aes(fill=Groups), size=3)+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  # geom_quasirandom(position = position_quasirandom(), shape=21)+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  scale_x_discrete(limits=colnames(t_substr)[!colnames(t_substr) %in% c("Mice", "Groups", ctrl, mock)])+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  geom_segment(data=t_maps$brackets, aes(x=x1, xend=x2, y=y1, yend=y2), color="black")+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  geom_text(data=t_stats, aes(t_maps$label$x, t_maps$label$y, label=p.signif), color="black")+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  theme_bw()+ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																                  theme(axis.text.x=element_text(angle=45, hjust=1)) | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            } | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																             | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            set.seed(123) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            if (input$positive == T){ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                ggplot(melt(t_substr, id=c("Mice", ctrl, "Groups")), aes(variable, value))+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    labs(x="", y="Spots/2.5*10^5 cells")+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    # geom_errorbar(stat="summary", position=position_dodge(width=0.9), width=0.5, aes(fill=Groups))+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    geom_hline(data=mock_mean, aes(color=Groups, yintercept = `.`))+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    # geom_bar(stat="summary", position="dodge", color="black", aes(fill=Groups))+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    geom_boxplot(color="black", aes(fill=Groups), alpha=0.4, outlier.alpha = 0)+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    geom_jitter(position=position_jitterdodge(jitter.width = 0.2), shape=21, aes(fill=Groups), size=3)+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    # geom_quasirandom(position = position_quasirandom(), shape=21)+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    scale_x_discrete(limits=colnames(t_substr)[!colnames(t_substr) %in% c("Mice", "Groups", ctrl, mock)])+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    geom_segment(data=t_maps$brackets, aes(x=x1, xend=x2, y=y1, yend=y2), color="black")+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    geom_text(data=t_stats, aes(t_maps$label$x, t_maps$label$y, label=p.signif), color="black")+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    theme_bw()+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                    theme(axis.text.x=element_text(angle=45, hjust=1)) | 
															
														
														
													
														
															
																 | 
																 | 
																            }else{ | 
																 | 
																 | 
																            }else{ | 
															
														
														
													
														
															
																 | 
																 | 
																                ids<-if(ctrl %in% colnames(t_substr)){c("Mice", ctrl, "Groups")}else{c("Mice", "Groups")} | 
																 | 
																 | 
																                ids<-if(ctrl %in% colnames(t_substr)){c("Mice", ctrl, "Groups")}else{c("Mice", "Groups")} | 
															
														
														
													
														
															
																 | 
																 | 
																                ggplot(melt(t_substr, id=ids), aes(variable, value))+ | 
																 | 
																 | 
																                ggplot(melt(t_substr, id=ids), aes(variable, value))+ | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																			
																		
																	
																	
																	
																 | 
																
 |