Skip to content

Examples #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 17, 2025
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
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(.check_all_panels)
export(.check_panel)
export(AbundanceDensityPlot)
export(AbundancePlot)
export(ColumnGraphPlot)
Expand Down
3 changes: 2 additions & 1 deletion R/class-AbundanceDensityPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#' \item \code{order_descending}, a string specifying the descending order.
#' }
#'
#' In addition, this class inherits all slots from its parent \linkS4class{Panel} class.
#' In addition, this class inherits all slots from its parent class
#' \code{\link[iSEE:Panel-class]{Panel}}.
#'
#' @return
#' The \code{AbundanceDensityPlot(...)} constructor creates an instance of an
Expand Down
3 changes: 2 additions & 1 deletion R/class-AbundancePlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#' \item \code{add_legend}, a logical indicating if the color legend should appear.
#' }
#'
#' In addition, this class inherits all slots from its parent \linkS4class{Panel} class.
#' In addition, this class inherits all slots from its parent class
#' \code{\link[iSEE:Panel-class]{Panel}}.
#'
#' @return
#' The \code{AbundancePlot(...)} constructor creates an instance of an
Expand Down
3 changes: 2 additions & 1 deletion R/class-LoadingPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#' \item \code{add.tree}, a logical indicating whether the tree should be shown.
#' }
#'
#' In addition, this class inherits all slots from its parent \linkS4class{Panel} class.
#' In addition, this class inherits all slots from its parent class
#' \code{\link[iSEE:Panel-class]{Panel}}.
#'
#' @return
#' The \code{LoadingPlot(...)} constructor creates an instance of an
Expand Down
3 changes: 2 additions & 1 deletion R/class-RDAPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
#' on the coordinate axes.
#' }
#'
#' In addition, this class inherits all slots from its parent \linkS4class{Panel} class.
#' In addition, this class inherits all slots from its parent class
#' \code{\link[iSEE:Panel-class]{Panel}}.
#'
#' @return
#' The \code{RDAPlot(...)} constructor creates an instance of a RDAPlot class,
Expand Down
4 changes: 2 additions & 2 deletions R/class-ScreePlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
#' (Default: \code{c("eig", "varExplained")})
#' }
#'
#' In addition, this class inherits all slots from its parent
#' \linkS4class{Panel} class.
#' In addition, this class inherits all slots from its parent class
#' \code{\link[iSEE:Panel-class]{Panel}}.
#'
#' @return
#' The \code{ScreePlot(...)} constructor creates an instance of an ScreePlot
Expand Down
2 changes: 1 addition & 1 deletion R/family-GraphPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#' }
#'
#' In addition, this class inherits all slots from its parent class
#' \linkS4class{Panel}.
#' \code{\link[iSEE:Panel-class]{Panel}}.
#'
#' @seealso
#' \linkS4class{RowGraphPlot}
Expand Down
2 changes: 1 addition & 1 deletion R/family-TreePlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#' }
#'
#' In addition, this class inherits all slots from its parent
#' \linkS4class{Panel} class.
#' \code{\link[iSEE:Panel-class]{Panel}}.
#'
#' @seealso
#' \linkS4class{RowTreePlot}
Expand Down
35 changes: 2 additions & 33 deletions R/iSEE-default.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,48 +51,17 @@ setGeneric("iSEE", iSEE::iSEE)
#' @export
#' @importFrom iSEE createLandingPage ExperimentColorMap ReducedDimensionPlot
#' ComplexHeatmapPlot RowDataTable ColumnDataTable
#' @importFrom TreeSummarizedExperiment TreeSummarizedExperiment rowLinks
#' colLinks
#' @importFrom SingleCellExperiment reducedDims
#' @importFrom S4Vectors metadata
#' @importFrom SummarizedExperiment rowData colData
#' @importFrom mia taxonomyRanks
setMethod("iSEE", "TreeSummarizedExperiment",
function(se, initial = c(RowDataTable(), ColumnDataTable(), RowTreePlot(),
AbundancePlot(), AbundanceDensityPlot(), ReducedDimensionPlot(),
ComplexHeatmapPlot()), extra = NULL, colormap = ExperimentColorMap(),
landingPage = createLandingPage(), tour = NULL, appTitle = NULL,
runLocal = TRUE, voice = FALSE, bugs = FALSE, saveState = NULL, ...) {

initial <- .check_panel(se, initial, "RowDataTable", rowData)
initial <- .check_panel(se, initial, "ColumnDataTable", colData)
initial <- .check_panel(se, initial, "RowTreePlot", rowLinks)
initial <- .check_panel(se, initial, "ColumnTreePlot", colLinks)
initial <- .check_panel(se, initial, "AbundancePlot", taxonomyRanks)
initial <- .check_panel(se, initial, "ReducedDimensionPlot", reducedDims)
initial <- .check_panel(se, initial, "LoadingPlot", reducedDims)
initial <- .check_panel(se, initial, "ScreePlot", reducedDims)
initial <- .check_panel(se, initial, "RDAPlot", reducedDims)
initial <- .check_panel(se, initial, "RowGraphPlot", metadata)
initial <- .check_panel(se, initial, "ColumnGraphPlot", metadata)
initial <- .check_all_panels(se, initial)

iSEE::iSEE(se, initial = initial, extra = initial, colormap = colormap,
landingPage = landingPage, tour = tour, appTitle = appTitle,
runLocal = runLocal, voice = voice, bugs = bugs,
saveState = saveState, ...)
})

