mirror of
				https://github.com/johrpan/geposanui.git
				synced 2025-10-26 19:27:24 +01:00 
			
		
		
		
	Display score and add cut-off filter
This commit is contained in:
		
							parent
							
								
									91c15045cf
								
							
						
					
					
						commit
						8fc743fe10
					
				
					 2 changed files with 28 additions and 6 deletions
				
			
		
							
								
								
									
										23
									
								
								server.R
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								server.R
									
										
									
									
									
								
							|  | @ -19,8 +19,18 @@ server <- function(input, output) { | ||||||
| 
 | 
 | ||||||
|         # Compute scoring factors and the weighted score. |         # Compute scoring factors and the weighted score. | ||||||
| 
 | 
 | ||||||
|         results[, score := input$clusteriness / 100 * clusteriness + |         clusteriness_weight <- input$clusteriness / 100 | ||||||
|             input$correlation / 100 * r_mean] |         correlation_weight <- input$correlation / 100 | ||||||
|  |         total_weight <- clusteriness_weight + correlation_weight | ||||||
|  |         clusteriness_factor <- clusteriness_weight / total_weight | ||||||
|  |         correlation_factor <- correlation_weight / total_weight | ||||||
|  | 
 | ||||||
|  |         results[, score := clusteriness_factor * clusteriness + | ||||||
|  |             correlation_factor * r_mean] | ||||||
|  | 
 | ||||||
|  |         # Apply the cut-off score. | ||||||
|  | 
 | ||||||
|  |         results <- results[score >= input$cutoff / 100] | ||||||
| 
 | 
 | ||||||
|         # Order the results based on their score. The resulting index will be |         # Order the results based on their score. The resulting index will be | ||||||
|         # used as the "rank". |         # used as the "rank". | ||||||
|  | @ -29,17 +39,20 @@ server <- function(input, output) { | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
|     output$genes <- renderDT({ |     output$genes <- renderDT({ | ||||||
|         datatable( |         dt <- datatable( | ||||||
|             results()[, .(.I, name, clusteriness, r_mean)], |             results()[, .(.I, name, clusteriness, r_mean, score)], | ||||||
|             rownames = FALSE, |             rownames = FALSE, | ||||||
|             colnames = c( |             colnames = c( | ||||||
|                 "Rank", |                 "Rank", | ||||||
|                 "Gene", |                 "Gene", | ||||||
|                 "Clusteriness", |                 "Clusteriness", | ||||||
|                 "Correlation" |                 "Correlation", | ||||||
|  |                 "Score" | ||||||
|             ), |             ), | ||||||
|             style = "bootstrap" |             style = "bootstrap" | ||||||
|         ) |         ) | ||||||
|  | 
 | ||||||
|  |         formatPercentage(dt, c("clusteriness", "r_mean", "score"), digits = 1) | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
|     output$synposis <- renderText({ |     output$synposis <- renderText({ | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								ui.R
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								ui.R
									
										
									
									
									
								
							|  | @ -25,7 +25,7 @@ ui <- fluidPage( | ||||||
|                 min = 0, |                 min = 0, | ||||||
|                 max = 100, |                 max = 100, | ||||||
|                 step = 1, |                 step = 1, | ||||||
|                 value = 50 |                 value = 100 | ||||||
|             ), |             ), | ||||||
|             sliderInput( |             sliderInput( | ||||||
|                 "correlation", |                 "correlation", | ||||||
|  | @ -35,6 +35,15 @@ ui <- fluidPage( | ||||||
|                 max = 100, |                 max = 100, | ||||||
|                 step = 1, |                 step = 1, | ||||||
|                 value = 100 |                 value = 100 | ||||||
|  |             ), | ||||||
|  |             sliderInput( | ||||||
|  |                 "cutoff", | ||||||
|  |                 "Cut-off score", | ||||||
|  |                 post = "%", | ||||||
|  |                 min = 0, | ||||||
|  |                 max = 100, | ||||||
|  |                 step = 1, | ||||||
|  |                 value = 50 | ||||||
|             ) |             ) | ||||||
|         ), |         ), | ||||||
|         wellPanel( |         wellPanel( | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue