mirror of
				https://github.com/johrpan/geposanui.git
				synced 2025-10-26 19:27:24 +01:00 
			
		
		
		
	Add more optimization targets
This commit is contained in:
		
							parent
							
								
									2aed917478
								
							
						
					
					
						commit
						365cf13dcb
					
				
					 2 changed files with 22 additions and 8 deletions
				
			
		
							
								
								
									
										24
									
								
								R/methods.R
									
										
									
									
									
								
							
							
						
						
									
										24
									
								
								R/methods.R
									
										
									
									
									
								
							|  | @ -4,11 +4,6 @@ methods_ui <- function(id) { | ||||||
| 
 | 
 | ||||||
|     verticalLayout( |     verticalLayout( | ||||||
|         h3("Methods"), |         h3("Methods"), | ||||||
|         actionButton( |  | ||||||
|             NS(id, "optimize_button"), |  | ||||||
|             "Find optimal weights", |  | ||||||
|             icon = icon("check-double") |  | ||||||
|         ), |  | ||||||
|         div(style = "margin-top: 16px"), |         div(style = "margin-top: 16px"), | ||||||
|         lapply(methods, function(method) { |         lapply(methods, function(method) { | ||||||
|             verticalLayout( |             verticalLayout( | ||||||
|  | @ -30,7 +25,21 @@ methods_ui <- function(id) { | ||||||
|                     value = initial_weight |                     value = initial_weight | ||||||
|                 ) |                 ) | ||||||
|             ) |             ) | ||||||
|         }) |         }), | ||||||
|  |         radioButtons( | ||||||
|  |             NS(id, "target"), | ||||||
|  |             "Optimization target", | ||||||
|  |             choices = list( | ||||||
|  |                 "Mean rank of reference genes" = "mean", | ||||||
|  |                 "First rank of reference genes" = "min", | ||||||
|  |                 "Last rank of reference genes" = "max" | ||||||
|  |             ) | ||||||
|  |         ), | ||||||
|  |         actionButton( | ||||||
|  |             NS(id, "optimize_button"), | ||||||
|  |             "Optimize weights", | ||||||
|  |             class = "btn-primary" | ||||||
|  |         ) | ||||||
|     ) |     ) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -54,7 +63,8 @@ methods_server <- function(id, analysis) { | ||||||
|             weights <- geposan::optimize_weights( |             weights <- geposan::optimize_weights( | ||||||
|                 analysis(), |                 analysis(), | ||||||
|                 method_ids, |                 method_ids, | ||||||
|                 genes_tpe_old |                 genes_tpe_old, | ||||||
|  |                 target = input$target | ||||||
|             ) |             ) | ||||||
| 
 | 
 | ||||||
|             for (method_id in method_ids) { |             for (method_id in method_ids) { | ||||||
|  |  | ||||||
|  | @ -160,19 +160,23 @@ server <- function(input, output, session) { | ||||||
|                 digits = 1 |                 digits = 1 | ||||||
|             )) |             )) | ||||||
| 
 | 
 | ||||||
|  |             min_rank <- as.character(reference_results[, min(rank)]) | ||||||
|             max_rank <- as.character(reference_results[, max(rank)]) |             max_rank <- as.character(reference_results[, max(rank)]) | ||||||
|         } else { |         } else { | ||||||
|             mean_rank <- "Unknown" |             mean_rank <- "Unknown" | ||||||
|  |             min_rank <- "Unknown" | ||||||
|             max_rank <- "Unknown" |             max_rank <- "Unknown" | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         sprintf( |         sprintf( | ||||||
|             "Included reference genes: %i/%i<br> \ |             "Included reference genes: %i/%i<br> \ | ||||||
|             Mean rank of reference genes: %s<br> \ |             Mean rank of reference genes: %s<br> \ | ||||||
|             Maximum rank of reference genes: %s", |             First rank of reference genes: %s<br> \ | ||||||
|  |             Last rank of reference genes: %s", | ||||||
|             included_reference_count, |             included_reference_count, | ||||||
|             total_reference_count, |             total_reference_count, | ||||||
|             mean_rank, |             mean_rank, | ||||||
|  |             min_rank, | ||||||
|             max_rank |             max_rank | ||||||
|         ) |         ) | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue