Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: miaDash
Version: 1.1.4
Version: 1.1.5
Authors@R:
c(person(given = "Giulio", family = "Benedetti", role = c("aut", "cre"),
email = "giulio.benedetti@utu.fi",
Expand All @@ -25,6 +25,7 @@ Depends:
shiny
Imports:
ape,
bluster,
htmltools,
iSEEtree (>= 1.1.4),
mia,
Expand All @@ -50,6 +51,6 @@ Suggests:
URL: https://github.com/microbiome/miaDash
BugReports: https://github.com/microbiome/miaDash/issues
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
VignetteBuilder: knitr
Config/testthat/edition: 3
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ importFrom(SummarizedExperiment,rowData)
importFrom(TreeSummarizedExperiment,TreeSummarizedExperiment)
importFrom(TreeSummarizedExperiment,rowTree)
importFrom(ape,read.tree)
importFrom(bluster,DmmParam)
importFrom(bluster,HclustParam)
importFrom(bluster,KmeansParam)
importFrom(bluster,NNGraphParam)
importFrom(htmltools,HTML)
importFrom(htmltools,br)
importFrom(htmltools,div)
Expand All @@ -27,6 +31,7 @@ importFrom(iSEEtree,RowGraphPlot)
importFrom(iSEEtree,RowTreePlot)
importFrom(iSEEtree,ScreePlot)
importFrom(mia,addAlpha)
importFrom(mia,addCluster)
importFrom(mia,addHierarchyTree)
importFrom(mia,addPrevalence)
importFrom(mia,addPrevalentAbundance)
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Changes in version 1.1.5
* Added Cluster tab

Changes in version 1.1.4
* Switch from csv to tsv support
* Improve interoperability with MGnify datasets
Expand Down
15 changes: 11 additions & 4 deletions R/constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
#' @keywords internal
#' @name constants
#' @aliases .miaDashDefaultPanels .miaDashOtherPanels .transformMethods
#' .alphaMetrics .betaMetrics .betaMethods .qualityMetrics
#' .qualityMetrics .alphaMetrics .betaMetrics .betaMethods .clustMethods
#' .DmmCriteria
NULL

#' @rdname constants
Expand All @@ -36,6 +37,11 @@ NULL
"hellinger", "log", "log10", "log2", "max", "normalize", "pa",# "philr",
"range", "rank", "rclr", "relabundance", "rrank", "standardize", "total")

#' @rdname constants
.qualityMetrics <- list("Library size" = "PerCellQC",
"Prevalence" = "Prevalence", "Prevalent abundance" = "PrevalentAbundance",
"Hierarchy tree" = "HierarchyTree")

#' @rdname constants
.alphaMetrics <- c("coverage_diversity", "fisher_diversity", "faith_diversity",
"gini_simpson_diversity", "inverse_simpson_diversity",
Expand All @@ -54,6 +60,7 @@ NULL
#"TSNE", "UMAP")

#' @rdname constants
.qualityMetrics <- list("Library size" = "PerCellQC",
"Prevalence" = "Prevalence", "Prevalent abundance" = "PrevalentAbundance",
"Hierarchy tree" = "HierarchyTree")
.clustMethods <- c("Dmm", "Hclust", "Kmeans", "NNGraph")

#' @rdname constants
.DmmCriteria <- c("laplace", "AIC", "BIC")
54 changes: 50 additions & 4 deletions R/landing_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,26 @@
div(style = "margin-top: -20px"),

conditionalPanel(
condition = "input.ftype == 'Mothur' | input.ftype == 'QIIME2'",
condition = paste0("input.ftype == 'Mothur' | ",
"input.ftype == 'QIIME2'"),

fileInput(inputId = "f.rowdata",
label = "rowData:", accept = c(".taxonomy",
".qza"), placeholder = "taxonomy or qza"),
div(style = "margin-top: -20px")),

conditionalPanel(
condition = "input.ftype == 'biom' | input.ftype == 'MetaPhlAn'",
condition = paste0("input.ftype == 'biom' | ",
"input.ftype == 'MetaPhlAn'"),

fileInput(inputId = "tree.file",
label = "rowTree:", placeholder = "tree.tree",
accept = c(".tree", ".tre", ".qza")),
div(style = "margin-top: -20px")),

conditionalPanel(
condition = "input.ftype == 'biom' | input.ftype == 'HUMAnN'",
condition = paste0("input.ftype == 'biom' | ",
"input.ftype == 'HUMAnN'"),

checkboxInput(inputId = "rm.tax.pref",
label = "Remove taxa prefixes")),
Expand Down Expand Up @@ -204,7 +207,7 @@
inline = TRUE),

conditionalPanel(
condition = paste("input.bmethod == 'MDS' || ",
condition = paste0("input.bmethod == 'MDS' || ",
"input.bmethod == 'NMDS' || ",
"input.bmethod == 'RDA'"),

Expand All @@ -222,6 +225,49 @@
label = "Number of components:", min = 1,
step = 1)),

tabPanel(title = "Cluster", value = "cluster",

radioButtons(inputId = "cmethod",
label = "Method:", choices = .clustMethods,
inline = TRUE),

conditionalPanel(
condition = paste0("input.cmethod == 'Dmm' | ",
"input.cmethod == 'Kmeans'"),

numericInput(inputId = "kclusters", value = 3,
label = "Number of clusters:", min = 1,
step = 1)),

conditionalPanel(
condition = "input.cmethod == 'Dmm'",

selectInput(inputId = "dmm.type",
label = "Criterion:",
choices = .DmmCriteria,
selected = .DmmCriteria[1]),

numericInput(inputId = "dmm.seed", value = 1L,
label = "Seed:", min = 0, step = 1)),

conditionalPanel(
condition = "input.cmethod == 'NNGraph'",

numericInput(inputId = "kneighbours",
value = 10, label = "Number of neighbours:",
min = 1, step = 1),

checkboxInput(inputId = "nn.shared",
label = "Construct shared graph")),

checkboxInput(inputId = "clust.full",
label = "Add to metadata"),

radioButtons(inputId = "clust.margin",
label = "Margin:", inline = TRUE,
choices = c("samples", "features"),
selected = "features")),

footer = textInput(inputId = "estimate.name",
label = "Name:")),

