Skip to content

Commit edc7b3b

Browse files
authored
Merge pull request #115 from stemangiola/dev
Dev
2 parents 505fef6 + 3f30c47 commit edc7b3b

10 files changed

+219
-247
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: tidybulk
33
Title: Brings transcriptomics to the tidyverse
4-
Version: 1.1.7
4+
Version: 1.1.8
55
Authors@R: c(person("Stefano", "Mangiola", email = "[email protected]",
66
role = c("aut", "cre")),
77
person("Maria", "Doyle", email = "[email protected]",

R/functions.R

Lines changed: 88 additions & 99 deletions
Large diffs are not rendered by default.

R/methods.R

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,6 +1844,7 @@ setMethod("ensembl_to_symbol", "tidybulk", .ensembl_to_symbol)
18441844
#' @param fill_missing_values A boolean. Whether to fill missing sample/transcript values with the median of the transcript. This is rarely needed.
18451845
#' @param scaling_method A character string. The scaling method passed to the back-end function (i.e., edgeR::calcNormFactors; "TMM","TMMwsp","RLE","upperquartile")
18461846
#' @param omit_contrast_in_colnames If just one contrast is specified you can choose to omit the contrast label in the colnames.
1847+
#' @param prefix A character string. The prefix you would like to add to the result columns. It is useful if you want to compare several methods.
18471848
#' @param action A character string. Whether to join the new information to the input tbl (add), or just get the non-redundant tbl with the new information (get).
18481849
#'
18491850
#' @details This function provides the option to use edgeR \url{https://doi.org/10.1093/bioinformatics/btp616}, limma-voom \url{https://doi.org/10.1186/gb-2014-15-2-r29}, or DESeq2 \url{https://doi.org/10.1186/s13059-014-0550-8} to perform the testing.
@@ -1920,12 +1921,15 @@ setGeneric("test_differential_abundance", function(.data,
19201921
.abundance = NULL,
19211922
.contrasts = NULL,
19221923
method = "edgeR_quasi_likelihood",
1923-
significance_threshold = 0.05,
1924-
fill_missing_values = FALSE,
19251924
scaling_method = "TMM",
19261925
omit_contrast_in_colnames = FALSE,
1927-
1928-
action = "add")
1926+
prefix = "",
1927+
action = "add",
1928+
1929+
# DEPRECATED
1930+
significance_threshold = NULL,
1931+
fill_missing_values = NULL
1932+
)
19291933
standardGeneric("test_differential_abundance"))
19301934

19311935
# Set internal
@@ -1936,12 +1940,16 @@ setGeneric("test_differential_abundance", function(.data,
19361940
.abundance = NULL,
19371941
.contrasts = NULL,
19381942
method = "edgeR_quasi_likelihood",
1939-
significance_threshold = 0.05,
1940-
fill_missing_values = FALSE,
19411943
scaling_method = "TMM",
19421944
omit_contrast_in_colnames = FALSE,
1943-
1944-
action = "add")
1945+
prefix = "",
1946+
1947+
action = "add",
1948+
1949+
# DEPRECATED
1950+
significance_threshold = NULL,
1951+
fill_missing_values = NULL
1952+
)
19451953
{
19461954
# Get column names
19471955
.sample = enquo(.sample)
@@ -1952,8 +1960,26 @@ setGeneric("test_differential_abundance", function(.data,
19521960
.transcript = col_names$.transcript
19531961
.abundance = col_names$.abundance
19541962

1963+
# DEPRECATION OF significance_threshold
1964+
if (is_present(significance_threshold) & !is.null(significance_threshold)) {
1965+
1966+
# Signal the deprecation to the user
1967+
deprecate_warn("1.1.7", "tidybulk::test_differential_abundance(significance_threshold = )", details = "The argument significance_threshold is now deprecated please look at the resulting statistics to do the filtering (e.g., filter(., FDR < 0.05))")
1968+
1969+
}
1970+
1971+
# DEPRECATION OF fill_missing_values
1972+
if (is_present(fill_missing_values) & !is.null(significance_threshold)) {
1973+
1974+
# Signal the deprecation to the user
1975+
deprecate_warn("1.1.7", "tidybulk::test_differential_abundance(fill_missing_values = )", details = "The argument fill_missing_values is now deprecated, you will receive a warning/error instead. Please use externally the methods fill_missing_abundance or impute_missing_abundance instead.")
1976+
1977+
}
1978+
19551979
# Clearly state what counts are used
1956-
message("tidybulk says: All methods use raw counts, irrespective of if scale_abundance or adjust_abundance have been calculated, therefore it is essential to add covariates such as batch effects (if applicable) in the formula.")
1980+
message("tidybulk says: All methods use raw counts,
1981+
irrespective of if scale_abundance or adjust_abundance have been calculated,
1982+
therefore it is essential to add covariates such as batch effects (if applicable) in the formula.")
19571983

19581984
# Validate data frame
19591985
if(do_validate()) {
@@ -1977,18 +2003,18 @@ setGeneric("test_differential_abundance", function(.data,
19772003
when(
19782004

19792005
# edgeR
1980-
grepl("edgeR", method) ~ get_differential_transcript_abundance_bulk(
2006+
tolower(method) %in% c("edger_quasi_likelihood", "edger_likelihood_ratio") ~
2007+
get_differential_transcript_abundance_bulk(
19812008
.,
19822009
.formula,
19832010
.sample = !!.sample,
19842011
.transcript = !!.transcript,
19852012
.abundance = !!.abundance,
19862013
.contrasts = .contrasts,
19872014
method = method,
1988-
significance_threshold = significance_threshold,
1989-
fill_missing_values = fill_missing_values,
19902015
scaling_method = scaling_method,
1991-
omit_contrast_in_colnames = omit_contrast_in_colnames
2016+
omit_contrast_in_colnames = omit_contrast_in_colnames,
2017+
prefix = prefix
19922018
),
19932019

19942020
# Voom
@@ -2000,10 +2026,9 @@ setGeneric("test_differential_abundance", function(.data,
20002026
.transcript = !!.transcript,
20012027
.abundance = !!.abundance,
20022028
.contrasts = .contrasts,
2003-
significance_threshold = significance_threshold,
2004-
fill_missing_values = fill_missing_values,
20052029
scaling_method = scaling_method,
2006-
omit_contrast_in_colnames = omit_contrast_in_colnames
2030+
omit_contrast_in_colnames = omit_contrast_in_colnames,
2031+
prefix = prefix
20072032
),
20082033

20092034
# DESeq2
@@ -2015,10 +2040,9 @@ setGeneric("test_differential_abundance", function(.data,
20152040
.abundance = !!.abundance,
20162041
.contrasts = .contrasts,
20172042
method = method,
2018-
significance_threshold = significance_threshold,
2019-
fill_missing_values = fill_missing_values,
20202043
scaling_method = scaling_method,
2021-
omit_contrast_in_colnames = omit_contrast_in_colnames
2044+
omit_contrast_in_colnames = omit_contrast_in_colnames,
2045+
prefix = prefix
20222046
),
20232047

20242048
# Else error

R/methods_SE.R

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ setMethod("reduce_dimensions",
282282
dimension_2_column_rotated = NULL,
283283
action =
284284
"add") {
285-
# Get column names
285+
# Get column namest
286286
.element = enquo(.element)
287287

288288
# Parse other colnames
@@ -617,11 +617,15 @@ setMethod(
617617
.abundance = NULL,
618618
.contrasts = NULL,
619619
method = "edgeR_quasi_likelihood",
620-
significance_threshold = 0.05,
621-
fill_missing_values = FALSE,
622620
scaling_method = "TMM",
623621
omit_contrast_in_colnames = FALSE,
624-
action = "add")
622+
prefix = "",
623+
624+
action = "add",
625+
626+
# DEPRECATED
627+
significance_threshold = NULL,
628+
fill_missing_values = NULL)
625629
{
626630
# Make col names
627631
.sample = enquo(.sample)
@@ -641,8 +645,6 @@ setMethod(
641645
.abundance = !!.abundance,
642646
.contrasts = .contrasts,
643647
method = method,
644-
significance_threshold = significance_threshold,
645-
fill_missing_values = fill_missing_values,
646648
scaling_method = scaling_method,
647649
omit_contrast_in_colnames = omit_contrast_in_colnames,
648650
action = action

man/get_differential_transcript_abundance_bulk.Rd

Lines changed: 2 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/get_differential_transcript_abundance_bulk_voom.Rd

Lines changed: 2 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/get_differential_transcript_abundance_deseq2.Rd

Lines changed: 2 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/test_differential_abundance-methods.Rd

Lines changed: 30 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)