Skip to content

Commit da0700c

Browse files
authored
Merge pull request #45 from microbiome/examples
Examples
2 parents c2698ea + 25bcbbe commit da0700c

25 files changed

+401
-137
lines changed

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
export(.check_all_panels)
4+
export(.check_panel)
35
export(AbundanceDensityPlot)
46
export(AbundancePlot)
57
export(ColumnGraphPlot)

R/class-AbundanceDensityPlot.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
#' \item \code{order_descending}, a string specifying the descending order.
1616
#' }
1717
#'
18-
#' In addition, this class inherits all slots from its parent \linkS4class{Panel} class.
18+
#' In addition, this class inherits all slots from its parent class
19+
#' \code{\link[iSEE:Panel-class]{Panel}}.
1920
#'
2021
#' @return
2122
#' The \code{AbundanceDensityPlot(...)} constructor creates an instance of an

R/class-AbundancePlot.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
#' \item \code{add_legend}, a logical indicating if the color legend should appear.
1414
#' }
1515
#'
16-
#' In addition, this class inherits all slots from its parent \linkS4class{Panel} class.
16+
#' In addition, this class inherits all slots from its parent class
17+
#' \code{\link[iSEE:Panel-class]{Panel}}.
1718
#'
1819
#' @return
1920
#' The \code{AbundancePlot(...)} constructor creates an instance of an

R/class-LoadingPlot.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
#' \item \code{add.tree}, a logical indicating whether the tree should be shown.
1515
#' }
1616
#'
17-
#' In addition, this class inherits all slots from its parent \linkS4class{Panel} class.
17+
#' In addition, this class inherits all slots from its parent class
18+
#' \code{\link[iSEE:Panel-class]{Panel}}.
1819
#'
1920
#' @return
2021
#' The \code{LoadingPlot(...)} constructor creates an instance of an

R/class-RDAPlot.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
#' on the coordinate axes.
3131
#' }
3232
#'
33-
#' In addition, this class inherits all slots from its parent \linkS4class{Panel} class.
33+
#' In addition, this class inherits all slots from its parent class
34+
#' \code{\link[iSEE:Panel-class]{Panel}}.
3435
#'
3536
#' @return
3637
#' The \code{RDAPlot(...)} constructor creates an instance of a RDAPlot class,

R/class-ScreePlot.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
#' (Default: \code{c("eig", "varExplained")})
4646
#' }
4747
#'
48-
#' In addition, this class inherits all slots from its parent
49-
#' \linkS4class{Panel} class.
48+
#' In addition, this class inherits all slots from its parent class
49+
#' \code{\link[iSEE:Panel-class]{Panel}}.
5050
#'
5151
#' @return
5252
#' The \code{ScreePlot(...)} constructor creates an instance of an ScreePlot

R/family-GraphPlot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#' }
3636
#'
3737
#' In addition, this class inherits all slots from its parent class
38-
#' \linkS4class{Panel}.
38+
#' \code{\link[iSEE:Panel-class]{Panel}}.
3939
#'
4040
#' @seealso
4141
#' \linkS4class{RowGraphPlot}

R/family-TreePlot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#' }
4242
#'
4343
#' In addition, this class inherits all slots from its parent
44-
#' \linkS4class{Panel} class.
44+
#' \code{\link[iSEE:Panel-class]{Panel}}.
4545
#'
4646
#' @seealso
4747
#' \linkS4class{RowTreePlot}

R/iSEE-default.R

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -51,48 +51,17 @@ setGeneric("iSEE", iSEE::iSEE)
5151
#' @export
5252
#' @importFrom iSEE createLandingPage ExperimentColorMap ReducedDimensionPlot
5353
#' ComplexHeatmapPlot RowDataTable ColumnDataTable
54-
#' @importFrom TreeSummarizedExperiment TreeSummarizedExperiment rowLinks
55-
#' colLinks
56-
#' @importFrom SingleCellExperiment reducedDims
57-
#' @importFrom S4Vectors metadata
58-
#' @importFrom SummarizedExperiment rowData colData
59-
#' @importFrom mia taxonomyRanks
6054
setMethod("iSEE", "TreeSummarizedExperiment",
6155
function(se, initial = c(RowDataTable(), ColumnDataTable(), RowTreePlot(),
6256
AbundancePlot(), AbundanceDensityPlot(), ReducedDimensionPlot(),
6357
ComplexHeatmapPlot()), extra = NULL, colormap = ExperimentColorMap(),
6458
landingPage = createLandingPage(), tour = NULL, appTitle = NULL,
6559
runLocal = TRUE, voice = FALSE, bugs = FALSE, saveState = NULL, ...) {
6660

67-
initial <- .check_panel(se, initial, "RowDataTable", rowData)
68-
initial <- .check_panel(se, initial, "ColumnDataTable", colData)
69-
initial <- .check_panel(se, initial, "RowTreePlot", rowLinks)
70-
initial <- .check_panel(se, initial, "ColumnTreePlot", colLinks)
71-
initial <- .check_panel(se, initial, "AbundancePlot", taxonomyRanks)
72-
initial <- .check_panel(se, initial, "ReducedDimensionPlot", reducedDims)
73-
initial <- .check_panel(se, initial, "LoadingPlot", reducedDims)
74-
initial <- .check_panel(se, initial, "ScreePlot", reducedDims)
75-
initial <- .check_panel(se, initial, "RDAPlot", reducedDims)
76-
initial <- .check_panel(se, initial, "RowGraphPlot", metadata)
77-
initial <- .check_panel(se, initial, "ColumnGraphPlot", metadata)
61+
initial <- .check_all_panels(se, initial)
7862

7963
iSEE::iSEE(se, initial = initial, extra = initial, colormap = colormap,
8064
landingPage = landingPage, tour = tour, appTitle = appTitle,
8165
runLocal = runLocal, voice = voice, bugs = bugs,
8266
saveState = saveState, ...)
83-
})
84-
85-
#' @importFrom S4Vectors isEmpty
86-
#' @importFrom methods is
87-
.check_panel <- function(se, panel_list, panel_class, panel_fun, wtext) {
88-
89-
no_keep <- unlist(lapply(panel_list, function(x) is(x, panel_class)))
90-
91-
if( any(no_keep) && (is.null(panel_fun(se)) || isEmpty(panel_fun(se))) ){
92-
panel_list <- panel_list[!no_keep]
93-
warning("no valid ", as.character(substitute(panel_fun)),
94-
" fields for ", panel_class, call. = FALSE)
95-
}
96-
97-
return(panel_list)
98-
}
67+
})

R/iSEEtree-package.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' iSEE extension for the TreeSummarizedExperiment container
22
#'
3-
#' `iSEEtree` is an extension of \pkg{iSEE} that provides panels for the
3+
#' \code{iSEEtree} is an extension of \pkg{iSEE} that provides panels for the
44
#' \code{\link[TreeSummarizedExperiment:TreeSummarizedExperiment-constructor]{TreeSummarizedExperiment}}
55
#' container, enabling the interactive visualisation of typical microbiome data.
66
#' The panel layout of iSEEtree is described in \code{\link{iSEE}}.
@@ -14,6 +14,6 @@
1414
#'
1515
#' @docType package
1616
#' @keywords internal
17-
#' @name iSEEtree
17+
#' @name iSEEtree-package
1818
#'
1919
"_PACKAGE"

R/utils.R

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#' iSEEtree utils
2+
#'
3+
#' Utility functions to check the existence of specific elements in a
4+
#' \code{\link[TreeSummarizedExperiment:TreeSummarizedExperiment-constructor]{TreeSummarizedExperiment}}
5+
#' that are compulsory when using certain panels.
6+
#'
7+
#' @param se a
8+
#' \code{\link[SummarizedExperiment:SummarizedExperiment-class]{SummarizedExperiment}}
9+
#' object.
10+
#'
11+
#' @param initial \code{Panel vector}. A list of panel objects to check.
12+
#'
13+
#' @param panel.class \code{Character vector}. A list of panel names
14+
#' corresponding to panel objects in \code{initial}.
15+
#'
16+
#' @param panel.fun \code{Function scalar}. The element of \code{se} whose
17+
#' existance should be checked.
18+
#'
19+
#' @param wtext \code{Character scalar}. Text of the warning message returned
20+
#' if \code{panel.fun} does not exist or is empty.
21+
#'
22+
#' @return
23+
#' \code{.check_panel} returns the input \code{initial} list of panels excluding
24+
#' the checked panel if \code{panel.fun} is \code{NULL} or empty.
25+
#' \code{.check_all_panels} applies \code{.check_panel} to multiple panels and
26+
#' returns the a filtered version of \code{initial}.
27+
#'
28+
#' @examples
29+
#' # Import libraries
30+
#' library(mia)
31+
#' library(TreeSummarizedExperiment)
32+
#'
33+
#' # Import TreeSE
34+
#' data("Tengeler2020", package = "mia")
35+
#' tse <- Tengeler2020
36+
#'
37+
#' # Create list of panels
38+
#' initial <- c(RowTreePlot(), ColumnTreePlot())
39+
#' # If RowTreePlot is in initial, check whether rowLinks is defined
40+
#' initial <- .check_panel(tse, initial, "RowTreePlot", rowLinks)
41+
#' # If ColumnTreePlot is in initial, check whether colLinks is defined
42+
#' initial <- .check_panel(tse, initial, "ColumnTreePlot", colLinks)
43+
#'
44+
#' # View filtered list of panels
45+
#' initial
46+
#'
47+
#' @keywords internal
48+
#' @name utils
49+
NULL
50+
51+
#' @rdname utils
52+
#' @export
53+
#' @importFrom TreeSummarizedExperiment TreeSummarizedExperiment rowLinks
54+
#' colLinks
55+
#' @importFrom SingleCellExperiment reducedDims
56+
#' @importFrom S4Vectors metadata
57+
#' @importFrom SummarizedExperiment rowData colData
58+
#' @importFrom mia taxonomyRanks
59+
.check_all_panels <- function(se, initial){
60+
initial <- .check_panel(se, initial, "RowDataTable", rowData)
61+
initial <- .check_panel(se, initial, "ColumnDataTable", colData)
62+
initial <- .check_panel(se, initial, "RowTreePlot", rowLinks)
63+
initial <- .check_panel(se, initial, "ColumnTreePlot", colLinks)
64+
initial <- .check_panel(se, initial, "AbundancePlot", taxonomyRanks)
65+
initial <- .check_panel(se, initial, "ReducedDimensionPlot", reducedDims)
66+
initial <- .check_panel(se, initial, "LoadingPlot", reducedDims)
67+
initial <- .check_panel(se, initial, "ScreePlot", reducedDims)
68+
initial <- .check_panel(se, initial, "RDAPlot", reducedDims)
69+
initial <- .check_panel(se, initial, "RowGraphPlot", metadata)
70+
initial <- .check_panel(se, initial, "ColumnGraphPlot", metadata)
71+
return(initial)
72+
}
73+
74+
#' @rdname utils
75+
#' @export
76+
#' @importFrom S4Vectors isEmpty
77+
#' @importFrom methods is
78+
.check_panel <- function(se, initial, panel.class, panel.fun, wtext) {
79+
80+
no_keep <- unlist(lapply(initial, function(x) is(x, panel.class)))
81+
82+
if( any(no_keep) && (is.null(panel.fun(se)) || isEmpty(panel.fun(se))) ){
83+
initial <- initial[!no_keep]
84+
warning("no valid ", as.character(substitute(panel.fun)),
85+
" fields for ", panel.class, call. = FALSE)
86+
}
87+
88+
return(initial)
89+
}