Expand Down
54 changes: 50 additions & 4 deletions R/observers.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
rObjects$tse <- .update_tse(
rObjects$tse, TreeSummarizedExperiment, fun_args
)
print(input$taxa.from.rownames)

if( input$taxa.from.rownames ){

rObjects$tse <- .update_tse(
Expand Down Expand Up @@ -223,11 +223,12 @@
#' @rdname create_observers
#' @importFrom stats as.formula
#' @importFrom mia addAlpha runNMDS runRDA getDissimilarity addHierarchyTree
#' addPrevalence addPrevalentAbundance
#' addPrevalence addPrevalentAbundance addCluster
#' @importFrom TreeSummarizedExperiment rowTree
#' @importFrom scater runMDS runPCA
#' @importFrom scuttle addPerCellQC
#' @importFrom vegan vegdist
#' @importFrom bluster KmeansParam DmmParam HclustParam NNGraphParam
.create_estimate_observers <- function(input, rObjects) {

# nocov start
Expand Down Expand Up @@ -295,7 +296,8 @@
name <- input$bmethod
}

beta_args <- list(x = rObjects$tse, assay.type = input$assay.type,
beta_args <- list(x = rObjects$tse,
assay.type = input$estimate.assay,
ncomponents = input$ncomponents, name = name)

if( input$beta.index == "unifrac" ){
Expand Down Expand Up @@ -329,14 +331,58 @@

beta_args <- c(beta_args,
formula = as.formula(input$rda.formula))

}

beta_fun <- eval(parse(text = paste0("run", input$bmethod)))

rObjects$tse <- .update_tse(rObjects$tse, beta_fun, beta_args)
})

}else if( input$estimate == "cluster" ){

isolate({
req(input$estimate.assay)

if( input$estimate.name != "" ){
name <- input$estimate.name
}else{
name <- "clusters"
}

if( input$cmethod == "Dmm" ){

blus_params <- list(k = input$kclusters,
type = deparse(input$dmm.type))#, seed = input$dmm.seed)

}else if( input$cmethod == "Hclust" ){

blus_params <- list()

}else if( input$cmethod == "Kmeans" ){

blus_params <- list(centers = input$kclusters)

}else if( input$cmethod == "NNGraph" ){

blus_params <- list(shared = input$nn.shared,
k = input$kneighbours)

}

blus_params <- sprintf("%s=%s", names(blus_params), blus_params)
blus_params <- paste(blus_params, collapse = ", ")
blus_fun <- sprintf("%sParam(%s)", input$cmethod, blus_params)

clust_args <- list(x = rObjects$tse,
assay.type = input$estimate.assay,
by = input$clust.margin, full = input$clust.full,
BLUSPARAM = eval(parse(text = blus_fun)),
name = name, clust.col = name)

rObjects$tse <- .update_tse(
rObjects$tse, addCluster, clust_args)
})

}

}, ignoreInit = TRUE, ignoreNULL = TRUE)
Expand Down
16 changes: 13 additions & 3 deletions man/constants.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading