Skip to content

Commit 99c10a2

Browse files
committed
Introduce tab for Quality Control
1 parent f2d53d6 commit 99c10a2

9 files changed

Lines changed: 57 additions & 14 deletions

File tree

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: miaDash
2-
Version: 1.1.2
2+
Version: 1.1.3
33
Authors@R:
44
c(person(given = "Giulio", family = "Benedetti", role = c("aut", "cre"),
55
email = "giulio.benedetti@utu.fi",
@@ -10,7 +10,7 @@ Authors@R:
1010
person(given = "Leo", family = "Lahti", role = c("aut"),
1111
email = "leo.lahti@iki.fi",
1212
comment = c(ORCID = "0000-0001-5537-637X")))
13-
Title: Shiny app for the interactive analysis and exploration of microbiome data
13+
Title: Dashboard for the interactive analysis and exploration of microbiome data
1414
Description:
1515
miaDash provides a Graphical User Interface for the exploration of
1616
microbiome data. This way, no knowledge of programming is required to
@@ -30,6 +30,7 @@ Imports:
3030
mia,
3131
rintrojs,
3232
scater,
33+
scuttle,
3334
shinydashboard,
3435
shinyjs,
3536
S4Vectors,

NAMESPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ importFrom(iSEEtree,RowGraphPlot)
2626
importFrom(iSEEtree,RowTreePlot)
2727
importFrom(iSEEtree,ScreePlot)
2828
importFrom(mia,addAlpha)
29+
importFrom(mia,addHierarchyTree)
30+
importFrom(mia,addPrevalence)
31+
importFrom(mia,addPrevalentAbundance)
2932
importFrom(mia,agglomerateByRank)
3033
importFrom(mia,getDissimilarity)
3134
importFrom(mia,importBIOM)
@@ -42,6 +45,7 @@ importFrom(mia,transformAssay)
4245
importFrom(rintrojs,introjs)
4346
importFrom(scater,runMDS)
4447
importFrom(scater,runPCA)
48+
importFrom(scuttle,addPerCellQC)
4549
importFrom(shinydashboard,box)
4650
importFrom(shinydashboard,dashboardBody)
4751
importFrom(shinydashboard,dashboardHeader)

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Changes in version 1.1.3
2+
* Introduced tab for Quality Control
3+
14
Changes in version 1.1.2
25
* Added importers for HUMAnN, QIIME2 and Mothur
36
* Improved biom importer

R/constants.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,9 @@ NULL
5050

5151
#' @rdname constants
5252
.betaMethods <- c("MDS", "NMDS", "PCA", "RDA")
53-
#"TSNE", "UMAP")
53+
#"TSNE", "UMAP")
54+
55+
#' @rdname constants
56+
.qualityMetrics <- list("Library size" = "PerCellQC",
57+
"Prevalence" = "Prevalence", "Prevalent abundance" = "PrevalentAbundance",
58+
"Hierarchy tree" = "HierarchyTree")

R/landing_page.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,17 @@
180180
header = tagList(
181181
br(), selectInput(inputId = "estimate.assay",
182182
label = "Assay:", choices = NULL)),
183+
184+
tabPanel(title = "Quality", value = "quality",
185+
186+
checkboxGroupInput(inputId = "quality.metrics",
187+
label = "Metrics:",
188+
choices = .qualityMetrics)),
183189

184190
tabPanel(title = "Alpha", value = "alpha",
185191

186192
selectInput(inputId = "alpha.index",
187-
label = "Metric:", multiple = TRUE,
193+
label = "Metrics:", multiple = TRUE,
188194
choices = .alphaMetrics)),
189195

190196
tabPanel(title = "Beta", value = "beta",

R/observers.R

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,31 +212,51 @@
212212

213213
#' @rdname create_observers
214214
#' @importFrom stats as.formula
215-
#' @importFrom mia addAlpha runNMDS runRDA getDissimilarity
215+
#' @importFrom mia addAlpha runNMDS runRDA getDissimilarity addHierarchyTree
216+
#' addPrevalence addPrevalentAbundance
216217
#' @importFrom TreeSummarizedExperiment rowTree
217218
#' @importFrom scater runMDS runPCA
219+
#' @importFrom scuttle addPerCellQC
218220
#' @importFrom vegan vegdist
219221
.create_estimate_observers <- function(input, rObjects) {
220222

221223
# nocov start
222224
observeEvent(input$compute, {
223225

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+
226246
if( is.null(input$alpha.index) ){
227247
.print_message("Please select one or more metrics.")
228248
return()
229249
}
230250

231251
isolate({
232252
req(input$estimate.assay)
233-
253+
234254
if( input$estimate.name != "" ){
235255
name <- input$estimate.name
236256
} else {
237257
name <- input$alpha.index
238258
}
239-
259+
240260
fun_args <- list(x = rObjects$tse, name = name,
241261
assay.type = input$estimate.assay, index = input$alpha.index)
242262

@@ -338,9 +358,6 @@
338358
updateSelectInput(session, inputId = "estimate.assay",
339359
choices = assayNames(rObjects$tse))
340360

341-
updateSelectInput(session, inputId = "estimate.assay",
342-
choices = assayNames(rObjects$tse))
343-
344361
updateNumericInput(session, inputId = "ncomponents",
345362
max = nrow(rObjects$tse) - 1)
346363

R/utils.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ NULL
6161
}
6262

6363
#' @rdname utils
64-
.update_tse <- function(tse, fun, fun.args) {
64+
.update_tse <- function(tse, fun, fun.args = list()) {
6565

6666
tse <- tryCatch({withCallingHandlers({
6767

@@ -119,6 +119,8 @@ NULL
119119
}
120120

121121
#' @importFrom mia importBIOM
122+
#' @importFrom SummarizedExperiment colData
123+
#' @importFrom TreeSummarizedExperiment rowTree
122124
#' @importFrom S4Vectors DataFrame
123125
#' @importFrom ape read.tree
124126
#' @importFrom utils read.table

man/constants.Rd

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/utils.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)