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
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: miaDash
Version: 1.1.3
Version: 1.1.4
Authors@R:
c(person(given = "Giulio", family = "Benedetti", role = c("aut", "cre"),
email = "giulio.benedetti@utu.fi",
Expand Down Expand Up @@ -33,6 +33,7 @@ Imports:
scuttle,
shinydashboard,
shinyjs,
shinyWidgets,
S4Vectors,
SingleCellExperiment,
SummarizedExperiment,
Expand Down
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ importFrom(S4Vectors,DataFrame)
importFrom(SummarizedExperiment,assay)
importFrom(SummarizedExperiment,assayNames)
importFrom(SummarizedExperiment,colData)
importFrom(SummarizedExperiment,rowData)
importFrom(TreeSummarizedExperiment,TreeSummarizedExperiment)
importFrom(TreeSummarizedExperiment,rowTree)
importFrom(ape,read.tree)
Expand All @@ -31,6 +32,7 @@ importFrom(mia,addPrevalence)
importFrom(mia,addPrevalentAbundance)
importFrom(mia,agglomerateByRank)
importFrom(mia,getDissimilarity)
importFrom(mia,getTaxonomyLabels)
importFrom(mia,importBIOM)
importFrom(mia,importHUMAnN)
importFrom(mia,importMetaPhlAn)
Expand All @@ -46,6 +48,7 @@ importFrom(rintrojs,introjs)
importFrom(scater,runMDS)
importFrom(scater,runPCA)
importFrom(scuttle,addPerCellQC)
importFrom(shinyWidgets,addSpinner)
importFrom(shinydashboard,box)
importFrom(shinydashboard,dashboardBody)
importFrom(shinydashboard,dashboardHeader)
Expand All @@ -56,6 +59,5 @@ importFrom(shinyjs,enable)
importFrom(stats,as.formula)
importFrom(utils,data)
importFrom(utils,packageVersion)
importFrom(utils,read.csv)
importFrom(utils,read.table)
importFrom(vegan,vegdist)
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Changes in version 1.1.4
* Switch from csv to tsv support
* Improve interoperability with MGnify datasets

Changes in version 1.1.3
* Introduced tab for Quality Control

Expand Down
3 changes: 2 additions & 1 deletion R/constants.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
#' \item{\code{.alphaMetrics}}{List of alpha diversity metrics.}
#' \item{\code{.betaMetrics}}{List of beta diversity metrics.}
#' \item{\code{.betaMethods}}{List of beta diversity methods.}
#' \item{\code{.qualityMetrics}}{List of metrics for quality control.}
#' }
#'
#' @author Giulio Benedetti
#'
#' @keywords internal
#' @name constants
#' @aliases .miaDashDefaultPanels .miaDashOtherPanels .transformMethods
#' .alphaMetrics .betaMetrics .betaMethods
#' .alphaMetrics .betaMetrics .betaMethods .qualityMetrics
NULL

#' @rdname constants
Expand Down
17 changes: 11 additions & 6 deletions R/landing_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#' dashboardBody box
#' @importFrom htmltools HTML br tags div tagList
#' @importFrom shinyjs disable
#' @importFrom shinyWidgets addSpinner
#' @importFrom utils data
.landing_page <- function(FUN, input, output, session) {

Expand Down Expand Up @@ -49,16 +50,16 @@
tabPanel(title = "Raw Data", value = "raw", br(),

fileInput(inputId = "assay", label = "Assays:",
accept = ".csv", multiple = TRUE,
placeholder = "assay.csv"),
accept = ".tsv", multiple = TRUE,
placeholder = "assay.tsv"),
div(style = "margin-top: -20px"),

fileInput(inputId = "coldata", label = "colData:",
accept = ".csv", placeholder = "coldata.csv"),
accept = ".tsv", placeholder = "coldata.tsv"),
div(style = "margin-top: -20px"),

fileInput(inputId = "rowdata", label = "rowData:",
accept = ".csv", placeholder = "rowdata.csv"),
accept = ".tsv", placeholder = "rowdata.tsv"),
div(style = "margin-top: -20px"),

fileInput(inputId = "row.tree",
Expand All @@ -69,7 +70,10 @@
fileInput(inputId = "col.tree",
label = "colTree:", placeholder = "col.tree",
accept = c(".tree", ".tre")),
div(style = "margin-top: -20px")),
div(style = "margin-top: -20px"),

checkboxInput(inputId = "taxa.from.rownames",
label = "Derive rowData from assay rownames")),

