Skip to content

Commit 0b9ad80

Browse files
committed
solve BioCheck
1 parent 672cf44 commit 0b9ad80

15 files changed

+122
-26
lines changed

NAMESPACE

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export(get_output_samples)
2121
export(plot_1D_intervals)
2222
export(plot_2D_intervals)
2323
export(sccomp_boxplot)
24-
export(sccomp_calculate_residuals)
2524
export(sccomp_estimate)
2625
export(sccomp_predict)
2726
export(sccomp_proportional_fold_change)

R/methods.R

+37-8
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@
7373
#'
7474
#' @examples
7575
#'
76-
#' message("Use the following example after having installed cmdstanr with install.packages(\"cmdstanr\", repos = c(\"https://stan-dev.r-universe.dev/\", getOption(\"repos\")))")
76+
#' print("cmdstanr is needed to run this example.")
77+
#' # Note: Before running the example, ensure that the 'cmdstanr' package is installed:
78+
#' # install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev/", getOption("repos")))
7779
#'
7880
#' \donttest{
7981
#' if (instantiate::stan_cmdstan_exists()) {
@@ -601,7 +603,9 @@ sccomp_estimate.data.frame <- function(.data,
601603
#'
602604
#' @examples
603605
#'
604-
#' message("Use the following example after having installed install.packages(\"cmdstanr\", repos = c(\"https://stan-dev.r-universe.dev/\", getOption(\"repos\")))")
606+
#' print("cmdstanr is needed to run this example.")
607+
#' # Note: Before running the example, ensure that the 'cmdstanr' package is installed:
608+
#' # install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev/", getOption("repos")))
605609
#'
606610
#' \donttest{
607611
#' if (instantiate::stan_cmdstan_exists()) {
@@ -1036,7 +1040,9 @@ sccomp_remove_outliers.sccomp_tbl = function(.estimate,
10361040
#'
10371041
#' @examples
10381042
#'
1039-
#' message("Use the following example after having installed install.packages(\"cmdstanr\", repos = c(\"https://stan-dev.r-universe.dev/\", getOption(\"repos\")))")
1043+
#' print("cmdstanr is needed to run this example.")
1044+
#' # Note: Before running the example, ensure that the 'cmdstanr' package is installed:
1045+
#' # install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev/", getOption("repos")))
10401046
#'
10411047
#' \donttest{
10421048
#' if (instantiate::stan_cmdstan_exists()) {
@@ -1223,7 +1229,9 @@ sccomp_test.sccomp_tbl = function(.data,
12231229
#'
12241230
#' @examples
12251231
#'
1226-
#' message("Use the following example after having installed install.packages(\"cmdstanr\", repos = c(\"https://stan-dev.r-universe.dev/\", getOption(\"repos\")))")
1232+
#' print("cmdstanr is needed to run this example.")
1233+
#' # Note: Before running the example, ensure that the 'cmdstanr' package is installed:
1234+
#' # install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev/", getOption("repos")))
12271235
#'
12281236
#' \donttest{
12291237
#' if (instantiate::stan_cmdstan_exists() && .Platform$OS.type == "unix") {
@@ -1325,7 +1333,9 @@ sccomp_replicate.sccomp_tbl = function(fit,
13251333
#'
13261334
#' @examples
13271335
#'
1328-
#' message("Use the following example after having installed install.packages(\"cmdstanr\", repos = c(\"https://stan-dev.r-universe.dev/\", getOption(\"repos\")))")
1336+
#' print("cmdstanr is needed to run this example.")
1337+
#' # Note: Before running the example, ensure that the 'cmdstanr' package is installed:
1338+
#' # install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev/", getOption("repos")))
13291339
#'
13301340
#' \donttest{
13311341
#' if (instantiate::stan_cmdstan_exists() && .Platform$OS.type == "unix") {
@@ -1468,6 +1478,11 @@ sccomp_predict.sccomp_tbl = function(fit,
14681478
#'
14691479
#' @export
14701480
#'
1481+
#' print("cmdstanr is needed to run this example.")
1482+
#' # Note: Before running the example, ensure that the 'cmdstanr' package is installed:
1483+
#' # install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev/", getOption("repos")))
1484+
#'
1485+
#'
14711486
#' @examples
14721487
#' \donttest{
14731488
#' if (instantiate::stan_cmdstan_exists() && .Platform$OS.type == "unix") {
@@ -1568,7 +1583,9 @@ sccomp_calculate_residuals.sccomp_tbl = function(.data){
15681583
#'
15691584
#' @examples
15701585
#'
1571-
#' message("Use the following example after having installed cmdstanr with install.packages(\"cmdstanr\", repos = c(\"https://stan-dev.r-universe.dev/\", getOption(\"repos\")))")
1586+
#' print("cmdstanr is needed to run this example.")
1587+
#' # Note: Before running the example, ensure that the 'cmdstanr' package is installed:
1588+
#' # install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev/", getOption("repos")))
15721589
#'
15731590
#' \donttest{
15741591
#' if (instantiate::stan_cmdstan_exists()) {
@@ -1702,7 +1719,9 @@ sccomp_remove_unwanted_variation.sccomp_tbl = function(.data,
17021719
#'
17031720
#' @examples
17041721
#'
1705-
#' message("Use the following example after having installed install.packages(\"cmdstanr\", repos = c(\"https://stan-dev.r-universe.dev/\", getOption(\"repos\")))")
1722+
#' print("cmdstanr is needed to run this example.")
1723+
#' # Note: Before running the example, ensure that the 'cmdstanr' package is installed:
1724+
#' # install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev/", getOption("repos")))
17061725
#'
17071726
#' \donttest{
17081727
#' if (instantiate::stan_cmdstan_exists()) {
@@ -1859,6 +1878,8 @@ simulate_data.tbl = function(.data,
18591878
#' @export
18601879
#'
18611880
#' @examples
1881+
#'
1882+
#' print("cmdstanr is needed to run this example.")
18621883
#' # Note: Before running the example, ensure that the 'cmdstanr' package is installed:
18631884
#' # install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev/", getOption("repos")))
18641885
#'
@@ -1969,7 +1990,9 @@ sccomp_boxplot = function(
19691990
#'
19701991
#' @examples
19711992
#'
1972-
#' message("Use the following example after having installed install.packages(\"cmdstanr\", repos = c(\"https://stan-dev.r-universe.dev/\", getOption(\"repos\")))")
1993+
#' print("cmdstanr is needed to run this example.")
1994+
#' # Note: Before running the example, ensure that the 'cmdstanr' package is installed:
1995+
#' # install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev/", getOption("repos")))
19731996
#'
19741997
#' \donttest{
19751998
#' if (instantiate::stan_cmdstan_exists()) {
@@ -2131,6 +2154,12 @@ clear_stan_model_cache <- function(cache_dir = sccomp_stan_models_cache_dir) {
21312154
#' }
21322155
#'
21332156
#' @examples
2157+
#'
2158+
#' print("cmdstanr is needed to run this example.")
2159+
#' # Note: Before running the example, ensure that the 'cmdstanr' package is installed:
2160+
#' # install.packages("cmdstanr", repos = c("https://stan-dev.r-universe.dev/", getOption("repos")))
2161+
#'
2162+
#'
21342163
#' \donttest{
21352164
#' if (instantiate::stan_cmdstan_exists()) {
21362165
#' # Load example data

R/utilities.R

+27-7
Original file line numberDiff line numberDiff line change
@@ -1843,6 +1843,8 @@ get_FDR = function(x){
18431843
#' @return A combined plot of 1D interval plots.
18441844
#' @examples
18451845
#'
1846+
#' print("cmdstanr is needed to run this example.")
1847+
#'
18461848
#' \donttest{
18471849
#' if (instantiate::stan_cmdstan_exists()) {
18481850
#' data("counts_obj")
@@ -1865,7 +1867,6 @@ get_FDR = function(x){
18651867
#' }
18661868
#'
18671869
#'
1868-
18691870
plot_1D_intervals = function(.data, significance_threshold = 0.05, test_composition_above_logit_fold_change = .data |> attr("test_composition_above_logit_fold_change")){
18701871

18711872
message("sccomp says: Some FDR-significant populations may cross the fold change threshold. \n This because, as sccomp is a Bayesian method, the FDR is calculated according to Stephens (doi: 10.1093/biostatistics/kxw041), \n by sorting the probability of the null hypothesis in ascending order and calculating the cumulative average.")
@@ -1946,9 +1947,32 @@ plot_1D_intervals = function(.data, significance_threshold = 0.05, test_composit
19461947
#' @export
19471948
#'
19481949
#' @return A ggplot object representing the 2D interval plot.
1950+
#'
19491951
#' @examples
1950-
#' # Example usage:
1951-
#' # plot_2D_intervals(.data, "cell_group", theme_minimal(), 0.025)
1952+
#'
1953+
#' print("cmdstanr is needed to run this example.")
1954+
#'
1955+
#' \donttest{
1956+
#' if (instantiate::stan_cmdstan_exists()) {
1957+
#' data("counts_obj")
1958+
#'
1959+
#' estimate <- sccomp_estimate(
1960+
#' counts_obj,
1961+
#' ~ type,
1962+
#' ~type,
1963+
#' sample,
1964+
#' cell_group,
1965+
#' count,
1966+
#' cores = 1
1967+
#' ) |>
1968+
#' sccomp_test()
1969+
#'
1970+
#' # Example usage:
1971+
#' my_plot = plot_2D_intervals(estimate)
1972+
#'
1973+
#' }
1974+
#' }
1975+
#'
19521976
plot_2D_intervals = function(
19531977
.data,
19541978
significance_threshold = 0.05,
@@ -3925,10 +3949,6 @@ check_missing_parameters <- function(effects, model_effects) {
39253949
}
39263950
}
39273951

3928-
library(dplyr)
3929-
3930-
library(dplyr)
3931-
39323952
harmonise_factor_levels <- function(dataframe_query, dataframe_reference) {
39333953
# 1. Identify factor columns in the reference
39343954
factor_cols <- names(dataframe_reference)[sapply(dataframe_reference, is.factor)]

man/plot.sccomp_tbl.Rd

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plot_1D_intervals.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plot_2D_intervals.Rd

+24-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sccomp_boxplot.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sccomp_estimate.Rd

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sccomp_predict.Rd

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sccomp_proportional_fold_change.Rd

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sccomp_remove_outliers.Rd

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sccomp_remove_unwanted_variation.Rd

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sccomp_replicate.Rd

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sccomp_test.Rd

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/simulate_data.Rd

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)