| 
																	
																	
																		
																			
																		
																	
																	
																 | 
																@ -77,7 +77,7 @@ ui <- fluidPage( | 
															
														
														
													
														
															
																 | 
																 | 
																                htmlOutput("report"), | 
																 | 
																 | 
																                htmlOutput("report"), | 
															
														
														
													
														
															
																 | 
																 | 
																                h3("Nitrogen"), | 
																 | 
																 | 
																                h3("Nitrogen"), | 
															
														
														
													
														
															
																 | 
																 | 
																                tableOutput("nitrogen"), | 
																 | 
																 | 
																                tableOutput("nitrogen"), | 
															
														
														
													
														
															
																 | 
																 | 
																                plotOutput("visorplot") | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                plotOutput("visorplot", height = "1000px") | 
															
														
														
													
														
															
																 | 
																 | 
																            ) | 
																 | 
																 | 
																            ) | 
															
														
														
													
														
															
																 | 
																 | 
																        ), | 
																 | 
																 | 
																        ), | 
															
														
														
													
														
															
																 | 
																 | 
																
 | 
																 | 
																 | 
																
 | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																			
																		
																	
																	
																		
																			
																		
																	
																	
																 | 
																@ -831,7 +831,7 @@ server <- function(input, output) { | 
															
														
														
													
														
															
																 | 
																 | 
																        if (input$nhc == 3){ | 
																 | 
																 | 
																        if (input$nhc == 3){ | 
															
														
														
													
														
															
																 | 
																 | 
																            pops<-sqlFetch(dta, "POPULATIONS") | 
																 | 
																 | 
																            pops<-sqlFetch(dta, "POPULATIONS") | 
															
														
														
													
														
															
																 | 
																 | 
																             | 
																 | 
																 | 
																             | 
															
														
														
													
														
															
																 | 
																 | 
																            pops %>% dplyr::filter(samples == input$id) %>% gather(pop,value,-samples) %>% | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            g_pop<-pops %>% dplyr::filter(samples == input$id) %>% gather(pop,value,-samples) %>% | 
															
														
														
													
														
															
																 | 
																 | 
																                mutate(pop=factor(pop, levels=c("CD45pos_Alive","T_cells","CD8","CD4","DN","NK", "B_cells", | 
																 | 
																 | 
																                mutate(pop=factor(pop, levels=c("CD45pos_Alive","T_cells","CD8","CD4","DN","NK", "B_cells", | 
															
														
														
													
														
															
																 | 
																 | 
																                                                "CD45neg_LDneg","EpCAMneg_HLAIneg","EpCAMneg_HLAIpos","EpCAMpos_HLAIpos"))) %>%  | 
																 | 
																 | 
																                                                "CD45neg_LDneg","EpCAMneg_HLAIneg","EpCAMneg_HLAIpos","EpCAMpos_HLAIpos"))) %>%  | 
															
														
														
													
														
															
																 | 
																 | 
																                ggplot(aes(pop, value))+ | 
																 | 
																 | 
																                ggplot(aes(pop, value))+ | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																			
																		
																	
																 | 
																@ -839,6 +839,36 @@ server <- function(input, output) { | 
															
														
														
													
														
															
																 | 
																 | 
																                    labs(title = input$id, y="% parent", x="")+ | 
																 | 
																 | 
																                    labs(title = input$id, y="% parent", x="")+ | 
															
														
														
													
														
															
																 | 
																 | 
																                    theme_bw()+ | 
																 | 
																 | 
																                    theme_bw()+ | 
															
														
														
													
														
															
																 | 
																 | 
																                    theme(axis.text.x = element_text(angle=90, hjust=1, vjust=0.5)) | 
																 | 
																 | 
																                    theme(axis.text.x = element_text(angle=90, hjust=1, vjust=0.5)) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            tl<-sqlFetch(dta, "IC") %>% filter(samples == input$id) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																             | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            mtl<-melt(tl, variable.name = "Receptors") | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            mtl$Receptors<-as.character(mtl$Receptors) #Para poder depurar bien el texto, lo pasamos a tipo character | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            mtl$Receptors<-gsub("n","-",mtl$Receptors, fixed = T) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            mtl$Receptors<-gsub("p","+",mtl$Receptors, fixed = T) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            mtl$Receptors<-gsub("_"," ",mtl$Receptors) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            mtl[mtl$value < 1, "Receptors"]<-"Other" | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            mtl$Receptors<-gsub("[A-Z]*-*[0-9T]- *", "", mtl$Receptors) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            mtl$Receptors<-gsub("+ $", "", mtl$Receptors) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            mtl$Receptors[mtl$Receptors == ""]<-"All Negative" | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																             | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            mtl$Receptors<-factor(mtl$Receptors) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            mtl$Population<-factor(mtl$Population, levels = c("CD8", "CD4")) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																             | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            # colorCount<-length(unique(mtl$Receptors)) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            # getPalette = colorRampPalette(RColorBrewer::brewer.pal(12, "Set3")) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																             | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            color<-c(c("CTLA4+ LAG3+ PD1+ TIGIT+ TIM3+"="black","All Negative"="white","Other"="grey50", "PD1+"="#C07AFF", "CTLA4+"="#3EB3DE","TIM3+"="#5EF551","LAG3+"="#DEBB3E","TIGIT+"="#FA7055"), | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                     c("CTLA4+ PD1+"="#6666FF","PD1+ TIM3+"="#849CA8", "LAG3+ PD1+"="#C47F9F","PD1+ TIGIT+"="#D259AA", "CTLA4+ TIM3+"="#4ED498", "CTLA4+ LAG3+"="#8EB78E", "CTLA4+ TIGIT+"="#9C929A", "LAG3+ TIM3+"="#9ED848", "TIGIT+ TIM3+"="#ACB353", "LAG3+ TIGIT+"="#EC964A"), | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                     c("CTLA4+ PD1+ TIGIT+"="#B86B6A","CTLA4+ PD1+ TIGIT+ TIM3+"="#B81515","LAG3+ PD1+ TIGIT+"="#007D8A", "PD1+ TIGIT+ TIM3+"="#D64545", "LAG3+ PD1+ TIGIT+ TIM3+"="#0f5860", "LAG3+ TIGIT+ TIM3+"="#50cad3")) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																             | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            g_IC<-ggplot(mtl, aes(samples, value, fill=Receptors))+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                geom_bar(stat="summary", fun="sum",color="black")+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                labs(x="Patient", y="% CD8+", fill="")+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                facet_grid(.~Population)+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                scale_fill_manual(values = color[levels(mtl$Receptors)[levels(mtl$Receptors) %in% unique(mtl$Receptors)]])+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                theme_bw()+ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                theme(axis.text.x=element_text(angle=45, hjust=1)) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            ggpubr::ggarrange(g_pop, g_IC, heights = c(0.4, 0.6), ncol = 1) | 
															
														
														
													
														
															
																 | 
																 | 
																        } | 
																 | 
																 | 
																        } | 
															
														
														
													
														
															
																 | 
																 | 
																    }) | 
																 | 
																 | 
																    }) | 
															
														
														
													
														
															
																 | 
																 | 
																     | 
																 | 
																 | 
																     | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																			
																		
																	
																	
																	
																 | 
																
 |