inst/CITATION

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
citHeader("To cite iSEEtree in publications use:")
2+
3+
citEntry(
4+
entry = "Article",
5+
title = "iSEEtree: interactive explorer for hierarchical data",
6+
author = personList(
7+
as.person("Giulio Benedetti"),
8+
as.person("Ely Seraidarian"),
9+
as.person("Theotime Pralas"),
10+
as.person("Akewak Jeba"),
11+
as.person("Tuomas Borman"),
12+
as.person("Leo Lahti")
13+
),
14+
journal = "arXiv",
15+
year = "2024",
16+
url = "https://arxiv.org/abs/2412.02882",
17+
textVersion = paste("Benedetti, G., Seraidarian, E., Pralas, T., Jeba, A.",
18+
"Borman, T., & Lahti, L. (2024). iSEEtree: interactive explorer for",
19+
"hierarchical data. arXiv. doi: https://doi.org/10.48550/arXiv.2412.02882")
20+
)

inst/REFERENCES.bib

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@Manual{core2024r,
2+
title = {R: A Language and Environment for Statistical Computing},
3+
author = {{R Core Team}},
4+
organization = {R Foundation for Statistical Computing},
5+
address = {Vienna, Austria},
6+
year = {2024},
7+
url = {https://www.R-project.org/},
8+
}
9+
10+
@article{rue2018isee,
11+
title={{iSEE: interactive SummarizedExperiment explorer}},
12+
author={Rue-Albrecht, Kevin and Marini, Federico and Soneson, Charlotte and Lun, Aaron TL},
13+
journal={F1000Research},
14+
volume={7},
15+
year={2018},
16+
publisher={Faculty of 1000 Ltd},
17+
doi={10.12688/f1000research.14966.1}
18+
}
19+
20+
@Manual{chang2024shiny,
21+
title = {shiny: Web Application Framework for R},
22+
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},
23+
year = {2024},
24+
note = {R package version 1.9.1},
25+
url = {https://CRAN.R-project.org/package=shiny},
26+
}
27+
28+
@Manual{borman2024mia,
29+
title = {mia: Microbiome analysis},
30+
author = {Tuomas Borman and Felix G.M. Ernst and Sudarshan A. Shetty and Leo Lahti},
31+
year = {2024},
32+
note = {R package version 1.14.0},
33+
url = {https://bioconductor.org/packages/mia},
34+
doi = {10.18129/B9.bioc.mia},
35+
}
36+
37+
@article{huang2021treesummarizedexperiment,
38+
title={{TreeSummarizedExperiment: a S4 class for data with hierarchical structure}},
39+
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},
40+
journal={F1000Research},
41+
volume={9},
42+
year={2021},
43+
publisher={Faculty of 1000 Ltd},
44+
doi={10.12688/f1000research.26669.2}
45+
}

man/AbundanceDensityPlot.Rd

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

man/AbundancePlot.Rd

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

man/GraphPlot.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.

man/LoadingPlot.Rd

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

man/RDAPlot.Rd

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

man/ScreePlot.Rd

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

man/TreePlot.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.

man/iSEEtree.Rd renamed to man/iSEEtree-package.Rd

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

0 commit comments

Comments
 (0)