Skip to content
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

Add data parameters #28

Merged
merged 37 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
91b85de
Added use_relative as a data parameter
Jun 4, 2024
5945e31
Merge remote-tracking branch 'upstream/devel' into dataparameters
Jun 4, 2024
1e5223a
Added flipped as a data parameter
Jun 4, 2024
4d6afba
Added order_descending as a data parameter
Jun 5, 2024
fb50cad
Added order_tree as a data parameter
Jun 5, 2024
41b5600
Added sliders (not working as intended)
Jun 5, 2024
01d0c65
Added add.significance & add.expl.var as data parameters
Jun 5, 2024
a88353c
Trying to add condition selectInput
Jun 5, 2024
19b0ccf
Fixed removed panel
Jun 5, 2024
2bed7cf
fixed parentheses missing
Jun 5, 2024
2bbd707
Changed documentation
Jun 5, 2024
6a39114
Fixes labels & sliders
Jun 7, 2024
78ff55d
Fixed shape_by parameter
Jun 7, 2024
5507200
Fixed tests
Jun 7, 2024
cc9706b
Switched for checkbox order_descending
Jun 10, 2024
a208a07
Added order_sample_by & decreasing as data parameters
Jun 12, 2024
e1e8b68
Row data order sample by example
Jun 13, 2024
d41c306
Added RDAPlot visual parameters with group checkbox
Jun 13, 2024
9a0a7ad
Updated documentation & tests also removed iSEE::: calls
Jun 13, 2024
699726c
Fixed last iSEE::: call
Jun 13, 2024
49f8afb
Added RowTreePlot visual parameters
Jun 14, 2024
362457a
Fix sample order issue in plotAbundance panel
RiboRings Jun 14, 2024
d7cd325
Merge remote-tracking branch 'origin/dataparameters' into dataparameters
RiboRings Jun 14, 2024
773aea4
Fixed order_sample_by issue
Jun 14, 2024
de0ae1f
Fix .list_taxa for se with 1 rank
RiboRings Jun 14, 2024
51766f8
Merge remote-tracking branch 'origin/dataparameters' into dataparameters
RiboRings Jun 14, 2024
08d8378
Added import methods
Jun 14, 2024
76d3c71
Merge branch 'dataparameters' of github.com:ElySeraidarian/iSEEtree i…
Jun 14, 2024
d04da50
Fixed RDAPlot parameters unresponsive changes
Jun 14, 2024
e855155
Fixed tests
Jun 14, 2024
708bc07
trying rework visual params RowTreePlot
Jun 17, 2024
df5d331
Fixed issues for checkboxes
Jun 18, 2024
5dd0c70
Changes to checkboxes UI RowTreePlot
Jun 19, 2024
972a280
Play with RowTreePlot visual params
RiboRings Jun 19, 2024
11033d1
Make changes to RDAPlot panel
RiboRings Jun 19, 2024
4b95e54
Fix tests
RiboRings Jun 19, 2024
23a0c21
Bump version
RiboRings Jun 23, 2024
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
24 changes: 14 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
Package: iSEEtree
Version: 0.99.0
Version: 0.99.2
Authors@R:
person(given = "Giulio", family = "Benedetti", role = c("aut", "cre"),
c(person(given = "Giulio", family = "Benedetti", role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-8732-7692"))
comment = c(ORCID = "0000-0002-8732-7692")),
person(given = "Ely", family = "Seraidarian", role = c("ctb"),
email = "[email protected]",
comment = c(ORCID = "0009-0008-8602-093X")))
Title: Interactive visualisation for microbiome data
Description:
iSEEtree is an extension of iSEE for the TreeSummarizedExperiment.
Expand All @@ -12,33 +15,34 @@ Description:
TreeSummarizedExperiment objects. Not surprisingly, it also depends on the
generic panels from iSEE.
biocViews: Microbiome, Software, Visualization, DataImport
License: Artistic-2.0
License: Artistic-2.0 + file LICENSE
Encoding: UTF-8
Depends:
R (>= 4.0),
R (>= 4.4.0),
iSEE
Imports:
grDevices,
methods,
miaViz,
S4Vectors,
shiny,
mia,
shinyWidgets,
SingleCellExperiment,
SummarizedExperiment,
TreeSummarizedExperiment
TreeSummarizedExperiment,
utils
Suggests:
BiocStyle,
knitr,
mia,
RefManageR,
remotes,
rmarkdown,
scater,
testthat (>= 3.0.0),
utils,
vegan
URL: https://github.com/RiboRings/iSEEtree
BugReports: https://github.com/RiboRings/iSEEtree/issues
URL: https://github.com/microbiome/iSEEtree
BugReports: https://github.com/microbiome/iSEEtree/issues
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Expand Down
6 changes: 5 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ importFrom(TreeSummarizedExperiment,rowLinks)
importFrom(TreeSummarizedExperiment,rowTreeNames)
importFrom(iSEE,.addSpecificTour)
importFrom(iSEE,.addTourStep)
importFrom(iSEE,.checkboxGroupInput.iSEE)
importFrom(iSEE,.checkboxInput.iSEE)
importFrom(iSEE,.conditionalOnCheckGroup)
importFrom(iSEE,.conditionalOnCheckSolo)
importFrom(iSEE,.conditionalOnRadio)
importFrom(iSEE,.createProtectedParameterObservers)
Expand All @@ -36,6 +38,7 @@ importFrom(iSEE,.radioButtons.iSEE)
importFrom(iSEE,.retrieveOutput)
importFrom(iSEE,.selectInput.iSEE)
importFrom(iSEE,.singleStringError)
importFrom(iSEE,.sliderInput.iSEE)
importFrom(iSEE,.textEval)
importFrom(iSEE,.validLogicalError)
importFrom(iSEE,.validNumberError)
Expand All @@ -50,11 +53,12 @@ importFrom(methods,callNextMethod)
importFrom(methods,is)
importFrom(methods,new)
importFrom(methods,slot)
importFrom(mia,taxonomyRanks)
importFrom(miaViz,plotRowTree)
importFrom(shiny,plotOutput)
importFrom(shiny,renderPlot)
importFrom(shinyWidgets,addSpinner)
importMethodsFrom(iSEE,.createObservers)
importFrom(utils,stack)
importMethodsFrom(iSEE,.generateOutput)
importMethodsFrom(iSEE,.panelColor)
importMethodsFrom(iSEE,.renderOutput)
73 changes: 61 additions & 12 deletions R/class-AbundanceDensityPlot.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#' \item \code{layout}, a string specifying abundance layout (jitter, density or points).
#' \item \code{assay.type}, a string specifying the assay to visualize.
#' \item \code{n}, a number indicating the number of top taxa to visualize.
#' \item \code{flipped}, a logical specifying if the axis should be switched.
#' \item \code{order_descending}, a string specifying the descending order.
#' }
#'
#' In addition, this class inherits all slots from its parent \linkS4class{Panel} class.
Expand Down Expand Up @@ -45,15 +47,17 @@ NULL
#' @export
setClass("AbundanceDensityPlot", contains="Panel", slots=c(layout="character",
assay.type="character", n="numeric", dots_colour="character",
dots_colour_by="character", add_legend="logical"))
dots_colour_by="character", add_legend="logical", flipped="logical",
order_descending="logical", dots_shape="character", dots_shape_by="character"))

