| 
									
										
										
										
											2021-10-20 15:34:52 +02:00
										 |  |  | #' Run the application server. | 
					
						
							|  |  |  | #' | 
					
						
							| 
									
										
										
										
											2022-05-19 16:24:23 +02:00
										 |  |  | #' @param gene_sets A list of predefined gene sets. This should be a named list | 
					
						
							|  |  |  | #'   containing vectors of gene IDs for each set. The names will be used to | 
					
						
							|  |  |  | #'   present the gene set throughout the user interface. You have to provide *at | 
					
						
							|  |  |  | #'   least one gene set* which will be selected as the initial reference gene | 
					
						
							|  |  |  | #'   set. | 
					
						
							|  |  |  | #' @param species_sets A list of predefined species sets. This should be a named | 
					
						
							|  |  |  | #'   list containing vectors of species IDs for each set. The names will be used | 
					
						
							|  |  |  | #'   to present the species set throughout the user interface. | 
					
						
							|  |  |  | #' @param locked Whether the application should be locked and prohibit | 
					
						
							|  |  |  | #'   performing custom analyses. If this is set to `TRUE`, only the predefined | 
					
						
							|  |  |  | #'   gene and species sets are available for customizing the analysis. This may | 
					
						
							|  |  |  | #'   be useful to limit resource usage on a publicly available instance. | 
					
						
							| 
									
										
										
										
											2022-05-19 16:28:59 +02:00
										 |  |  | #' @param title Set the title of the application. | 
					
						
							| 
									
										
										
										
											2021-10-20 15:34:52 +02:00
										 |  |  | #' @param port The port to serve the application on. | 
					
						
							|  |  |  | #' | 
					
						
							|  |  |  | #' @export | 
					
						
							| 
									
										
										
										
											2022-05-19 16:24:23 +02:00
										 |  |  | run_app <- function(gene_sets, | 
					
						
							|  |  |  |                     species_sets = NULL, | 
					
						
							|  |  |  |                     locked = FALSE, | 
					
						
							| 
									
										
										
										
											2022-05-19 16:28:59 +02:00
										 |  |  |                     title = "Gene Position Analysis", | 
					
						
							| 
									
										
										
										
											2022-05-19 16:24:23 +02:00
										 |  |  |                     port = 3464) { | 
					
						
							|  |  |  |     stopifnot(!is.null(gene_sets) & !is.null(gene_sets[[1]])) | 
					
						
							| 
									
										
										
										
											2021-10-21 15:57:08 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-19 16:24:23 +02:00
										 |  |  |     # These function calls make the required java scripts available. | 
					
						
							| 
									
										
										
										
											2021-10-21 15:57:08 +02:00
										 |  |  |     shinyjs::useShinyjs() | 
					
						
							|  |  |  |     rclipboard::rclipboardSetup() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-19 16:24:23 +02:00
										 |  |  |     # Bundle of global options to redue broilerplate. | 
					
						
							|  |  |  |     options <- list( | 
					
						
							|  |  |  |         gene_sets = gene_sets, | 
					
						
							|  |  |  |         species_sets = species_sets, | 
					
						
							| 
									
										
										
										
											2022-05-19 16:28:59 +02:00
										 |  |  |         locked = locked, | 
					
						
							|  |  |  |         title = title | 
					
						
							| 
									
										
										
										
											2022-05-19 16:24:23 +02:00
										 |  |  |     ) | 
					
						
							| 
									
										
										
										
											2021-10-21 15:57:08 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-19 16:24:23 +02:00
										 |  |  |     # Actually run the app. | 
					
						
							|  |  |  |     shiny::runApp( | 
					
						
							|  |  |  |         shiny::shinyApp(ui(options), server(options)), | 
					
						
							|  |  |  |         port = port | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2021-10-20 15:34:52 +02:00
										 |  |  | } |