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

Fix BiocCheck warnings #28

Merged
merged 4 commits into from
Sep 21, 2023
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
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]",
role = c("aut", "cre"),
Expand Down Expand Up @@ -45,6 +45,7 @@ Imports:
S4Vectors,
shiny,
shinyWidgets,
stats,
SummarizedExperiment
Suggests:
airway,
Expand Down
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions R/FgseaEnrichmentPlot-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions R/PathwaysTable-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 3 additions & 1 deletion R/iSEEfgseaResults-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#'
Expand Down Expand Up @@ -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`.
#'
Expand Down
16 changes: 9 additions & 7 deletions R/observers_zoom.R
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -33,6 +35,6 @@
}
}, ignoreInit=TRUE)
# nocov end

invisible(NULL)
}
7 changes: 2 additions & 5 deletions R/utils-simulate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions man/FgseaEnrichmentPlot-class.Rd

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

3 changes: 3 additions & 0 deletions man/PathwaysTable-class.Rd

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

3 changes: 3 additions & 0 deletions man/iSEEfgseaResults-class.Rd

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

18 changes: 8 additions & 10 deletions man/iSEEpathwaysResults-class.Rd

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

16 changes: 7 additions & 9 deletions man/pathway-generics.Rd

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

6 changes: 2 additions & 4 deletions man/simulateExampleData.Rd

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

3 changes: 2 additions & 1 deletion tests/testthat/setup-fgsea.R
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 1 addition & 0 deletions vignettes/iSEEpathways.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ library("iSEE")

# Example data ----

set.seed(1)
simulated_data <- simulateExampleData()

pathways_list <- simulated_data[["pathwaysList"]]
Expand Down