From 780e9e982b33983c104fddfac7322cfe8c5489ba Mon Sep 17 00:00:00 2001 From: Kevin Rue-Albrecht Date: Thu, 21 Sep 2023 11:41:12 +0100 Subject: [PATCH] Fix BiocCheck warnings (#28) * fix some warnings * fixing the tests to match the reworked parameter set * added value section to remove warnings * version bump and news --------- Co-authored-by: Federico Marini --- DESCRIPTION | 5 +++-- NEWS.md | 14 ++++++++++++++ R/AllGenerics.R | 12 ++++++------ R/FgseaEnrichmentPlot-class.R | 6 ++++-- R/PathwaysTable-class.R | 2 ++ R/iSEEfgseaResults-class.R | 4 +++- R/observers_zoom.R | 16 +++++++++------- R/utils-simulate.R | 7 ++----- man/FgseaEnrichmentPlot-class.Rd | 7 +++++-- man/PathwaysTable-class.Rd | 3 +++ man/iSEEfgseaResults-class.Rd | 3 +++ man/iSEEpathwaysResults-class.Rd | 18 ++++++++---------- man/pathway-generics.Rd | 16 +++++++--------- man/simulateExampleData.Rd | 6 ++---- tests/testthat/setup-fgsea.R | 3 ++- vignettes/iSEEpathways.Rmd | 1 + 16 files changed, 74 insertions(+), 49 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 9f4aa74..fb80d01 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: iSEEpathways Title: iSEE extension for panels related to pathway analysis -Version: 0.99.1 -Date: 2023-09-19 +Version: 0.99.2 +Date: 2023-09-21 Authors@R: c(person("Kevin", "Rue-Albrecht", email = "kevinrue67@gmail.com", role = c("aut", "cre"), @@ -45,6 +45,7 @@ Imports: S4Vectors, shiny, shinyWidgets, + stats, SummarizedExperiment Suggests: airway, diff --git a/NEWS.md b/NEWS.md index 6fcb600..1d921c3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,17 @@ +# iSEEpathways 0.99.2 + +MINOR UPDATES + +* Added missing depedency to DESCRIPTION file (Bioconductor WARNING). +* Moved `set.seed()` out of functions (Bioconductor WARNING). +* Added `\value` section to man pages (Bioconductor WARNING). + +# iSEEpathways 0.99.1 + +MINOR UPDATES + +* Added BiocViews (Bioconductor NOTE). + # iSEEpathways 0.99.0 NEW FEATURES diff --git a/R/AllGenerics.R b/R/AllGenerics.R index 79fa753..4093959 100644 --- a/R/AllGenerics.R +++ b/R/AllGenerics.R @@ -2,12 +2,12 @@ #' #' An overview of the generics for accessing common pieces of information in pathway analysis results. #' -#' @section Definitions: -#' \itemize{ -#' \item `pathwayType(x)` returns a character scalar indicating the type of pathways analysed. -#' \item `pathwaysList(x)` returns the named list of pathways used in the analysis, or `NULL`. -#' \item `featuresStats(x)` returns the named numeric vector of feature-level statistics used in the analysis, or `NULL`. -#' } +#' @return +#' `pathwayType(x)` returns a character scalar indicating the type of pathways analysed. +#' +#' `pathwaysList(x)` returns the named list of pathways used in the analysis, or `NULL`. +#' +#' `featuresStats(x)` returns the named numeric vector of feature-level statistics used in the analysis, or `NULL`. #' #' @docType methods #' @aliases featuresStats pathwayType pathwaysList diff --git a/R/FgseaEnrichmentPlot-class.R b/R/FgseaEnrichmentPlot-class.R index 7559849..19fc9eb 100644 --- a/R/FgseaEnrichmentPlot-class.R +++ b/R/FgseaEnrichmentPlot-class.R @@ -12,6 +12,8 @@ #' Defaults to an empty list, i.e., no brush or lasso. #' } #' +#' @return `FgseaEnrichmentPlot()` returns an object of class `FgseaEnrichmentPlot`. +#' #' In addition, this class inherits all slots from its parent [Panel-class] class. #' #' @docType methods @@ -179,11 +181,11 @@ setMethod(".generateOutput", "FgseaEnrichmentPlot", function (x, se, all_memory, all_cmds <- list() # Doing this first so all_active is available in the environment iSEE:::.populate_selection_environment(x, plot_env) - all_cmds$pre_cmds = paste0(c( + all_cmds$pre_cmds <- paste0(c( sprintf('.pathways <- pathwaysList(pathwaysResults(se, %s))', dQuote(result_name, FALSE)), sprintf('.stats <- featuresStats(pathwaysResults(se, %s))', dQuote(result_name, FALSE)) ), collapse = "\n") - plot_cmds <- sprintf('fgsea_plot <- fgsea::plotEnrichment(.pathways[[%s]], .stats) + labs(title=%s)', + plot_cmds <- sprintf('fgsea_plot <- fgsea::plotEnrichment(.pathways[[%s]], .stats) + labs(title=%s)', dQuote(pathway_id, FALSE), dQuote(pathway_id, FALSE)) if (!is.null(.multiSelectionActive(x))) { brush_src <- sprintf("all_active[['%s']]", plot_name) diff --git a/R/PathwaysTable-class.R b/R/PathwaysTable-class.R index aed8b6b..63dd402 100644 --- a/R/PathwaysTable-class.R +++ b/R/PathwaysTable-class.R @@ -3,6 +3,8 @@ #' The `PathwaysTable` is a \linkS4class{Panel} where each row represents a set of features (i.e., rows). #' Selections in this panel can be transmitted to other row-oriented panels. #' +#' @return `PathwaysTable()` returns an object of class `PathwaysTable`. +#' #' @section Slot overview: #' The following slots control the test procedure: #' \itemize{ diff --git a/R/iSEEfgseaResults-class.R b/R/iSEEfgseaResults-class.R index 41b4305..a2855ce 100644 --- a/R/iSEEfgseaResults-class.R +++ b/R/iSEEfgseaResults-class.R @@ -5,7 +5,7 @@ #' @section Slot overview: #' This class inherits all its slots directly from its parent class `DataFrame`. #' -#' @section Supported methods: +#' @return #' In the following code snippets, \code{x} is an instance of a [`iSEEpathwaysResults-class`] class. #' Refer to the documentation for each method for more details on the remaining arguments. #' @@ -55,6 +55,8 @@ setValidity2("iSEEpathwaysResults", function(.Object) { #' The `iSEEfgseaResults` class is used to provide an common interface to pathway analysis results produced by the \pkg{fgsea} package. #' It provides methods to access the set of features in each pathway. #' +#' @return `iSEEfgseaResults()` returns an object of class `iSEEfgseaResults`. +#' #' @section Slot overview: #' This class inherits all its slots directly from its parent class `iSEEpathwaysResults`. #' diff --git a/R/observers_zoom.R b/R/observers_zoom.R index 1f1e876..0784177 100644 --- a/R/observers_zoom.R +++ b/R/observers_zoom.R @@ -1,28 +1,30 @@ #' Double-click observer -#' +#' #' Double-clicking anywhere in the panel clears an existing brush. -#' +#' #' @details #' Adapted from `iSEE:::.create_zoom_observer()`. -#' +#' #' @param plot_name String containing the name of the panel. #' @param input The Shiny input object from the server function. #' @param session The Shiny session object from the server function. #' @param pObjects An environment containing global parameters generated in the \code{\link{iSEE}} app. #' @param rObjects A reactive list of values generated in the \code{\link{iSEE}} app. -#' +#' +#' @return Invisible `NULL`, after setting observers. +#' #' @rdname INTERNAL_create_double_click_observer #' #' @importFrom iSEE .requestUpdate .create_double_click_observer <- function(plot_name, input, session, pObjects, rObjects) { dblclick_field <- paste0(plot_name, "_", iSEE:::.zoomClick) - + # nocov start observeEvent(input[[dblclick_field]], { existing_brush <- slot(pObjects$memory[[plot_name]], iSEE:::.brushData) # Zooming destroys all active brushes or lassos. slot(pObjects$memory[[plot_name]], iSEE:::.brushData) <- list() - + # While re-creating the plot clears the brush, it doesn't # re-trigger the observer as the observer ignores NULLs. # So we have to manually retrigger the downstream effects. @@ -33,6 +35,6 @@ } }, ignoreInit=TRUE) # nocov end - + invisible(NULL) } diff --git a/R/utils-simulate.R b/R/utils-simulate.R index d5cb429..7261141 100644 --- a/R/utils-simulate.R +++ b/R/utils-simulate.R @@ -22,7 +22,6 @@ #' @param n_features integer scalar, number of features to simulate. #' @param n_samples integer scalar, number of samples to simulate. #' @param pathway_sizes integer vector, possible sizes of pathway to sample from. -#' @param seed a single value, passed to [set.seed()]. #' #' @return A list of three elements: #' \describe{ @@ -40,22 +39,20 @@ #' @importFrom SummarizedExperiment SummarizedExperiment #' #' @examples +#' set.seed(1) #' simulated_data <- simulateExampleData() #' head(lengths(simulated_data$pathwaysList)) #' head(simulated_data$featuresStat) -simulateExampleData <- function(n_pathways = 5E3, n_features = 15E3, n_samples = 8, pathway_sizes = 15:500, seed = 1) { +simulateExampleData <- function(n_pathways = 5E3, n_features = 15E3, n_samples = 8, pathway_sizes = 15:500) { # identifiers feature_ids <- paste0("feature_", seq_len(n_features)) pathway_ids <- paste0("pathway_", seq_len(n_pathways)) sample_ids <- paste0("sample_", seq_len(n_samples)) # pathways - set.seed(seed) pathway_lengths <- sample(pathway_sizes, length(pathway_ids), replace = TRUE) names(pathway_lengths) <- pathway_ids - set.seed(seed) pathways_list <- lapply(pathway_ids, function(x) { sample(feature_ids, pathway_lengths[[x]]) }) names(pathways_list) <- pathway_ids - set.seed(seed) # features feature_stats <- rnorm(length(feature_ids)) names(feature_stats) <- feature_ids diff --git a/man/FgseaEnrichmentPlot-class.Rd b/man/FgseaEnrichmentPlot-class.Rd index d559364..0d8b6e3 100644 --- a/man/FgseaEnrichmentPlot-class.Rd +++ b/man/FgseaEnrichmentPlot-class.Rd @@ -21,6 +21,11 @@ \alias{.renderOutput,FgseaEnrichmentPlot-method} \alias{.showSelectionDetails,FgseaEnrichmentPlot-method} \title{The FgseaEnrichmentPlot class} +\value{ +\code{FgseaEnrichmentPlot()} returns an object of class \code{FgseaEnrichmentPlot}. + +In addition, this class inherits all slots from its parent \linkS4class{Panel} class. +} \description{ The \code{FgseaEnrichmentPlot} is a \linkS4class{Panel} subclass where each row represents a set of features (i.e., rows). Selections in this panel can be transmitted to other row-oriented panels. @@ -34,8 +39,6 @@ The following slots control the test procedure: \item \code{BrushData}, a list containing a Shiny brush along the x-axis (see \code{?brushedPoints}). Defaults to an empty list, i.e., no brush or lasso. } - -In addition, this class inherits all slots from its parent \linkS4class{Panel} class. } \examples{ diff --git a/man/PathwaysTable-class.Rd b/man/PathwaysTable-class.Rd index b0c4e97..1652134 100644 --- a/man/PathwaysTable-class.Rd +++ b/man/PathwaysTable-class.Rd @@ -18,6 +18,9 @@ \alias{.refineParameters,PathwaysTable-method} \alias{.showSelectionDetails,PathwaysTable-method} \title{The PathwaysTable class} +\value{ +\code{PathwaysTable()} returns an object of class \code{PathwaysTable}. +} \description{ The \code{PathwaysTable} is a \linkS4class{Panel} where each row represents a set of features (i.e., rows). Selections in this panel can be transmitted to other row-oriented panels. diff --git a/man/iSEEfgseaResults-class.Rd b/man/iSEEfgseaResults-class.Rd index 47e1038..283aabc 100644 --- a/man/iSEEfgseaResults-class.Rd +++ b/man/iSEEfgseaResults-class.Rd @@ -9,6 +9,9 @@ \alias{pathwaysList,iSEEfgseaResults-method} \alias{pathwayType,iSEEfgseaResults-method} \title{The iSEEfgseaResults class} +\value{ +\code{iSEEfgseaResults()} returns an object of class \code{iSEEfgseaResults}. +} \description{ The \code{iSEEfgseaResults} class is used to provide an common interface to pathway analysis results produced by the \pkg{fgsea} package. It provides methods to access the set of features in each pathway. diff --git a/man/iSEEpathwaysResults-class.Rd b/man/iSEEpathwaysResults-class.Rd index 483aea4..61e8f24 100644 --- a/man/iSEEpathwaysResults-class.Rd +++ b/man/iSEEpathwaysResults-class.Rd @@ -6,16 +6,7 @@ \alias{iSEEpathwaysResults} \alias{show,iSEEpathwaysResults-method} \title{The iSEEpathwaysResults class} -\description{ -The iSEEpathwaysResults is a virtual class for storing a set of pathway analysis results. -} -\section{Slot overview}{ - -This class inherits all its slots directly from its parent class \code{DataFrame}. -} - -\section{Supported methods}{ - +\value{ In the following code snippets, \code{x} is an instance of a \code{\linkS4class{iSEEpathwaysResults}} class. Refer to the documentation for each method for more details on the remaining arguments. @@ -23,6 +14,13 @@ Refer to the documentation for each method for more details on the remaining arg \item \code{\link{pathwayType}(x)} returns the type of pathways stored in \code{x}. } } +\description{ +The iSEEpathwaysResults is a virtual class for storing a set of pathway analysis results. +} +\section{Slot overview}{ + +This class inherits all its slots directly from its parent class \code{DataFrame}. +} \examples{ showClass("iSEEpathwaysResults") diff --git a/man/pathway-generics.Rd b/man/pathway-generics.Rd index 37d3542..12c8241 100644 --- a/man/pathway-generics.Rd +++ b/man/pathway-generics.Rd @@ -7,18 +7,16 @@ \alias{pathwayType} \alias{pathwaysList} \title{Generics for Pathway Analysis Results} -\description{ -An overview of the generics for accessing common pieces of information in pathway analysis results. -} -\section{Definitions}{ +\value{ +\code{pathwayType(x)} returns a character scalar indicating the type of pathways analysed. + +\code{pathwaysList(x)} returns the named list of pathways used in the analysis, or \code{NULL}. -\itemize{ -\item \code{pathwayType(x)} returns a character scalar indicating the type of pathways analysed. -\item \code{pathwaysList(x)} returns the named list of pathways used in the analysis, or \code{NULL}. -\item \code{featuresStats(x)} returns the named numeric vector of feature-level statistics used in the analysis, or \code{NULL}. +\code{featuresStats(x)} returns the named numeric vector of feature-level statistics used in the analysis, or \code{NULL}. } +\description{ +An overview of the generics for accessing common pieces of information in pathway analysis results. } - \examples{ showMethods(pathwayType) showMethods(pathwaysList) diff --git a/man/simulateExampleData.Rd b/man/simulateExampleData.Rd index 76f6ff2..740f7bf 100644 --- a/man/simulateExampleData.Rd +++ b/man/simulateExampleData.Rd @@ -8,8 +8,7 @@ simulateExampleData( n_pathways = 5000, n_features = 15000, n_samples = 8, - pathway_sizes = 15:500, - seed = 1 + pathway_sizes = 15:500 ) } \arguments{ @@ -20,8 +19,6 @@ simulateExampleData( \item{n_samples}{integer scalar, number of samples to simulate.} \item{pathway_sizes}{integer vector, possible sizes of pathway to sample from.} - -\item{seed}{a single value, passed to \code{\link[=set.seed]{set.seed()}}.} } \value{ A list of three elements: @@ -55,6 +52,7 @@ and the set of features in the list of pathways, so that panels in the app can transmit and interpret that shared piece of information. } \examples{ +set.seed(1) simulated_data <- simulateExampleData() head(lengths(simulated_data$pathwaysList)) head(simulated_data$featuresStat) diff --git a/tests/testthat/setup-fgsea.R b/tests/testthat/setup-fgsea.R index b97956f..0fb6cf9 100644 --- a/tests/testthat/setup-fgsea.R +++ b/tests/testthat/setup-fgsea.R @@ -1,6 +1,7 @@ stopifnot(requireNamespace("fgsea")) -setup_data <- simulateExampleData(n_pathways = 5, n_features = 100, pathway_sizes = 10:20, seed = 1) +set.seed(1) +setup_data <- simulateExampleData(n_pathways = 5, n_features = 100, pathway_sizes = 10:20) fgsea_result <- fgsea::fgsea( pathways = setup_data$pathwaysList, diff --git a/vignettes/iSEEpathways.Rmd b/vignettes/iSEEpathways.Rmd index 0fd10a1..fcabdd5 100644 --- a/vignettes/iSEEpathways.Rmd +++ b/vignettes/iSEEpathways.Rmd @@ -98,6 +98,7 @@ library("iSEE") # Example data ---- +set.seed(1) simulated_data <- simulateExampleData() pathways_list <- simulated_data[["pathwaysList"]]