#' @importFrom iSEE .singleStringError .validNumberError
#' @importFrom iSEE .singleStringError .validNumberError .validLogicalError
#' @importFrom S4Vectors setValidity2
setValidity2("AbundanceDensityPlot", function(x) {
msg <- character(0)

msg <- .singleStringError(msg, x, fields=c("layout", "assay.type"))
msg <- .validNumberError(msg, x, "n", lower=1, upper=Inf)
msg <- .validLogicalError(msg, x, fields=c("add_legend", "flipped", "order_descending"))

if( length(msg) ){
return(msg)
Expand All @@ -70,8 +74,12 @@ setMethod("initialize", "AbundanceDensityPlot", function(.Object, ...) {
args <- .emptyDefault(args, "assay.type", "counts")
args <- .emptyDefault(args, "n", 5)
args <- .emptyDefault(args, "add_legend", TRUE)
args <- .emptyDefault(args, "flipped", FALSE)
args <- .emptyDefault(args, "dots_colour", "None")
args <- .emptyDefault(args, "dots_shape", "None")
args <- .emptyDefault(args, "dots_colour_by", NA_character_)
args <- .emptyDefault(args, "dots_shape_by", NA_character_)
args <- .emptyDefault(args, "order_descending", TRUE)

do.call(callNextMethod, c(list(.Object), args))
})
Expand All @@ -82,7 +90,8 @@ AbundanceDensityPlot <- function(...) {
new("AbundanceDensityPlot", ...)
}

#' @importFrom iSEE .getEncodedName .selectInput.iSEE .numericInput.iSEE
#' @importFrom iSEE .getEncodedName .selectInput.iSEE .numericInput.iSEE .checkboxInput.iSEE
#' .radioButtons.iSEE .conditionalOnRadio
#' @importFrom methods slot
#' @importFrom SummarizedExperiment assayNames
setMethod(".defineDataInterface", "AbundanceDensityPlot",
Expand All @@ -94,7 +103,24 @@ setMethod(".defineDataInterface", "AbundanceDensityPlot",
choices=assayNames(se), selected=slot(x, "assay.type")),
# Number of taxa
.numericInput.iSEE(x, field="n", label="Number of taxa",
value=slot(x, "n"), min=1, max=nrow(se), step=1))
value=slot(x, "n"), min=1, max=nrow(se), step=1),

.checkboxInput.iSEE(x, field="flipped", label="Switch axes",
value=slot(x, "flipped")),

.checkboxInput.iSEE(x, field="order_descending", label="Order decreasing",
value=slot(x, "order_descending")),

.radioButtons.iSEE(
x, field="dots_shape", label="Dot shape:", inline=TRUE,
choices=c("None", "Column data"),
selected=slot(x, "dots_shape")),

.conditionalOnRadio(
paste0(panel_name, "_dots_shape"), "Column data",
.selectInput.iSEE(x, field="dots_shape_by",
label="Shape dots by", choices=names(colData(se)),
selected=slot(x, "dots_shape_by"))))
})