#' @importFrom S4Vectors isEmpty
#' @importFrom methods is
.check_panel <- function(se, panel_list, panel_class, panel_fun, wtext) {

no_keep <- unlist(lapply(panel_list, function(x) is(x, panel_class)))

if( any(no_keep) && (is.null(panel_fun(se)) || isEmpty(panel_fun(se))) ){
panel_list <- panel_list[!no_keep]
warning("no valid ", as.character(substitute(panel_fun)),
" fields for ", panel_class, call. = FALSE)
}

return(panel_list)
}
})
4 changes: 2 additions & 2 deletions R/iSEEtree-package.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' iSEE extension for the TreeSummarizedExperiment container
#'
#' `iSEEtree` is an extension of \pkg{iSEE} that provides panels for the
#' \code{iSEEtree} is an extension of \pkg{iSEE} that provides panels for the
#' \code{\link[TreeSummarizedExperiment:TreeSummarizedExperiment-constructor]{TreeSummarizedExperiment}}
#' container, enabling the interactive visualisation of typical microbiome data.
#' The panel layout of iSEEtree is described in \code{\link{iSEE}}.
Expand All @@ -14,6 +14,6 @@
#'
#' @docType package
#' @keywords internal
#' @name iSEEtree
#' @name iSEEtree-package
#'
"_PACKAGE"
89 changes: 89 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#' iSEEtree utils
#'
#' Utility functions to check the existence of specific elements in a
#' \code{\link[TreeSummarizedExperiment:TreeSummarizedExperiment-constructor]{TreeSummarizedExperiment}}
#' that are compulsory when using certain panels.
#'
#' @param se a
#' \code{\link[SummarizedExperiment:SummarizedExperiment-class]{SummarizedExperiment}}
#' object.
#'
#' @param initial \code{Panel vector}. A list of panel objects to check.
#'
#' @param panel.class \code{Character vector}. A list of panel names
#' corresponding to panel objects in \code{initial}.
#'
#' @param panel.fun \code{Function scalar}. The element of \code{se} whose
#' existance should be checked.
#'
#' @param wtext \code{Character scalar}. Text of the warning message returned
#' if \code{panel.fun} does not exist or is empty.
#'
#' @return
#' \code{.check_panel} returns the input \code{initial} list of panels excluding
#' the checked panel if \code{panel.fun} is \code{NULL} or empty.
#' \code{.check_all_panels} applies \code{.check_panel} to multiple panels and
#' returns the a filtered version of \code{initial}.
#'
#' @examples
#' # Import libraries
#' library(mia)
#' library(TreeSummarizedExperiment)
#'
#' # Import TreeSE
#' data("Tengeler2020", package = "mia")
#' tse <- Tengeler2020
#'
#' # Create list of panels
#' initial <- c(RowTreePlot(), ColumnTreePlot())
#' # If RowTreePlot is in initial, check whether rowLinks is defined
#' initial <- .check_panel(tse, initial, "RowTreePlot", rowLinks)
#' # If ColumnTreePlot is in initial, check whether colLinks is defined
#' initial <- .check_panel(tse, initial, "ColumnTreePlot", colLinks)
#'
#' # View filtered list of panels
#' initial
#'
#' @keywords internal
#' @name utils
NULL