tabPanel(title = "Foreign", value = "foreign", br(),

Expand Down Expand Up @@ -237,7 +241,8 @@
box(id = "output.panel", title = "Output", width = 8,
status = "primary", solidHeader = TRUE, collapsible = TRUE,

verbatimTextOutput(outputId = "object"),
addSpinner(verbatimTextOutput(outputId = "object"),
color = "#007bff"),

downloadButton(outputId = "download", label = "Download",
class = "btn-primary")))))})
Expand Down
22 changes: 16 additions & 6 deletions R/observers.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' @keywords internal

#' @rdname create_observers
#' @importFrom utils read.csv
#' @importFrom utils read.table
#' @importFrom ape read.tree
#' @importFrom S4Vectors DataFrame
#' @importFrom mia importHUMAnN importMetaPhlAn importQIIME2 importMothur
Expand All @@ -40,18 +40,20 @@

isolate({
req(input$assay)

assay_list <- lapply(input$assay$datapath,
function(x) as.matrix(read.csv(x, row.names = 1)))
function(x) as.matrix(read.table(x, row.names = 1,
header = TRUE, sep = "\t")))

names(assay_list) <- gsub(".csv", "", input$assay$name)
names(assay_list) <- gsub(".tsv", "", input$assay$name)

coldata <- .set_optarg(input$coldata$datapath,
alternative = DataFrame(row.names = colnames(assay_list[[1]])),
loader = read.csv, row.names = 1)
loader = read.table, row.names = 1, header = TRUE, sep = "\t")

rowdata <- .set_optarg(input$rowdata$datapath,
loader = read.csv, row.names = 1)
loader = read.table, row.names = 1,
header = TRUE, sep = "\t")

row.tree <- .set_optarg(input$row.tree$datapath,
loader = read.tree)
Expand All @@ -65,6 +67,14 @@
rObjects$tse <- .update_tse(
rObjects$tse, TreeSummarizedExperiment, fun_args
)
print(input$taxa.from.rownames)
if( input$taxa.from.rownames ){

rObjects$tse <- .update_tse(
rObjects$tse, .rownames2taxa, list(x = rObjects$tse)
)

}

})

Expand Down
21 changes: 21 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ NULL
return(cond)
}

#' @rdname utils
#' @importFrom mia importBIOM
#' @importFrom SummarizedExperiment colData
#' @importFrom TreeSummarizedExperiment rowTree
Expand All @@ -139,4 +140,24 @@ NULL
}

return(tse)
}

#' @rdname utils
#' @importFrom SummarizedExperiment rowData
#' @importFrom S4Vectors DataFrame
#' @importFrom mia getTaxonomyLabels
.rownames2taxa <- function(x){

tax_df <- data.frame(Taxonomy = rownames(x))

rowdata <- mia:::.parse_taxonomy(
tax_df,
col.name = "Taxonomy",
removeTaxaPrefixes = TRUE
)

rowData(x) <- DataFrame(rowdata)
rownames(x) <- getTaxonomyLabels(x, make.unique = TRUE)

return(x)
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ manipulate, analyse and visualise TreeSummarizedExperiment objects.

miaDash is available online at [this address](https://miadash-microbiome.2.rahtiapp.fi/).
While suitable for small and medium datasets, the online version may slow down
when larger datasets are analysed (> 1000 features). In this case, the app can
when larger datasets are analysed (> 500 samples). In this case, the app can
be installed and run locally. Either way, functionality to subset and
agglomerate the data is also provided in the app.

Expand Down
1 change: 1 addition & 0 deletions man/constants.Rd

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

6 changes: 6 additions & 0 deletions man/utils.Rd

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

Loading