|
212 | 212 |
|
213 | 213 | #' @rdname create_observers |
214 | 214 | #' @importFrom stats as.formula |
215 | | -#' @importFrom mia addAlpha runNMDS runRDA getDissimilarity |
| 215 | +#' @importFrom mia addAlpha runNMDS runRDA getDissimilarity addHierarchyTree |
| 216 | +#' addPrevalence addPrevalentAbundance |
216 | 217 | #' @importFrom TreeSummarizedExperiment rowTree |
217 | 218 | #' @importFrom scater runMDS runPCA |
| 219 | +#' @importFrom scuttle addPerCellQC |
218 | 220 | #' @importFrom vegan vegdist |
219 | 221 | .create_estimate_observers <- function(input, rObjects) { |
220 | 222 |
|
221 | 223 | # nocov start |
222 | 224 | observeEvent(input$compute, { |
223 | 225 |
|
224 | | - if( input$estimate == "alpha" ){ |
225 | | - |
| 226 | + if( input$estimate == "quality" ){ |
| 227 | + |
| 228 | + isolate({ |
| 229 | + req(input$estimate.assay) |
| 230 | + |
| 231 | + for( qmetric in input$quality.metrics ){ |
| 232 | + |
| 233 | + qfun <- eval(parse(text = paste0("add", qmetric))) |
| 234 | + |
| 235 | + qfun_args <- list(x = rObjects$tse, |
| 236 | + assay.type = input$estimate.assay) |
| 237 | + |
| 238 | + rObjects$tse <- .update_tse(rObjects$tse, qfun, qfun_args) |
| 239 | + |
| 240 | + } |
| 241 | + |
| 242 | + }) |
| 243 | + |
| 244 | + }else if( input$estimate == "alpha" ){ |
| 245 | + |
226 | 246 | if( is.null(input$alpha.index) ){ |
227 | 247 | .print_message("Please select one or more metrics.") |
228 | 248 | return() |
229 | 249 | } |
230 | 250 |
|
231 | 251 | isolate({ |
232 | 252 | req(input$estimate.assay) |
233 | | - |
| 253 | + |
234 | 254 | if( input$estimate.name != "" ){ |
235 | 255 | name <- input$estimate.name |
236 | 256 | } else { |
237 | 257 | name <- input$alpha.index |
238 | 258 | } |
239 | | - |
| 259 | + |
240 | 260 | fun_args <- list(x = rObjects$tse, name = name, |
241 | 261 | assay.type = input$estimate.assay, index = input$alpha.index) |
242 | 262 |
|
|
338 | 358 | updateSelectInput(session, inputId = "estimate.assay", |
339 | 359 | choices = assayNames(rObjects$tse)) |
340 | 360 |
|
341 | | - updateSelectInput(session, inputId = "estimate.assay", |
342 | | - choices = assayNames(rObjects$tse)) |
343 | | - |
344 | 361 | updateNumericInput(session, inputId = "ncomponents", |
345 | 362 | max = nrow(rObjects$tse) - 1) |
346 | 363 |
|
|
0 commit comments