#' @rdname utils
#' @export
#' @importFrom TreeSummarizedExperiment TreeSummarizedExperiment rowLinks
#' colLinks
#' @importFrom SingleCellExperiment reducedDims
#' @importFrom S4Vectors metadata
#' @importFrom SummarizedExperiment rowData colData
#' @importFrom mia taxonomyRanks
.check_all_panels <- function(se, initial){
initial <- .check_panel(se, initial, "RowDataTable", rowData)
initial <- .check_panel(se, initial, "ColumnDataTable", colData)
initial <- .check_panel(se, initial, "RowTreePlot", rowLinks)
initial <- .check_panel(se, initial, "ColumnTreePlot", colLinks)
initial <- .check_panel(se, initial, "AbundancePlot", taxonomyRanks)
initial <- .check_panel(se, initial, "ReducedDimensionPlot", reducedDims)
initial <- .check_panel(se, initial, "LoadingPlot", reducedDims)
initial <- .check_panel(se, initial, "ScreePlot", reducedDims)
initial <- .check_panel(se, initial, "RDAPlot", reducedDims)
initial <- .check_panel(se, initial, "RowGraphPlot", metadata)
initial <- .check_panel(se, initial, "ColumnGraphPlot", metadata)
return(initial)
}

#' @rdname utils
#' @export
#' @importFrom S4Vectors isEmpty
#' @importFrom methods is
.check_panel <- function(se, initial, panel.class, panel.fun, wtext) {

no_keep <- unlist(lapply(initial, function(x) is(x, panel.class)))

if( any(no_keep) && (is.null(panel.fun(se)) || isEmpty(panel.fun(se))) ){
initial <- initial[!no_keep]
warning("no valid ", as.character(substitute(panel.fun)),
" fields for ", panel.class, call. = FALSE)
}

return(initial)
}
20 changes: 20 additions & 0 deletions inst/CITATION
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
citHeader("To cite iSEEtree in publications use:")

citEntry(
entry = "Article",
title = "iSEEtree: interactive explorer for hierarchical data",
author = personList(
as.person("Giulio Benedetti"),
as.person("Ely Seraidarian"),
as.person("Theotime Pralas"),
as.person("Akewak Jeba"),
as.person("Tuomas Borman"),
as.person("Leo Lahti")
),
journal = "arXiv",
year = "2024",
url = "https://arxiv.org/abs/2412.02882",
textVersion = paste("Benedetti, G., Seraidarian, E., Pralas, T., Jeba, A.",
"Borman, T., & Lahti, L. (2024). iSEEtree: interactive explorer for",
"hierarchical data. arXiv. doi: https://doi.org/10.48550/arXiv.2412.02882")
)
45 changes: 45 additions & 0 deletions inst/REFERENCES.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@Manual{core2024r,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2024},
url = {https://www.R-project.org/},
}

@article{rue2018isee,
title={{iSEE: interactive SummarizedExperiment explorer}},
author={Rue-Albrecht, Kevin and Marini, Federico and Soneson, Charlotte and Lun, Aaron TL},
journal={F1000Research},
volume={7},
year={2018},
publisher={Faculty of 1000 Ltd},
doi={10.12688/f1000research.14966.1}
}

@Manual{chang2024shiny,
title = {shiny: Web Application Framework for R},
author = {Winston Chang and Joe Cheng and JJ Allaire and Carson Sievert and Barret Schloerke and Yihui Xie and Jeff Allen and Jonathan McPherson and Alan Dipert and Barbara Borges},
year = {2024},
note = {R package version 1.9.1},
url = {https://CRAN.R-project.org/package=shiny},
}

@Manual{borman2024mia,
title = {mia: Microbiome analysis},
author = {Tuomas Borman and Felix G.M. Ernst and Sudarshan A. Shetty and Leo Lahti},
year = {2024},
note = {R package version 1.14.0},
url = {https://bioconductor.org/packages/mia},
doi = {10.18129/B9.bioc.mia},
}

@article{huang2021treesummarizedexperiment,
title={{TreeSummarizedExperiment: a S4 class for data with hierarchical structure}},
author={Huang, Ruizhu and Soneson, Charlotte and Ernst, Felix GM and Rue-Albrecht, Kevin C and Yu, Guangchuang and Hicks, Stephanie C and Robinson, Mark D},
journal={F1000Research},
volume={9},
year={2021},
publisher={Faculty of 1000 Ltd},
doi={10.12688/f1000research.26669.2}
}
3 changes: 2 additions & 1 deletion man/AbundanceDensityPlot.Rd

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

3 changes: 2 additions & 1 deletion man/AbundancePlot.Rd

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

2 changes: 1 addition & 1 deletion man/GraphPlot.Rd

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

3 changes: 2 additions & 1 deletion man/LoadingPlot.Rd

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

3 changes: 2 additions & 1 deletion man/RDAPlot.Rd

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

4 changes: 2 additions & 2 deletions man/ScreePlot.Rd

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

2 changes: 1 addition & 1 deletion man/TreePlot.Rd

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

4 changes: 2 additions & 2 deletions man/iSEEtree.Rd → man/iSEEtree-package.Rd

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

Loading
Loading