Skip to content

Commit

Permalink
deprecate default method
Browse files Browse the repository at this point in the history
  • Loading branch information
stemangiola committed Feb 6, 2024
1 parent 915117b commit 7df194c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 13 deletions.
21 changes: 17 additions & 4 deletions R/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -2676,14 +2676,15 @@ setMethod("ensembl_to_symbol", "tidybulk", .ensembl_to_symbol)
#'
#' tidybulk::se_mini |>
#' identify_abundant() |>
#' test_differential_abundance( ~ condition )
#' test_differential_abundance( ~ condition, method = "edgeR_quasi_likelihood" )
#'
#' # The function `test_differential_abundance` operates with contrasts too
#'
#' tidybulk::se_mini |>
#' identify_abundant(factor_of_interest = condition) |>
#' test_differential_abundance(
#' ~ 0 + condition,
#' method = "edgeR_quasi_likelihood",
#' contrasts = c( "conditionTRUE - conditionFALSE")
#' )
#'
Expand Down Expand Up @@ -2742,7 +2743,7 @@ setGeneric("test_differential_abundance", function(.data,
.transcript = NULL,
.abundance = NULL,
contrasts = NULL,
method = "edgeR_quasi_likelihood",
method = NULL,
test_above_log2_fold_change = NULL,
scaling_method = "TMM",
omit_contrast_in_colnames = FALSE,
Expand All @@ -2765,7 +2766,7 @@ setGeneric("test_differential_abundance", function(.data,
.transcript = NULL,
.abundance = NULL,
contrasts = NULL,
method = "edgeR_quasi_likelihood",
method = NULL,
test_above_log2_fold_change = NULL,
scaling_method = "TMM",
omit_contrast_in_colnames = FALSE,
Expand Down Expand Up @@ -2793,11 +2794,23 @@ setGeneric("test_differential_abundance", function(.data,
.transcript = col_names$.transcript
.abundance = col_names$.abundance




# DEPRECATION OF method = "edgeR_quasi_likelihood"
if (is.null(method)) {

# Signal the deprecation to the user
warning("In Jannuary 2024 the `method` argument will need to be specified and must NOT be empty. Until then method = NULL will be defaulted to \"edgeR_quasi_likelihood\" as for consistency with old version.")

method = "edgeR_quasi_likelihood"
}

# DEPRECATION OF significance_threshold
if (is_present(significance_threshold) & !is.null(significance_threshold)) {

# Signal the deprecation to the user
deprecate_warn("1.1.7", "tidybulk::test_differential_abundance(significance_threshold = )", details = "The argument significance_threshold is now deprecated, tigether with the column significance.")
deprecate_warn("1.1.7", "tidybulk::test_differential_abundance(significance_threshold = )", details = "The argument significance_threshold is now deprecated, together with the column significance.")

}

Expand Down
15 changes: 8 additions & 7 deletions man/test_differential_abundance-methods.Rd

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

1 change: 1 addition & 0 deletions tests/testthat/test-bulk_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,7 @@ test_that("DESeq2 differential trancript abundance - no object",{
.sample = a,
.transcript = b,
.abundance = c,
method = "edgeR_quasi_likelihood",
contrasts = "conditionTRUE - conditionFALSE",
action="only"
)
Expand Down
7 changes: 5 additions & 2 deletions tests/testthat/test-bulk_methods_SummarizedExperiment.R
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ test_that("differential trancript abundance - SummarizedExperiment",{
res = test_differential_abundance(
se_mini |>
identify_abundant(factor_of_interest = condition),
~ condition
~ condition,
method = "edgeR_quasi_likelihood"

)

w = match( c("CLEC7A" , "FAM198B", "FCN1" , "HK3" ), rownames(res) )
Expand All @@ -293,7 +295,8 @@ test_that("differential trancript abundance - SummarizedExperiment",{
res_tibble = test_differential_abundance(
input_df |> identify_abundant(a, b, c, factor_of_interest = condition),
~ condition ,
a, b, c
a, b, c,
method = "edgeR_quasi_likelihood"
)

expect_equal(
Expand Down

0 comments on commit 7df194c

Please sign in to comment.