#' @importFrom methods callNextMethod
Expand All @@ -114,11 +140,11 @@ setMethod(".createObservers", "AbundanceDensityPlot",
panel_name <- .getEncodedName(x)

.createProtectedParameterObservers(panel_name,
c("layout", "assay.type", "n", "add_legend"),
c("layout", "assay.type", "n", "add_legend", "flipped", "order_descending"),
input=input, pObjects=pObjects, rObjects=rObjects)

.createUnprotectedParameterObservers(panel_name,
c("dots_colour", "dots_colour_by"),
c("dots_colour", "dots_colour_by", "dots_shape", "dots_shape_by"),
input=input, pObjects=pObjects, rObjects=rObjects)

invisible(NULL)
Expand Down Expand Up @@ -164,6 +190,8 @@ setMethod(".generateOutput", "AbundanceDensityPlot",
args[["layout"]] <- deparse(slot(x, "layout"))
args[["add_legend"]] <- deparse(slot(x, "add_legend"))
args[["assay.type"]] <- deparse(slot(x, "assay.type"))
args[["flipped"]] <- deparse(slot(x , "flipped"))
args[["order_descending"]] <- deparse(slot(x, "order_descending"))
RiboRings marked this conversation as resolved.
Show resolved Hide resolved

if( is.na(slot(x, "n")) || slot(x, "n") <= 0 ){
args[["n"]] <- 5
Expand All @@ -177,6 +205,10 @@ setMethod(".generateOutput", "AbundanceDensityPlot",
args[["colour_by"]] <- deparse(slot(x, "dots_colour_by"))
}

if (slot(x, "dots_shape") == "Column data") {
args[["shape_by"]] <- deparse(slot(x, "dots_shape_by"))
}

args <- sprintf("%s=%s", names(args), args)
args <- paste(args, collapse=", ")
fun_call <- sprintf("p <- miaViz::plotAbundanceDensity(se, %s)", args)
Expand Down Expand Up @@ -243,7 +275,7 @@ setMethod(".definePanelTour", "AbundanceDensityPlot", function(x) {
})

#' @importFrom iSEE .getEncodedName collapseBox .selectInput.iSEE
#' .radioButtons.iSEE .conditionalOnRadio
#' .radioButtons.iSEE .conditionalOnRadio .checkboxInput.iSEE
#' @importFrom methods slot
#' @importFrom SummarizedExperiment colData
.create_visual_box_for_abunddens_plot <- function(x, se) {
Expand All @@ -264,7 +296,7 @@ setMethod(".definePanelTour", "AbundanceDensityPlot", function(x) {
whether or not to show colors.")))})
.addSpecificTour(class(x)[1], "dots_colour_by", function(panel_name) {
data.frame(rbind(c(element = paste0("#", panel_name,
"_dots_colour_by"), intro = "Here, we can choose
"_dots_colour_by + .selectize-control"), intro = "Here, we can choose
the way you want to map the colors.")))})
.addSpecificTour(class(x)[1], "assay.type", function(panel_name) {
data.frame(rbind(c(element = paste0("#", panel_name,
Expand All @@ -274,6 +306,24 @@ setMethod(".definePanelTour", "AbundanceDensityPlot", function(x) {
data.frame(rbind(c(element = paste0("#", panel_name,
"_n"), intro = "Here, we can choose
the number of taxa to be selected.")))})
.addSpecificTour(class(x)[1], "flipped", function(panel_name) {
data.frame(rbind(c(element = paste0("#", panel_name,
"_flipped"), intro = "Here, we can choose
whether or not to switch the axis.")))})
.addSpecificTour(class(x)[1], "order_descending", function(panel_name) {
data.frame(rbind(c(element = paste0("#", panel_name,
"_order_descending"), intro = "Here, we can choose
whether or not to use descending order.
If NA uses the order found in the <code>SummarizedExperiment</code>
object.")))})
.addSpecificTour(class(x)[1], "dots_shape", function(panel_name) {
data.frame(rbind(c(element = paste0("#", panel_name,
"_dots_shape"), intro = "Here, we can choose
whether or not to change points shape.")))})
.addSpecificTour(class(x)[1], "dots_shape_by", function(panel_name) {
data.frame(rbind(c(element = paste0("#", panel_name,
"_dots_shape_by"), intro = "Here, we can choose
to group by the different point shape groups.")))})

# Define what parameters the user can adjust
collapseBox(
Expand All @@ -291,8 +341,7 @@ setMethod(".definePanelTour", "AbundanceDensityPlot", function(x) {
selected=slot(x, "dots_colour")),
.conditionalOnRadio(
paste0(panel_name, "_dots_colour"), "Column data",
iSEE:::.selectInputHidden(x, field="dots_colour_by",
label="Color dots by", choices=names(colData(se)),
selected=slot(x, "dots_colour_by"))))

.selectInput.iSEE(x, field="dots_colour_by",
label="Color dots by", choices=names(colData(se)),
selected=slot(x, "dots_colour_by"))))
}
Loading
Loading