Skip to content
Merged

Dev #115

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
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: tidybulk
Title: Brings transcriptomics to the tidyverse
Version: 1.1.7
Version: 1.1.8
Authors@R: c(person("Stefano", "Mangiola", email = "mangiolastefano@gmail.com",
role = c("aut", "cre")),
person("Maria", "Doyle", email = "Maria.Doyle@petermac.org",
Expand Down
187 changes: 88 additions & 99 deletions R/functions.R

Large diffs are not rendered by default.

62 changes: 43 additions & 19 deletions R/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,7 @@ setMethod("ensembl_to_symbol", "tidybulk", .ensembl_to_symbol)
#' @param fill_missing_values A boolean. Whether to fill missing sample/transcript values with the median of the transcript. This is rarely needed.
#' @param scaling_method A character string. The scaling method passed to the back-end function (i.e., edgeR::calcNormFactors; "TMM","TMMwsp","RLE","upperquartile")
#' @param omit_contrast_in_colnames If just one contrast is specified you can choose to omit the contrast label in the colnames.
#' @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.
#' @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).
#'
#' @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.
Expand Down Expand Up @@ -1920,12 +1921,15 @@ setGeneric("test_differential_abundance", function(.data,
.abundance = NULL,
.contrasts = NULL,
method = "edgeR_quasi_likelihood",
significance_threshold = 0.05,
fill_missing_values = FALSE,
scaling_method = "TMM",
omit_contrast_in_colnames = FALSE,

action = "add")
prefix = "",
action = "add",

# DEPRECATED
significance_threshold = NULL,
fill_missing_values = NULL
)
standardGeneric("test_differential_abundance"))

# Set internal
Expand All @@ -1936,12 +1940,16 @@ setGeneric("test_differential_abundance", function(.data,
.abundance = NULL,
.contrasts = NULL,
method = "edgeR_quasi_likelihood",
significance_threshold = 0.05,
fill_missing_values = FALSE,
scaling_method = "TMM",
omit_contrast_in_colnames = FALSE,

action = "add")
prefix = "",

action = "add",

# DEPRECATED
significance_threshold = NULL,
fill_missing_values = NULL
)
{
# Get column names
.sample = enquo(.sample)
Expand All @@ -1952,8 +1960,26 @@ setGeneric("test_differential_abundance", function(.data,
.transcript = col_names$.transcript
.abundance = col_names$.abundance

# 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 please look at the resulting statistics to do the filtering (e.g., filter(., FDR < 0.05))")

}

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

# Signal the deprecation to the user
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.")

}

# Clearly state what counts are used
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.")
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.")

# Validate data frame
if(do_validate()) {
Expand All @@ -1977,18 +2003,18 @@ setGeneric("test_differential_abundance", function(.data,
when(

# edgeR
grepl("edgeR", method) ~ get_differential_transcript_abundance_bulk(
tolower(method) %in% c("edger_quasi_likelihood", "edger_likelihood_ratio") ~
get_differential_transcript_abundance_bulk(
.,
.formula,
.sample = !!.sample,
.transcript = !!.transcript,
.abundance = !!.abundance,
.contrasts = .contrasts,
method = method,
significance_threshold = significance_threshold,
fill_missing_values = fill_missing_values,
scaling_method = scaling_method,
omit_contrast_in_colnames = omit_contrast_in_colnames
omit_contrast_in_colnames = omit_contrast_in_colnames,
prefix = prefix
),

# Voom
Expand All @@ -2000,10 +2026,9 @@ setGeneric("test_differential_abundance", function(.data,
.transcript = !!.transcript,
.abundance = !!.abundance,
.contrasts = .contrasts,
significance_threshold = significance_threshold,
fill_missing_values = fill_missing_values,
scaling_method = scaling_method,
omit_contrast_in_colnames = omit_contrast_in_colnames
omit_contrast_in_colnames = omit_contrast_in_colnames,
prefix = prefix
),

# DESeq2
Expand All @@ -2015,10 +2040,9 @@ setGeneric("test_differential_abundance", function(.data,
.abundance = !!.abundance,
.contrasts = .contrasts,
method = method,
significance_threshold = significance_threshold,
fill_missing_values = fill_missing_values,
scaling_method = scaling_method,
omit_contrast_in_colnames = omit_contrast_in_colnames
omit_contrast_in_colnames = omit_contrast_in_colnames,
prefix = prefix
),

# Else error
Expand Down
14 changes: 8 additions & 6 deletions R/methods_SE.R
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ setMethod("reduce_dimensions",
dimension_2_column_rotated = NULL,
action =
"add") {
# Get column names
# Get column namest
.element = enquo(.element)

# Parse other colnames
Expand Down Expand Up @@ -617,11 +617,15 @@ setMethod(
.abundance = NULL,
.contrasts = NULL,
method = "edgeR_quasi_likelihood",
significance_threshold = 0.05,
fill_missing_values = FALSE,
scaling_method = "TMM",
omit_contrast_in_colnames = FALSE,
action = "add")
prefix = "",

action = "add",

# DEPRECATED
significance_threshold = NULL,
fill_missing_values = NULL)
{
# Make col names
.sample = enquo(.sample)
Expand All @@ -641,8 +645,6 @@ setMethod(
.abundance = !!.abundance,
.contrasts = .contrasts,
method = method,
significance_threshold = significance_threshold,
fill_missing_values = fill_missing_values,
scaling_method = scaling_method,
omit_contrast_in_colnames = omit_contrast_in_colnames,
action = action
Expand Down
15 changes: 2 additions & 13 deletions man/get_differential_transcript_abundance_bulk.Rd

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

15 changes: 2 additions & 13 deletions man/get_differential_transcript_abundance_bulk_voom.Rd

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

15 changes: 2 additions & 13 deletions man/get_differential_transcript_abundance_deseq2.Rd

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

52 changes: 30 additions & 22 deletions man/test_differential_abundance-methods.Rd

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

Loading