diff --git a/NAMESPACE b/NAMESPACE index 76ba13106..5e021450c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -190,8 +190,6 @@ export(transformFeatures) export(transformSamples) export(unsplitByRanks) export(unsplitOn) -exportMethods("relabundance<-") -exportMethods(ZTransform) exportMethods(addAbundanceClass) exportMethods(addAlpha) exportMethods(addCCA) @@ -210,14 +208,11 @@ exportMethods(addNMF) exportMethods(addNotContaminantQC) exportMethods(addPCA) exportMethods(addPERMANOVA) -exportMethods(addPerSampleDominantFeatures) -exportMethods(addPerSampleDominantTaxa) exportMethods(addPrevalence) exportMethods(addPrevalentAbundance) exportMethods(addQC) exportMethods(addRDA) exportMethods(addRPCA) -exportMethods(addTaxonomyTree) exportMethods(agglomerateByModule) exportMethods(agglomerateByPrevalence) exportMethods(agglomerateByRank) @@ -225,43 +220,24 @@ exportMethods(agglomerateByRanks) exportMethods(agglomerateBySet) exportMethods(agglomerateByVariable) exportMethods(applyBySet) -exportMethods(bestDMNFit) -exportMethods(calculateDMN) exportMethods(calculateDMNgroup) -exportMethods(calculateJSD) -exportMethods(calculateOverlap) -exportMethods(calculateUnifrac) exportMethods(checkTaxonomy) -exportMethods(cluster) exportMethods(convertToBIOM) exportMethods(convertToMAE) exportMethods(convertToPhyloseq) exportMethods(convertToTreeSE) -exportMethods(countDominantFeatures) -exportMethods(countDominantTaxa) -exportMethods(estimateDivergence) -exportMethods(estimateDiversity) -exportMethods(estimateDominance) -exportMethods(estimateEvenness) -exportMethods(estimateFaith) -exportMethods(estimateRichness) -exportMethods(full_join) exportMethods(getAbundanceClass) exportMethods(getAbundant) exportMethods(getAlpha) -exportMethods(getBestDMNFit) exportMethods(getCCA) exportMethods(getCluster) exportMethods(getConditionallyLowAbundant) exportMethods(getCrossAssociation) -exportMethods(getDMN) exportMethods(getDPCoA) exportMethods(getDissimilarity) exportMethods(getDivergence) exportMethods(getDominant) exportMethods(getDysbiosis) -exportMethods(getExperimentCrossAssociation) -exportMethods(getExperimentCrossCorrelation) exportMethods(getHierarchyTree) exportMethods(getJointRPCA) exportMethods(getLDA) @@ -276,70 +252,30 @@ exportMethods(getPermanentlyLowAbundant) exportMethods(getPrevalence) exportMethods(getPrevalent) exportMethods(getPrevalentAbundance) -exportMethods(getPrevalentFeatures) -exportMethods(getPrevalentTaxa) exportMethods(getQC) exportMethods(getRDA) exportMethods(getRPCA) exportMethods(getRare) -exportMethods(getRareFeatures) -exportMethods(getRareTaxa) exportMethods(getReducedDimAttribute) exportMethods(getTaxonomyLabels) exportMethods(getTop) -exportMethods(getTopFeatures) -exportMethods(getTopTaxa) exportMethods(getUnique) -exportMethods(getUniqueFeatures) -exportMethods(getUniqueTaxa) -exportMethods(inner_join) exportMethods(isContaminant) exportMethods(isNotContaminant) -exportMethods(left_join) -exportMethods(makePhyloseqFromTreeSE) -exportMethods(makePhyloseqFromTreeSummarizedExperiment) -exportMethods(makeTreeSummarizedExperimentFromPhyloseq) exportMethods(mapTaxonomy) -exportMethods(meltAssay) exportMethods(meltSE) -exportMethods(mergeCols) -exportMethods(mergeFeatures) -exportMethods(mergeFeaturesByPrevalence) -exportMethods(mergeFeaturesByRank) -exportMethods(mergeRows) exportMethods(mergeSEs) -exportMethods(mergeSamples) -exportMethods(perSampleDominantFeatures) -exportMethods(perSampleDominantTaxa) exportMethods(performDMNgroupCV) exportMethods(rarefyAssay) -exportMethods(relAbundanceCounts) -exportMethods(relabundance) -exportMethods(right_join) -exportMethods(runJSD) -exportMethods(runOverlap) exportMethods(splitOn) -exportMethods(subsampleCounts) exportMethods(subsetBy) exportMethods(subsetByPrevalent) -exportMethods(subsetByPrevalentFeatures) -exportMethods(subsetByPrevalentTaxa) exportMethods(subsetByRare) -exportMethods(subsetByRareFeatures) -exportMethods(subsetByRareTaxa) -exportMethods(subsetFeatures) -exportMethods(subsetSamples) -exportMethods(subsetTaxa) exportMethods(summarizeDominance) exportMethods(summary) exportMethods(taxonomyRankEmpty) exportMethods(taxonomyRanks) -exportMethods(taxonomyTree) -exportMethods(testExperimentCrossAssociation) -exportMethods(testExperimentCrossCorrelation) exportMethods(transformAssay) -exportMethods(transformFeatures) -exportMethods(transformSamples) exportMethods(unsplitByRanks) exportMethods(unsplitOn) import(DelayedArray) @@ -390,12 +326,8 @@ importFrom(DelayedMatrixStats, rowSums2 ) importFrom(DirichletMultinomial, - AIC, - BIC, cvdmngroup, - dmn, - dmngroup, - laplace + dmngroup ) importFrom(IRanges, CharacterList, diff --git a/NEWS b/NEWS index d4fea466e..770709eea 100644 --- a/NEWS +++ b/NEWS @@ -244,3 +244,4 @@ Changes in version 1.21.x Changes in version 1.23.x + getTop: method = "prevalence" uses include.lowest = FALSE, the getPrevalence() default, so existing code can return different features. With the default detection = 0, every feature had prevalence 1 and the returned features were not the most prevalent ones; include.lowest = TRUE restores the previous counting. Passing sort or include.lowest no longer gives a duplicate-argument error (1.23.2, 2026-11-27) ++ Functions and argument names deprecated in 2024 or earlier are now defunct (#882) (2026-11-22) diff --git a/R/AllGenerics.R b/R/AllGenerics.R index c87422ce9..ed87fa85d 100644 --- a/R/AllGenerics.R +++ b/R/AllGenerics.R @@ -36,8 +36,7 @@ setGeneric( #' @export setGeneric("getDivergence", signature = c("x"), function( - x, assay.type = assay_name, assay_name = "counts", reference = "median", - method = "bray", ...) + x, assay.type = "counts", reference = "median", method = "bray", ...) standardGeneric("getDivergence")) #' @rdname addDysbiosis @@ -86,11 +85,6 @@ setGeneric("agglomerateByVariable", signature = "x", function(x, ...) setGeneric("agglomerateBySet", signature = "x", function(x, ...) standardGeneric("agglomerateBySet")) -#' @rdname calculateDMN -#' @export -setGeneric("calculateDMN", signature = c("x"), function(x, ...) - standardGeneric("calculateDMN")) - #' @rdname addCluster #' @export setGeneric("getCluster", signature = c("x"), @@ -160,9 +154,8 @@ setGeneric("getCrossAssociation", signature = c("x"), function(x, ...) #' @rdname getDominant #' @export setGeneric("getDominant",signature = c("x"), - function(x, assay.type = assay_name, assay_name = "counts", - group = rank, rank = NULL, other.name = "Other", n = NULL, - complete = TRUE, ...) + function(x, assay.type = "counts", group = NULL, other.name = "Other", + n = NULL, complete = TRUE, ...) standardGeneric("getDominant")) #' @rdname getDominant @@ -195,7 +188,7 @@ setGeneric("getRare", signature = "x", function(x, ...) #' @rdname getPrevalence #' @export setGeneric("getPrevalentAbundance", signature = "x", - function(x, assay.type = assay_name, assay_name = "relabundance", ...) + function(x, assay.type = "relabundance", ...) standardGeneric("getPrevalentAbundance")) #' @rdname getPrevalence @@ -295,8 +288,7 @@ setGeneric("getTop", signature = "x", function( x, top= 5L, method = c("mean", "sum", "median", "sd", "cv", "prevalence"), - assay.type = assay_name, assay_name = "counts", na.rm = TRUE, - sort = FALSE, ...) + assay.type = "counts", na.rm = TRUE, sort = FALSE, ...) standardGeneric("getTop")) #' @rdname taxonomy-methods @@ -342,33 +334,16 @@ setGeneric("addHierarchyTree", signature = "x", function(x, ...) setGeneric("transformAssay", signature = c("x"), function(x, ...) standardGeneric("transformAssay")) -#' @rdname calculateDMN -#' @export -setGeneric("getDMN", signature = "x", function(x, name = "DMN", ...) - standardGeneric("getDMN")) - -#' @rdname calculateDMN -#' @export -setGeneric("bestDMNFit", signature = "x", - function(x, name = "DMN", type = c("laplace","AIC","BIC"), ...) - standardGeneric("bestDMNFit")) - -#' @rdname calculateDMN +#' @rdname calculateDMNgroup #' @export setGeneric("calculateDMNgroup", signature = c("x"), function(x, ...) standardGeneric("calculateDMNgroup")) -#' @rdname calculateDMN +#' @rdname calculateDMNgroup #' @export setGeneric("performDMNgroupCV", signature = c("x"), function(x, ...) standardGeneric("performDMNgroupCV")) -#' @rdname calculateDMN -#' @export -setGeneric("getBestDMNFit", signature = "x", - function(x, name = "DMN", type = c("laplace","AIC","BIC"), ...) - standardGeneric("getBestDMNFit")) - NULL setGeneric(".estimate_dominance", signature = c("x"), function(x, ...) standardGeneric(".estimate_dominance")) diff --git a/R/addAlpha.R b/R/addAlpha.R index bdbc3cf8c..5d551f737 100644 --- a/R/addAlpha.R +++ b/R/addAlpha.R @@ -3,7 +3,9 @@ #' These functions estimates alpha diversity indices optionally using #' rarefaction. #' -#' @inheritParams calculateDMN +#' @param BPPARAM A +#' \code{\link[BiocParallel:BiocParallelParam-class]{BiocParallelParam}} +#' object specifying whether the calculation should be parallelized. #' #' @param x a \code{\link[SummarizedExperiment]{SummarizedExperiment}} object. #' diff --git a/R/addDivergence.R b/R/addDivergence.R index ec621b590..8117ac230 100644 --- a/R/addDivergence.R +++ b/R/addDivergence.R @@ -6,8 +6,6 @@ #' #' @param x a \code{\link[SummarizedExperiment]{SummarizedExperiment}} object. #' -#' @param assay_name Deprecated. Use \code{assay.type} instead. -#' #' @param reference \code{Character scalar}. A column name from #' \code{colData(x)} or either \code{"mean"} or \code{"median"}. If column name #' is specified, the column must include reference samples for each sample. @@ -103,9 +101,10 @@ setMethod("addDivergence", signature = c(x="SummarizedExperiment"), #' @export setMethod("getDivergence", signature = c(x="SummarizedExperiment"), function( - x, assay.type = assay_name, assay_name = "counts", - reference = "median", method = "bray", FUN = getDissimilarity, ...){ + x, assay.type = "counts", reference = "median", method = "bray", + FUN = getDissimilarity, ...){ ################### Input check ############### + .check_defunct_args(...names(), "assay_name") # Get altExp if user has specified x <- .check_and_get_altExp(x, ...) # Check assay.type diff --git a/R/agglomerate.R b/R/agglomerate.R index 7ca3aa1ea..10106a3bc 100644 --- a/R/agglomerate.R +++ b/R/agglomerate.R @@ -58,10 +58,6 @@ #' \code{empty.fields} in specified \code{rank} will be excluded. #' (Default: \code{TRUE}) #' -#' @param agglomerateTree Deprecated. Use \code{update.tree} instead. -#' -#' @param agglomerate.tree Deprecated. Use \code{update.tree} instead. -#' #' @param ... arguments passed to \code{agglomerateByRank} function for #' \code{SummarizedExperiment} objects, #' to \code{\link[=agglomerate-methods]{agglomerateByVariable}}, @@ -113,8 +109,6 @@ #' nested alternative experiments by default. (Default: #' \code{TRUE}) #' -#' @param strip_altexp Deprecated. Use \code{altexp.rm} instead. -#' #' @param by \code{Character scalar}. Determines if data is merged #' row-wise / for features ('rows') or column-wise / for samples ('cols'). #' Must be \code{'rows'} or \code{'cols'}. @@ -129,8 +123,6 @@ #' specify one or several names of numeric or logical variables from the #' \code{rowData(x)/colData(x)} by which to agglomerate rows or columns. #' -#' @param f Deprecated. Use \code{group} instead. -#' #' @param update.tree \code{Logical scalar}. Should #' \code{rowTree()} also be agglomerated? Each group is collapsed into the #' most recent common ancestor of its features. This requires that groups are @@ -138,8 +130,6 @@ #' removed with a warning. If \code{FALSE}, the tree is removed. #' (Default: \code{FALSE}) #' -#' @param mergeTree Deprecated. Use \code{update.tree} instead. -#' #' @examples #' #' ### Agglomerate data based on taxonomic information @@ -267,9 +257,10 @@ NULL #' @export setMethod( "agglomerateByRank", signature = c(x = "TreeSummarizedExperiment"), - function(x, rank = taxonomyRanks(x)[1], update.tree = agglomerateTree, - agglomerate.tree = agglomerateTree, agglomerateTree = FALSE, ...){ + function(x, rank = taxonomyRanks(x)[1], update.tree = FALSE, ...){ # Input check + .check_defunct_args( + ...names(), c("agglomerateTree", "agglomerate.tree")) if(!.is_a_bool(update.tree)){ stop("'update.tree' must be TRUE or FALSE.", call. = FALSE) } @@ -285,9 +276,10 @@ setMethod( #' @export setMethod( "agglomerateByRank", signature = c(x = "SingleCellExperiment"), - function(x, rank = taxonomyRanks(x)[1], altexp = NULL, - altexp.rm = strip_altexp, strip_altexp = TRUE, ...){ + function(x, rank = taxonomyRanks(x)[1], altexp = NULL, altexp.rm = TRUE, + ...){ # Input check + .check_defunct_args(...names(), "strip_altexp") if(!.is_a_bool(altexp.rm)){ stop("'altexp.rm' must be TRUE or FALSE.", call. = FALSE) } @@ -391,8 +383,8 @@ setMethod("agglomerateByRank", signature = c(x = "SummarizedExperiment"), #' @export setMethod("agglomerateByVariable", signature = c(x = "TreeSummarizedExperiment"), - function(x, by, group = f, f, update.tree = mergeTree, mergeTree = FALSE, - ...){ + function(x, by, group, update.tree = FALSE, ...){ + .check_defunct_args(...names(), c("f", "mergeTree")) # Check by by <- .check_MARGIN(by) # Get function based on by @@ -407,7 +399,8 @@ setMethod("agglomerateByVariable", #' @aliases agglomerateByVariable #' @export setMethod("agglomerateByVariable", signature = c(x = "SummarizedExperiment"), - function(x, by, group = f, f, ...){ + function(x, by, group, ...){ + .check_defunct_args(...names(), "f") # Check by by <- .check_MARGIN(by) # Agglomerate the data diff --git a/R/calculateDMM.R b/R/calculateDMM.R index 8f6c145c1..97f57b960 100644 --- a/R/calculateDMM.R +++ b/R/calculateDMM.R @@ -11,26 +11,12 @@ #' @param assay.type \code{Character scalar}. Specifies the name of the #' assay used in calculation. (Default: \code{"counts"}) #' -#' @param exprs_values Deprecated. Use \code{assay.type} instead. -#' -#' @param assay_name Deprecated. Use \code{assay.type} instead. -#' #' @param k \code{Numeric scalar}. The number of Dirichlet components to fit. #' See \code{\link[DirichletMultinomial:dmn]{dmn}}. (Default: \code{1}) #' -#' @param BPPARAM A -#' \code{\link[BiocParallel:BiocParallelParam-class]{BiocParallelParam}} -#' object specifying whether the calculation should be parallelized. -#' #' @param transposed \code{Logical scalar}. Is \code{x} transposed with samples #' in rows? (Default: \code{FALSE}) #' -#' @param type \code{Character scalar}. The type of measure used for the -#' goodness of fit. One of \sQuote{laplace}, \sQuote{AIC} or \sQuote{BIC}. -#' -#' @param name \code{Character scalar}. The name to store the result in -#' \code{\link[SummarizedExperiment:RangedSummarizedExperiment-class]{metadata}} -#' #' @param variable \code{Character scalar}. A variable from \code{colData} to #' use as a grouping variable. Must be a character of factor. #' @@ -40,12 +26,6 @@ #' @param ... optional arguments not used. #' #' @return -#' \code{calculateDMN} and \code{getDMN} return a list of \code{DMN} objects, -#' one element for each value of k provided. -#' -#' \code{bestDMNFit} returns the index for the best fit and \code{getBestDMNFit} -#' returns a single \code{DMN} object. -#' #' \code{calculateDMNgroup} returns a #' \code{\link[DirichletMultinomial:DMNGroup-class]{DMNGroup}} object #' @@ -62,7 +42,7 @@ #' @references #' \insertRef{Holmes2012}{mia} #' -#' @name calculateDMN +#' @name calculateDMNgroup #' #' @examples #' fl <- system.file(package="DirichletMultinomial", "extdata", "Twins.csv") @@ -107,7 +87,19 @@ #' bestModel@mixture$Weight NULL -#' @importFrom DirichletMultinomial dmn +# Used by miaViz::plotDMNFit() +.get_dmn_fit_FUN <- function(type){ + type <- match.arg(type, c("laplace","AIC","BIC")) + fit_FUN <- switch(type, + laplace = DirichletMultinomial::laplace, + AIC = DirichletMultinomial::AIC, + BIC = DirichletMultinomial::BIC) + fit_FUN +} + +# Fits DMN models with k components to a samples x features matrix +#' @importFrom BiocParallel SerialParam bplapply bpisup bpstart bpstop +#' getAutoBPPARAM setAutoBPPARAM #' @importFrom stats runif .calculate_DMN <- function(x, k = 1, BPPARAM = SerialParam(), seed = runif(1, 0, .Machine$integer.max), ...){ @@ -134,116 +126,6 @@ NULL ans } -#' @rdname calculateDMN -#' @export -setMethod("calculateDMN", signature = c(x = "ANY"), .calculate_DMN) - -#' @rdname calculateDMN -#' @export -setMethod("calculateDMN", signature = c(x = "SummarizedExperiment"), - function(x, assay.type = assay_name, assay_name = exprs_values, - exprs_values = "counts", transposed = FALSE, ...){ - .Deprecated(old="calculateDMN", new="cluster", - "Now calculateDMN is deprecated. - Use cluster with DMMParam parameter instead.") - mat <- assay(x, assay.type) - if(!transposed){ - mat <- t(mat) - } - calculateDMN(mat, ...) - } -) - -#' @rdname calculateDMN -#' @importFrom S4Vectors metadata<- -#' @export -runDMN <- function(x, name = "DMN", ...){ - .Deprecated(old="runDMN", new="cluster", - "Now runDMN is deprecated. - Use cluster with DMMParam parameter instead.") - if(!is(x,"SummarizedExperiment")){ - stop("'x' must be a SummarizedExperiment") - } - metadata(x)[[name]] <- calculateDMN(x, ...) - x -} - -################################################################################ -# accessors - -#' @importFrom S4Vectors metadata -.get_dmn <- function(x, name){ - dmn <- metadata(x)[[name]] - if(is.null(dmn)){ - stop("No data found for '",name,"'.", call. = FALSE) - } - all_dmn <- vapply(dmn, is, logical(1), "DMN") - if(!all(all_dmn)){ - stop("'name' does not a list of DMN objects.", call. = FALSE) - } - dmn -} - -.get_dmn_fit_FUN <- function(type){ - type <- match.arg(type, c("laplace","AIC","BIC")) - fit_FUN <- switch(type, - laplace = DirichletMultinomial::laplace, - AIC = DirichletMultinomial::AIC, - BIC = DirichletMultinomial::BIC) - fit_FUN -} - -#' @rdname calculateDMN -#' @importFrom DirichletMultinomial laplace AIC BIC -#' @export -setMethod("getDMN", signature = c(x = "SummarizedExperiment"), - function(x, name = "DMN"){ - .Deprecated(old="getDMN", new="cluster", - "Now getDMN is deprecated. - Use cluster with DMMParam parameter - and full parameter set as true instead.") - .get_dmn(x, name) - } -) - - -.get_best_dmn_fit <- function(dmn, fit_FUN){ - fit <- vapply(dmn, fit_FUN, numeric(1)) - which.min(fit) -} - -#' @rdname calculateDMN -#' @importFrom DirichletMultinomial laplace AIC BIC -#' @export -setMethod("bestDMNFit", signature = c(x = "SummarizedExperiment"), - function(x, name = "DMN", type = c("laplace","AIC","BIC")){ - .Deprecated(old="bestDMNFit", new="cluster", - "Now bestDMNFit is deprecated. - Use cluster with DMMParam parameter - and full parameter set as true instead.") - # - dmn <- getDMN(x, name) - fit_FUN <- .get_dmn_fit_FUN(type) - # - .get_best_dmn_fit(dmn, fit_FUN) - } -) - -#' @rdname calculateDMN -#' @importFrom DirichletMultinomial laplace AIC BIC -#' @export -setMethod("getBestDMNFit", signature = c(x = "SummarizedExperiment"), - function(x, name = "DMN", type = c("laplace","AIC","BIC")){ - .Deprecated(old="getBestDMNFit", new="cluster", - "Now getBestDMNFit is deprecated. - Use cluster with DMMParam parameter - and full parameter set as true instead.") - dmn <- getDMN(x, name) - fit_FUN <- .get_dmn_fit_FUN(type) - dmn[[.get_best_dmn_fit(dmn, fit_FUN)]] - } -) - ################################################################################ # DMN group @@ -262,16 +144,15 @@ setMethod("getBestDMNFit", signature = c(x = "SummarizedExperiment"), dmngroup(x, variable, k = k, seed = seed, ...) } -#' @rdname calculateDMN +#' @rdname calculateDMNgroup #' @export setMethod("calculateDMNgroup", signature = c(x = "ANY"), .calculate_DMNgroup) -#' @rdname calculateDMN +#' @rdname calculateDMNgroup #' @export setMethod("calculateDMNgroup", signature = c(x = "SummarizedExperiment"), function(x, variable, - assay.type = assay_name, assay_name = exprs_values, - exprs_values = "counts", transposed = FALSE, ...){ + assay.type = "counts", transposed = FALSE, ...){ mat <- assay(x, assay.type) if(!transposed){ mat <- t(mat) @@ -307,16 +188,15 @@ setMethod("calculateDMNgroup", signature = c(x = "SummarizedExperiment"), cvdmngroup(nrow(x), x, variable, k = k, seed = seed, ...) } -#' @rdname calculateDMN +#' @rdname calculateDMNgroup #' @export setMethod("performDMNgroupCV", signature = c(x = "ANY"), .perform_DMNgroup_cv) -#' @rdname calculateDMN +#' @rdname calculateDMNgroup #' @export setMethod("performDMNgroupCV", signature = c(x = "SummarizedExperiment"), function(x, variable, - assay.type = assay_name, assay_name = exprs_values, - exprs_values = "counts", transposed = FALSE, ...){ + assay.type = "counts", transposed = FALSE, ...){ mat <- assay(x, assay.type) if(!transposed){ mat <- t(mat) diff --git a/R/cluster.R b/R/cluster.R index a4c24df26..540bbbbca 100644 --- a/R/cluster.R +++ b/R/cluster.R @@ -18,15 +18,15 @@ #' row-wise / for features ('rows') or column-wise / for samples ('cols'). #' Must be \code{'rows'} or \code{'cols'}. #' -#' @param MARGIN Deprecated. Use \code{by} instead. -#' #' @param clust.col \code{Character scalar}. Indicates the name of the #' \code{rowData} (or \code{colData}) where the data will be stored. #' (Default: \code{"cluster"}) #' #' @param ... Additional parameters to use altExps for example #' @inheritParams bluster::clusterRows -#' @inheritParams runDMN +#' @param name \code{Character scalar}. The name to store the result in +#' \code{\link[SummarizedExperiment:RangedSummarizedExperiment-class]{metadata}} +#' #' @inheritParams transformAssay #' #' @@ -86,9 +86,8 @@ NULL #' @export setMethod("addCluster", signature = c(x = "SummarizedExperiment"), function( - x, BLUSPARAM, assay.type = assay_name, - assay_name = NULL, by = MARGIN, MARGIN = "rows", - name = "clustering", clust.col = "cluster", full = FALSE, ...){ + x, BLUSPARAM, assay.type = NULL, by = "rows", name = "clustering", + clust.col = "cluster", full = FALSE, ...){ by <- .check_MARGIN(by) if( !.is_a_string(name) ){ stop("'name' must be a non-empty single character value.", @@ -126,8 +125,7 @@ setMethod("addCluster", signature = c(x = "SummarizedExperiment"), #' @export setMethod("addCluster", signature = c(x = "SingleCellExperiment"), function( - x, BLUSPARAM, assay.type = assay_name, - assay_name = NULL, dimred = NULL, by = MARGIN, MARGIN = "rows", + x, BLUSPARAM, assay.type = NULL, dimred = NULL, by = "rows", name = "clustering", clust.col = "cluster", full = FALSE, ...){ by <- .check_MARGIN(by) if( !.is_a_string(name) ){ @@ -170,8 +168,7 @@ setMethod("addCluster", signature = c(x = "SingleCellExperiment"), #' @export setMethod("getCluster", signature = c(x = "SummarizedExperiment"), function( - x, BLUSPARAM, assay.type = assay_name, - assay_name = NULL, by = MARGIN, MARGIN = "rows", ...){ + x, BLUSPARAM, assay.type = NULL, by = "rows", ...){ # Checking parameters by <- .check_MARGIN(by) x <- .check_and_get_altExp(x, ...) @@ -190,9 +187,7 @@ setMethod("getCluster", signature = c(x = "SummarizedExperiment"), #' @export setMethod("getCluster", signature = c(x = "SingleCellExperiment"), function( - x, BLUSPARAM, assay.type = assay_name, - assay_name = NULL, dimred = NULL, by = MARGIN, MARGIN = "rows", - ...){ + x, BLUSPARAM, assay.type = NULL, dimred = NULL, by = "rows", ...){ # Checking parameters by <- .check_MARGIN(by) x <- .check_and_get_altExp(x, ...) @@ -228,7 +223,8 @@ setMethod("getCluster", signature = c(x = "SingleCellExperiment"), #' @export #' @importFrom bluster clusterRows setMethod("getCluster", signature = c(x = "ANY"), - function(x, BLUSPARAM, by = MARGIN, MARGIN = "rows", full = FALSE, ...){ + function(x, BLUSPARAM, by = "rows", full = FALSE, ...){ + .check_defunct_args(...names(), c("assay_name", "MARGIN")) .require_package("bluster") if( !is.matrix(x) ){ stop("'x' must be a matrix.", call. = FALSE) diff --git a/R/convertFromBIOM.R b/R/convertFromBIOM.R index e0e71797b..ebbec2da4 100644 --- a/R/convertFromBIOM.R +++ b/R/convertFromBIOM.R @@ -13,20 +13,14 @@ #' taxa columns meaning that \code{rank.from.prefix} should be enabled in the #' most cases. (Default: \code{FALSE}) #' -#' @param removeTaxaPrefixes Deprecated. Use \code{prefix.rm} instead. -#' #' @param rank.from.prefix \code{Logical scalar}. If file does not have #' taxonomic ranks on feature table, should they be scraped from prefixes? #' (Default: \code{FALSE}) #' -#' @param rankFromPrefix Deprecated.Use \code{rank.from.prefix} instead. -#' #' @param artifact.rm \code{Logical scalar}. If file have #' some taxonomic character naming artifacts, should they be removed. #' (default (Default: \code{FALSE}) #' -#' @param remove.artifacts Deprecated. Use \code{artifact.rm} instead. -#' #' @details #' \code{convertFromBIOM} coerces a \code{\link[biomformat:biom-class]{biom}} #' object to a @@ -156,11 +150,11 @@ importBIOM <- function(file, col.data = NULL, tree.file = NULL, ...) { #' @importFrom S4Vectors make_zero_col_DFrame DataFrame #' @importFrom dplyr %>% bind_rows convertFromBIOM <- function( - x, prefix.rm = removeTaxaPrefixes, - removeTaxaPrefixes = FALSE, rank.from.prefix = rankFromPrefix, - rankFromPrefix = FALSE, - artifact.rm = remove.artifacts, remove.artifacts = FALSE, ...){ + x, prefix.rm = FALSE, rank.from.prefix = FALSE, artifact.rm = FALSE, + ...){ # input check + .check_defunct_args(...names(), c( + "removeTaxaPrefixes", "rankFromPrefix", "remove.artifacts")) .require_package("biomformat") if(!is(x,"biom")){ stop("'x' must be a 'biom' object", call. = FALSE) diff --git a/R/convertToPhyloseq.R b/R/convertToPhyloseq.R index 82c1ed507..5b79cd949 100644 --- a/R/convertToPhyloseq.R +++ b/R/convertToPhyloseq.R @@ -9,15 +9,11 @@ #' @param assay.type \code{Character scalar}. Specifies the name of assay #' used. (Default: \code{"counts"}) #' -#' @param assay_name Deprecated. Use \code{assay.type} instead. -#' #' @param tree.name \code{NULL} or \code{Character scalar}. Specifies the name #' of the tree to be included in the phyloseq object that is created. If #' \code{NULL}, no tree is included. As phyloseq orders the features by the #' tips of the tree, this keeps the feature order of \code{x}. #' (Default: \code{"phylo"}) -#' -#' @param tree_name Deprecated. Use \code{tree.name} instead. #' #' @details #' \code{convertToPhyloseq} creates a phyloseq object from a @@ -62,8 +58,9 @@ NULL #' @rdname convertFromPhyloseq #' @export setMethod("convertToPhyloseq", signature = c(x = "SummarizedExperiment"), - function(x, assay.type = "counts", assay_name = NULL, ...){ + function(x, assay.type = "counts", ...){ # Input check + .check_defunct_args(...names(), c("assay_name", "tree_name")) .require_package("phyloseq") # Check that tse do not have zero rows if(!all(dim(x) > 0)){ @@ -71,11 +68,6 @@ setMethod("convertToPhyloseq", signature = c(x = "SummarizedExperiment"), to a phyloseq object.", call. = FALSE) } - if (!is.null(assay_name)) { - .Deprecated(old="assay_name", new="assay.type", - "Now assay_name is deprecated. Use assay.type instead.") - } - # Check assay.type .check_assay_present(assay.type, x) @@ -122,7 +114,7 @@ setMethod("convertToPhyloseq", signature = c(x = "SummarizedExperiment"), #' @rdname convertFromPhyloseq #' @export setMethod("convertToPhyloseq", signature = c(x = "TreeSummarizedExperiment"), - function(x, tree.name = tree_name, tree_name = "phylo", ...){ + function(x, tree.name = "phylo", ...){ # If rowTrees exist, check tree.name. With tree.name = NULL, the tree # is not added, so phyloseq does not reorder the features by its tips. if( length(rowTreeNames(x)) > 0 && !is.null(tree.name) ){ diff --git a/R/decontam.R b/R/decontam.R index a4b330672..a89e8e480 100644 --- a/R/decontam.R +++ b/R/decontam.R @@ -95,7 +95,7 @@ NULL setMethod("isContaminant", signature = c(seqtab = "SummarizedExperiment"), function( seqtab, - assay.type = assay_name, assay_name = "counts", + assay.type = "counts", concentration = NULL, control = NULL, batch = NULL, @@ -104,6 +104,7 @@ setMethod("isContaminant", signature = c(seqtab = "SummarizedExperiment"), detailed = TRUE, ...){ # input check + .check_defunct_args(...names(), "assay_name") .check_assay_present(assay.type, seqtab) if(!is.numeric(threshold) || length(threshold) != 1L){ stop("'threshold' must be single numeric value.", call. = FALSE) @@ -144,13 +145,14 @@ setMethod("isContaminant", signature = c(seqtab = "SummarizedExperiment"), setMethod("isNotContaminant", signature = c(seqtab = "SummarizedExperiment"), function( seqtab, - assay.type = assay_name, assay_name = "counts", + assay.type = "counts", control = NULL, threshold = 0.5, normalize = TRUE, detailed = TRUE, ...){ # input check + .check_defunct_args(...names(), "assay_name") .check_assay_present(assay.type, seqtab) if(!is.numeric(threshold) || length(threshold) != 1L){ stop("'threshold' must be single numeric value.", call. = FALSE) diff --git a/R/defunct.R b/R/defunct.R new file mode 100644 index 000000000..a56b31fa9 --- /dev/null +++ b/R/defunct.R @@ -0,0 +1,440 @@ +#' Defunct functions in mia +#' +#' These functions were deprecated and are now defunct. Calling them gives an +#' error that names the replacement. +#' +#' @details +#' The functions and their replacements: +#' \itemize{ +#' \item \code{addPerSampleDominantFeatures}, \code{addPerSampleDominantTaxa}: +#' \code{\link{addDominant}} +#' \item \code{addTaxonomyTree}: \code{\link{addHierarchyTree}} +#' \item \code{bestDMNFit}, \code{getBestDMNFit}, \code{getDMN}, +#' \code{runDMN}, and \code{calculateDMN} for a +#' \code{SummarizedExperiment}: \code{\link{addCluster}} with +#' \code{bluster::DmmParam()} +#' \item \code{calculateJSD}, \code{runJSD}: \code{\link{getDissimilarity}} +#' with \code{method = "jsd"} +#' \item \code{calculateOverlap}: \code{\link{getDissimilarity}} with +#' \code{method = "overlap"} +#' \item \code{calculateUnifrac}, \code{runUnifrac}: +#' \code{\link{getDissimilarity}} with \code{method = "unifrac"} +#' \item \code{cluster}: \code{\link{addCluster}} +#' \item \code{countDominantFeatures}, \code{countDominantTaxa}: +#' \code{\link{summarizeDominance}} +#' \item \code{estimateDiversity}, \code{estimateDominance}, +#' \code{estimateEvenness}, \code{estimateFaith}, \code{estimateRichness}: +#' \code{\link{addAlpha}} +#' \item \code{estimateDivergence}: \code{\link{addDivergence}} +#' \item \code{full_join}, \code{inner_join}, \code{left_join}, +#' \code{right_join}: \code{\link{mergeSEs}} with \code{join} +#' \item \code{getExperimentCrossAssociation}, +#' \code{getExperimentCrossCorrelation}, +#' \code{testExperimentCrossAssociation}, +#' \code{testExperimentCrossCorrelation}: \code{\link{getCrossAssociation}} +#' \item \code{getPrevalentFeatures}, \code{getPrevalentTaxa}: +#' \code{\link{getPrevalent}} +#' \item \code{getRareFeatures}, \code{getRareTaxa}: \code{\link{getRare}} +#' \item \code{getTopFeatures}, \code{getTopTaxa}: \code{\link{getTop}} +#' \item \code{getUniqueFeatures}, \code{getUniqueTaxa}: +#' \code{\link{getUnique}} +#' \item \code{loadFromBiom}: \code{\link{importBIOM}} +#' \item \code{loadFromHumann}: \code{\link{importHUMAnN}} +#' \item \code{loadFromMetaphlan}: \code{\link{importMetaPhlAn}} +#' \item \code{loadFromMothur}: \code{\link{importMothur}} +#' \item \code{loadFromQIIME2}: \code{\link{importQIIME2}} +#' \item \code{makePhyloseqFromTreeSE}, +#' \code{makePhyloseqFromTreeSummarizedExperiment}: +#' \code{\link{convertToPhyloseq}} +#' \item \code{makeTreeSEFromBiom}, +#' \code{makeTreeSummarizedExperimentFromBiom}: +#' \code{\link{convertFromBIOM}} +#' \item \code{makeTreeSEFromDADA2}, +#' \code{makeTreeSummarizedExperimentFromDADA2}: +#' \code{\link{convertFromDADA2}} +#' \item \code{makeTreeSEFromPhyloseq}, +#' \code{makeTreeSummarizedExperimentFromPhyloseq}: +#' \code{\link{convertFromPhyloseq}} +#' \item \code{meltAssay}: \code{\link{meltSE}} +#' \item \code{mergeCols}, \code{mergeSamples}: +#' \code{\link{agglomerateByVariable}} with \code{by = "cols"} +#' \item \code{mergeFeatures}, \code{mergeRows}: +#' \code{\link{agglomerateByVariable}} with \code{by = "rows"} +#' \item \code{mergeFeaturesByPrevalence}: \code{\link{subsetBy}} with +#' \code{collapse = TRUE} +#' \item \code{mergeFeaturesByRank}: \code{\link{agglomerateByRank}} +#' \item \code{perSampleDominantFeatures}, \code{perSampleDominantTaxa}: +#' \code{\link{getDominant}} +#' \item \code{plotNMDS}: \code{scater::plotReducedDim} with +#' \code{dimred = "NMDS"} +#' \item \code{readQZA}: \code{\link{importQZA}} +#' \item \code{relabundance}, \code{relabundance<-}: +#' \code{assay(x, "relabundance")} +#' \item \code{runOverlap}: \code{\link{addDissimilarity}} with +#' \code{method = "overlap"} +#' \item \code{subsampleCounts}: \code{\link{rarefyAssay}} +#' \item \code{subsetByPrevalentFeatures}, \code{subsetByPrevalentTaxa}, +#' \code{subsetByRareFeatures}, \code{subsetByRareTaxa}: +#' \code{\link{subsetBy}} +#' \item \code{subsetFeatures}, \code{subsetSamples}, \code{subsetTaxa}: +#' \code{[} for subsetting +#' \item \code{transformCounts}, \code{transformFeatures}, +#' \code{transformSamples}, \code{relAbundanceCounts}, \code{ZTransform}: +#' \code{\link{transformAssay}} +#' } +#' +#' @param x Ignored. +#' +#' @param value Ignored. +#' +#' @param ... Ignored. +#' +#' @return These functions do not return; they give an error. +#' +#' @name mia-defunct +NULL + +# Returns a defunct stub. 'new' is the replacement as shown in the message. +.defunct <- function(old, new){ + msg <- paste0("'", old, "' is defunct. Use ", new, " instead.") + function(...) .Defunct(msg = msg) +} + +#' @rdname mia-defunct +#' @export +addPerSampleDominantFeatures <- .defunct( + "addPerSampleDominantFeatures", "'addDominant'") + +#' @rdname mia-defunct +#' @export +addPerSampleDominantTaxa <- .defunct( + "addPerSampleDominantTaxa", "'addDominant'") + +#' @rdname mia-defunct +#' @export +addTaxonomyTree <- .defunct("addTaxonomyTree", "'addHierarchyTree'") + +#' @rdname mia-defunct +#' @export +bestDMNFit <- .defunct( + "bestDMNFit", "'addCluster' with 'bluster::DmmParam()' and full = TRUE") + +#' @rdname mia-defunct +#' @export +calculateJSD <- .defunct( + "calculateJSD", "'getDissimilarity' with method = 'jsd'") + +#' @rdname mia-defunct +#' @export +calculateOverlap <- .defunct( + "calculateOverlap", "'getDissimilarity' with method = 'overlap'") + +#' @rdname mia-defunct +#' @export +calculateUnifrac <- .defunct( + "calculateUnifrac", "'getDissimilarity' with method = 'unifrac'") + +#' @rdname mia-defunct +#' @export +cluster <- .defunct("cluster", "'addCluster'") + +#' @rdname mia-defunct +#' @export +countDominantFeatures <- .defunct( + "countDominantFeatures", "'summarizeDominance'") + +#' @rdname mia-defunct +#' @export +countDominantTaxa <- .defunct("countDominantTaxa", "'summarizeDominance'") + +#' @rdname mia-defunct +#' @export +estimateDivergence <- .defunct("estimateDivergence", "'addDivergence'") + +#' @rdname mia-defunct +#' @export +estimateDiversity <- .defunct("estimateDiversity", "'addAlpha'") + +#' @rdname mia-defunct +#' @export +estimateDominance <- .defunct("estimateDominance", "'addAlpha'") + +#' @rdname mia-defunct +#' @export +estimateEvenness <- .defunct("estimateEvenness", "'addAlpha'") + +#' @rdname mia-defunct +#' @export +estimateFaith <- .defunct("estimateFaith", "'addAlpha'") + +#' @rdname mia-defunct +#' @export +estimateRichness <- .defunct("estimateRichness", "'addAlpha'") + +#' @rdname mia-defunct +#' @export +full_join <- .defunct("full_join", "'mergeSEs' with join = 'full'") + +#' @rdname mia-defunct +#' @export +getBestDMNFit <- .defunct( + "getBestDMNFit", "'addCluster' with 'bluster::DmmParam()' and full = TRUE") + +#' @rdname mia-defunct +#' @export +getDMN <- .defunct( + "getDMN", "'addCluster' with 'bluster::DmmParam()' and full = TRUE") + +#' @rdname mia-defunct +#' @export +getExperimentCrossAssociation <- .defunct( + "getExperimentCrossAssociation", "'getCrossAssociation'") + +#' @rdname mia-defunct +#' @export +getExperimentCrossCorrelation <- .defunct( + "getExperimentCrossCorrelation", "'getCrossAssociation'") + +#' @rdname mia-defunct +#' @export +getPrevalentFeatures <- .defunct("getPrevalentFeatures", "'getPrevalent'") + +#' @rdname mia-defunct +#' @export +getPrevalentTaxa <- .defunct("getPrevalentTaxa", "'getPrevalent'") + +#' @rdname mia-defunct +#' @export +getRareFeatures <- .defunct("getRareFeatures", "'getRare'") + +#' @rdname mia-defunct +#' @export +getRareTaxa <- .defunct("getRareTaxa", "'getRare'") + +#' @rdname mia-defunct +#' @export +getTopFeatures <- .defunct("getTopFeatures", "'getTop'") + +#' @rdname mia-defunct +#' @export +getTopTaxa <- .defunct("getTopTaxa", "'getTop'") + +#' @rdname mia-defunct +#' @export +getUniqueFeatures <- .defunct("getUniqueFeatures", "'getUnique'") + +#' @rdname mia-defunct +#' @export +getUniqueTaxa <- .defunct("getUniqueTaxa", "'getUnique'") + +#' @rdname mia-defunct +#' @export +inner_join <- .defunct("inner_join", "'mergeSEs' with join = 'inner'") + +#' @rdname mia-defunct +#' @export +left_join <- .defunct("left_join", "'mergeSEs' with join = 'left'") + +#' @rdname mia-defunct +#' @export +loadFromBiom <- .defunct("loadFromBiom", "'importBIOM'") + +#' @rdname mia-defunct +#' @export +loadFromHumann <- .defunct("loadFromHumann", "'importHUMAnN'") + +#' @rdname mia-defunct +#' @export +loadFromMetaphlan <- .defunct("loadFromMetaphlan", "'importMetaPhlAn'") + +#' @rdname mia-defunct +#' @export +loadFromMothur <- .defunct("loadFromMothur", "'importMothur'") + +#' @rdname mia-defunct +#' @export +loadFromQIIME2 <- .defunct("loadFromQIIME2", "'importQIIME2'") + +#' @rdname mia-defunct +#' @export +makePhyloseqFromTreeSE <- .defunct( + "makePhyloseqFromTreeSE", "'convertToPhyloseq'") + +#' @rdname mia-defunct +#' @export +makePhyloseqFromTreeSummarizedExperiment <- .defunct( + "makePhyloseqFromTreeSummarizedExperiment", "'convertToPhyloseq'") + +#' @rdname mia-defunct +#' @export +makeTreeSEFromBiom <- .defunct("makeTreeSEFromBiom", "'convertFromBIOM'") + +#' @rdname mia-defunct +#' @export +makeTreeSEFromDADA2 <- .defunct("makeTreeSEFromDADA2", "'convertFromDADA2'") + +#' @rdname mia-defunct +#' @export +makeTreeSEFromPhyloseq <- .defunct( + "makeTreeSEFromPhyloseq", "'convertFromPhyloseq'") + +#' @rdname mia-defunct +#' @export +makeTreeSummarizedExperimentFromBiom <- .defunct( + "makeTreeSummarizedExperimentFromBiom", "'convertFromBIOM'") + +#' @rdname mia-defunct +#' @export +makeTreeSummarizedExperimentFromDADA2 <- .defunct( + "makeTreeSummarizedExperimentFromDADA2", "'convertFromDADA2'") + +#' @rdname mia-defunct +#' @export +makeTreeSummarizedExperimentFromPhyloseq <- .defunct( + "makeTreeSummarizedExperimentFromPhyloseq", "'convertFromPhyloseq'") + +#' @rdname mia-defunct +#' @export +meltAssay <- .defunct("meltAssay", "'meltSE'") + +#' @rdname mia-defunct +#' @export +mergeCols <- .defunct("mergeCols", "'agglomerateByVariable' with by = 'cols'") + +#' @rdname mia-defunct +#' @export +mergeFeatures <- .defunct( + "mergeFeatures", "'agglomerateByVariable' with by = 'rows'") + +#' @rdname mia-defunct +#' @export +mergeFeaturesByPrevalence <- .defunct( + "mergeFeaturesByPrevalence", "'subsetBy' with collapse = TRUE") + +#' @rdname mia-defunct +#' @export +mergeFeaturesByRank <- .defunct("mergeFeaturesByRank", "'agglomerateByRank'") + +#' @rdname mia-defunct +#' @export +mergeRows <- .defunct("mergeRows", "'agglomerateByVariable' with by = 'rows'") + +#' @rdname mia-defunct +#' @export +mergeSamples <- .defunct( + "mergeSamples", "'agglomerateByVariable' with by = 'cols'") + +#' @rdname mia-defunct +#' @export +perSampleDominantFeatures <- .defunct( + "perSampleDominantFeatures", "'getDominant'") + +#' @rdname mia-defunct +#' @export +perSampleDominantTaxa <- .defunct("perSampleDominantTaxa", "'getDominant'") + +#' @rdname mia-defunct +#' @export +plotNMDS <- .defunct( + "plotNMDS", "'scater::plotReducedDim' with dimred = 'NMDS'") + +#' @rdname mia-defunct +#' @export +readQZA <- .defunct("readQZA", "'importQZA'") + +#' @rdname mia-defunct +#' @export +relabundance <- .defunct("relabundance", "assay(x, 'relabundance')") + +#' @rdname mia-defunct +#' @export +`relabundance<-` <- function(x, value) relabundance() + +#' @rdname mia-defunct +#' @export +relAbundanceCounts <- .defunct("relAbundanceCounts", "'transformAssay'") + +#' @rdname mia-defunct +#' @export +right_join <- .defunct("right_join", "'mergeSEs' with join = 'right'") + +#' @rdname mia-defunct +#' @export +runDMN <- .defunct("runDMN", "'addCluster' with 'bluster::DmmParam()'") + +#' @rdname mia-defunct +#' @export +runJSD <- .defunct("runJSD", "'getDissimilarity' with method = 'jsd'") + +#' @rdname mia-defunct +#' @export +runOverlap <- .defunct( + "runOverlap", "'addDissimilarity' with method = 'overlap'") + +#' @rdname mia-defunct +#' @export +runUnifrac <- .defunct( + "runUnifrac", "'getDissimilarity' with method = 'unifrac'") + +#' @rdname mia-defunct +#' @export +subsampleCounts <- .defunct("subsampleCounts", "'rarefyAssay'") + +#' @rdname mia-defunct +#' @export +subsetByPrevalentFeatures <- .defunct( + "subsetByPrevalentFeatures", "'subsetBy'") + +#' @rdname mia-defunct +#' @export +subsetByPrevalentTaxa <- .defunct("subsetByPrevalentTaxa", "'subsetBy'") + +#' @rdname mia-defunct +#' @export +subsetByRareFeatures <- .defunct("subsetByRareFeatures", "'subsetBy'") + +#' @rdname mia-defunct +#' @export +subsetByRareTaxa <- .defunct("subsetByRareTaxa", "'subsetBy'") + +#' @rdname mia-defunct +#' @export +subsetFeatures <- .defunct("subsetFeatures", "'[]' for subsetting") + +#' @rdname mia-defunct +#' @export +subsetSamples <- .defunct("subsetSamples", "'[]' for subsetting") + +#' @rdname mia-defunct +#' @export +subsetTaxa <- .defunct("subsetTaxa", "'[]' for subsetting") + +#' @rdname mia-defunct +#' @export +taxonomyTree <- .defunct("taxonomyTree", "'getHierarchyTree'") + +#' @rdname mia-defunct +#' @export +testExperimentCrossAssociation <- .defunct( + "testExperimentCrossAssociation", "'getCrossAssociation'") + +#' @rdname mia-defunct +#' @export +testExperimentCrossCorrelation <- .defunct( + "testExperimentCrossCorrelation", "'getCrossAssociation'") + +#' @rdname mia-defunct +#' @export +transformCounts <- .defunct("transformCounts", "'transformAssay'") + +#' @rdname mia-defunct +#' @export +transformFeatures <- .defunct("transformFeatures", "'transformAssay'") + +#' @rdname mia-defunct +#' @export +transformSamples <- .defunct("transformSamples", "'transformAssay'") + +#' @rdname mia-defunct +#' @export +ZTransform <- .defunct("ZTransform", "'transformAssay'") diff --git a/R/deprecate.R b/R/deprecate.R index 09eb1953c..c5f2e2638 100644 --- a/R/deprecate.R +++ b/R/deprecate.R @@ -3,66 +3,26 @@ #' @param x A #' \code{\link[SummarizedExperiment:SummarizedExperiment-class]{SummarizedExperiment}} #' object. -#' @param value a matrix to store as the \sQuote{relabundance} assay #' -#' @param mat An abundance matrix -#' -#' @param tree A phylogenetic tree -#' #' @param ... Additional parameters. See dedicated function. #' +#' @seealso \code{\link{mia-defunct}} for the functions that are defunct. +#' #' @name deprecate NULL #' @rdname deprecate #' @export -setGeneric("cluster", signature = c("x"), - function(x,...) - standardGeneric("cluster")) - -#' @rdname deprecate -#' @export -setMethod("cluster", signature = c(x = "SummarizedExperiment"), - function(x,...){ - .Deprecated(msg = paste0("'cluster' is deprecated. ", - "Use 'addCluster' instead.")) - addCluster(x,...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("addTaxonomyTree", - signature = "x", - function(x, ...) - standardGeneric("addTaxonomyTree")) - -#' @rdname deprecate -#' @export -setMethod("addTaxonomyTree", signature = c(x = "SummarizedExperiment"), - function(x,...){ - .Deprecated(msg = paste0("'addTaxonomyTree' is deprecated. ", - "Use 'addHierarchyTree' instead.")) - addHierarchyTree(x,...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("taxonomyTree", - signature = "x", - function(x, ...) - standardGeneric("taxonomyTree")) - -#' @rdname deprecate -#' @export -setMethod("taxonomyTree", signature = c(x = "SummarizedExperiment"), - function(x,...){ - .Deprecated(msg = paste0("'taxonomyTree' is deprecated. ", - "Use 'getHierarchyTree' instead.")) - getHierarchyTree(x,...) - } -) +calculateDMN <- function(x, ...){ + if( is(x, "SummarizedExperiment") ){ + .Defunct(msg = paste0("'calculateDMN' is defunct for ", + "SummarizedExperiment. Use 'addCluster' with ", + "'bluster::DmmParam()' instead.")) + } + .Deprecated(msg = paste0("'calculateDMN' is deprecated. Use ", + "'bluster::clusterRows' with 'bluster::DmmParam()' instead.")) + .calculate_DMN(x, ...) +} #' @rdname deprecate #' @export @@ -81,1221 +41,6 @@ setMethod("agglomerateByModule", signature = c(x = "SummarizedExperiment"), } ) -#' @rdname deprecate -#' @export -setGeneric("mergeRows", - signature = "x", - function(x, ...) - standardGeneric("mergeRows")) - -#' @rdname deprecate -#' @export -setMethod("mergeRows", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'mergeRows' is deprecated. ", - "Use 'agglomerateByVariable' with ", - "parameter by = 'rows' instead.")) - agglomerateByVariable(x, by = "rows", ...) - } -) - -#' @rdname deprecate -#' @export -setMethod("mergeRows", signature = c(x = "TreeSummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'mergeRows' is deprecated. ", - "Use 'agglomerateByVariable' with ", - "parameter by = 'rows' instead.")) - agglomerateByVariable(x, by = "rows", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("mergeCols", - signature = "x", - function(x, ...) - standardGeneric("mergeCols")) - -#' @rdname deprecate -#' @export -setMethod("mergeCols", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'mergeCols' is deprecated. ", - "Use 'agglomerateByVariable' with ", - "parameter by = 'cols' instead.")) - agglomerateByVariable(x, by = "cols", ...) - } -) - -#' @rdname deprecate -#' @export -setMethod("mergeCols", signature = c(x = "TreeSummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'mergeCols' is deprecated. ", - "Use 'agglomerateByVariable' with ", - "parameter by = 'cols' instead.")) - agglomerateByVariable(x, by = "cols", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("mergeFeatures", - signature = "x", - function(x, ...) - standardGeneric("mergeFeatures")) - -#' @rdname deprecate -#' @export -setMethod("mergeFeatures", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'mergeFeatures' is deprecated. ", - "Use 'agglomerateByVariable' with ", - "parameter by = 'rows' instead.")) - agglomerateByVariable(x, by = "rows", ...) - } -) - -#' @rdname deprecate -#' @export -setMethod("mergeFeatures", signature = c(x = "TreeSummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'mergeFeatures' is deprecated. ", - "Use 'agglomerateByVariable' with ", - "parameter by = 'rows' instead.")) - agglomerateByVariable(x, by = "rows", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("mergeSamples", - signature = "x", - function(x, ...) - standardGeneric("mergeSamples")) - -#' @rdname deprecate -#' @export -setMethod("mergeSamples", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'mergeSamples' is deprecated. ", - "Use 'agglomerateByVariable' with ", - "parameter by = 'cols' instead.")) - agglomerateByVariable(x, by = "cols", ...) - } -) - -#' @rdname deprecate -#' @export -setMethod("mergeSamples", signature = c(x = "TreeSummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'mergeSamples' is deprecated. ", - "Use 'agglomerateByVariable' with ", - "parameter by = 'cols' instead.")) - agglomerateByVariable(x, by = "cols", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("mergeFeaturesByRank", - signature = "x", - function(x, ...) - standardGeneric("mergeFeaturesByRank")) - -#' @rdname deprecate -#' @export -setMethod("mergeFeaturesByRank", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'mergeFeaturesByRank' is deprecated. ", - "Use 'agglomerateByRank' instead.")) - x <- agglomerateByRank(x, ...) - x - } -) - -#' @rdname deprecate -#' @export -setMethod("mergeFeaturesByRank", signature = c(x = "SingleCellExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'mergeFeaturesByRank' is deprecated. ", - "Use 'agglomerateByRank' instead.")) - x <- agglomerateByRank(x, ...) - x - } -) - -#' @rdname deprecate -#' @export -setGeneric("mergeFeaturesByPrevalence", signature = "x", - function(x, ...) - standardGeneric("mergeFeaturesByPrevalence")) - -#' @rdname deprecate -#' @export -setMethod("mergeFeaturesByPrevalence", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0( - "'mergeFeaturesByPrevalence' is deprecated. ", - "Use 'subsetBy' with collapse = TRUE instead.")) - x <- .subset_by_prevalence(x, collapse = TRUE, ...) - x - } -) - -#' @rdname deprecate -#' @export -setGeneric("getExperimentCrossAssociation", signature = c("x"), - function(x, ...) - standardGeneric("getExperimentCrossAssociation")) - -#' @rdname deprecate -#' @export -setMethod("getExperimentCrossAssociation", - signature = c(x = "MultiAssayExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'getExperimentCrossAssociation' is ", - "deprecated. Use ", - "'getCrossAssociation' instead.")) - getCrossAssociation(x, ...) - } -) - -#' @rdname deprecate -#' @export -setMethod("getExperimentCrossAssociation", signature = "SummarizedExperiment", - function(x, ...){ - .Deprecated(msg = paste0("'getExperimentCrossAssociation' is ", - "deprecated. Use ", - "'getCrossAssociation' instead.")) - getCrossAssociation(x, ...) - } -) - -#' @rdname deprecate -#' @export -setMethod("mergeFeaturesByRank", signature = c(x = "TreeSummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'mergeFeaturesByRank' is deprecated. ", - "Use 'agglomerateByRank' instead.")) - x <- agglomerateByRank(x, ...) - x - } -) - -#' @rdname deprecate -#' @export -setGeneric("testExperimentCrossAssociation", signature = c("x"), - function(x, ...) - standardGeneric("testExperimentCrossAssociation")) - -#' @rdname deprecate -#' @export -setMethod("testExperimentCrossAssociation", signature = c(x = "ANY"), - function(x, ...){ - .Deprecated(msg = paste0("'testExperimentCrossAssociation' is ", - "deprecated. Use ", - "'getCrossAssociation' instead.")) - getCrossAssociation(x, test.signif = TRUE, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("testExperimentCrossCorrelation", signature = c("x"), - function(x, ...) - standardGeneric("testExperimentCrossCorrelation")) - -#' @rdname deprecate -#' @export -setMethod("testExperimentCrossCorrelation", signature = c(x = "ANY"), - function(x, ...){ - .Deprecated(msg = paste0("'testExperimentCrossCorrelation' is ", - "deprecated. Use ", - "'getCrossAssociation' instead.")) - getCrossAssociation(x, test.signif = TRUE, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("getExperimentCrossCorrelation", signature = c("x"), - function(x, ...) - standardGeneric("getExperimentCrossCorrelation")) - -#' @rdname deprecate -#' @export -setMethod("getExperimentCrossCorrelation", signature = c(x = "ANY"), - function(x, ...){ - .Deprecated(msg = paste0("'getExperimentCrossCorrelation' is ", - "deprecated. Use ", - "'getCrossAssociation' instead.")) - getCrossAssociation(x, ...) - } -) - -#' @rdname deprecate -#' @export -loadFromBiom <- function(...) { - .Deprecated(msg = paste0("'loadFromBiom' is deprecated.", - " Use 'importBIOM' instead.")) - importBIOM(...) -} - -#' @rdname deprecate -#' @export -loadFromQIIME2 <- function(...) { - .Deprecated(msg = paste0("'loadFromQIIME2' is deprecated.", - " Use 'importQIIME2' instead.")) - importQIIME2(...) -} - -#' @rdname deprecate -#' @export -readQZA <- function(...) { - .Deprecated(msg = paste0("'readQZA' is deprecated.", - " Use 'importQZA' instead.")) - importQZA(...) -} - -#' @rdname deprecate -#' @export -loadFromMothur <- function(...) { - .Deprecated(msg = paste0("'loadFromMothur' is deprecated.", - " Use 'importMothur' instead.")) - importMothur(...) -} - -#' @rdname deprecate -#' @export -loadFromMetaphlan <- function(...) { - .Deprecated(msg = paste0("'loadFromMetaphlan' is deprecated.", - " Use 'importMetaPhlAn' instead.")) - importMetaPhlAn(...) -} - -#' @rdname deprecate -#' @export -loadFromHumann <- function(...) { - .Deprecated(msg = paste0("'loadFromHumann' is deprecated.", - " Use 'importHUMAnN' instead.")) - importHUMAnN(...) -} - -#' @rdname deprecate -#' @export -setGeneric("countDominantFeatures", signature = c("x"), - function(x, ...) - standardGeneric("countDominantFeatures")) - -#' @rdname deprecate -#' @export -setMethod("countDominantFeatures", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = "'countDominantFeatures' function is deprecated. ", - "Use 'summarizeDominance' instead.") - summarizeDominance(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "subsetByRareTaxa", signature = c("x"), function(x, ...) - standardGeneric("subsetByRareTaxa")) - -#' @rdname deprecate -#' @export -setMethod( - "subsetByRareTaxa", signature = c(x = "ANY"), function(x, ...){ - .Deprecated(msg = paste0( - "'subsetByRareTaxa' is deprecated. Use 'subsetBy' instead, ", - "e.g., subsetBy(x, rows = rowMeans(counts > 0) <= 0.5).")) - .subset_by_prevalence(x, rare = TRUE, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "subsetByRareFeatures", signature = c("x"), function(x, ...) - standardGeneric("subsetByRareFeatures")) - -#' @rdname deprecate -#' @export -setMethod( - "subsetByRareFeatures", signature = c(x = "ANY"), function(x, ...){ - .Deprecated(msg = paste0( - "'subsetByRareFeatures' is deprecated. Use 'subsetBy' instead, ", - "e.g., subsetBy(x, rows = rowMeans(counts > 0) <= 0.5).")) - .subset_by_prevalence(x, rare = TRUE, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "subsetByPrevalentTaxa", signature = c("x"), function(x, ...) - standardGeneric("subsetByPrevalentTaxa")) - -#' @rdname deprecate -#' @export -setMethod( - "subsetByPrevalentTaxa", signature = c(x = "ANY"), function(x, ...){ - .Deprecated(msg = paste0( - "'subsetByPrevalentTaxa' is deprecated. Use 'subsetBy' instead, ", - "e.g., subsetBy(x, rows = rowMeans(counts > 0) > 0.5).")) - .subset_by_prevalence(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "subsetByPrevalentFeatures", signature = c("x"), function(x, ...) - standardGeneric("subsetByPrevalentFeatures")) - -#' @rdname deprecate -#' @export -setMethod( - "subsetByPrevalentFeatures", signature = c(x = "ANY"), function(x, ...){ - .Deprecated(msg = paste0( - "'subsetByPrevalentFeatures' is deprecated. Use 'subsetBy' instead, ", - "e.g., subsetBy(x, rows = rowMeans(counts > 0) > 0.5).")) - .subset_by_prevalence(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("countDominantTaxa", signature = c("x"), - function(x, ...) - standardGeneric("countDominantTaxa")) - -#' @rdname deprecate -#' @export -setMethod("countDominantTaxa", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = "'countDominantTaxa' function is deprecated. ", - "Use 'summarizeDominance' instead.") - summarizeDominance(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("full_join", signature = c("x"), - function(x, ...) - standardGeneric("full_join")) - -#' @rdname deprecate -#' @export -setMethod("full_join", signature = c(x = "ANY"), - function(x, ...){ - .Deprecated(msg = paste0("'full_join' is deprecated. ", - "Use 'mergeSEs' with 'join = full' ", - "instead.")) - mergeSEs(x, join = "full", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("inner_join", signature = c("x"), - function(x, ...) - standardGeneric("inner_join")) - -#' @rdname deprecate -#' @export -setMethod("inner_join", signature = c(x = "ANY"), - function(x, ...){ - .Deprecated(msg = paste0("'inner_join' is deprecated. ", - "Use 'mergeSEs' with 'join = inner' ", - "instead.")) - mergeSEs(x, join = "inner", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("left_join", signature = c("x"), - function(x, ...) - standardGeneric("left_join")) - -#' @rdname deprecate -#' @export -setMethod("left_join", signature = c(x = "ANY"), - function(x, ...){ - .Deprecated(msg = paste0("'left_join' is deprecated. ", - "Use 'mergeSEs' with 'join = left' ", - "instead.")) - mergeSEs(x, join = "left", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("right_join", signature = c("x"), - function(x, ...) - standardGeneric("right_join")) - -#' @rdname deprecate -#' @export -setMethod("right_join", signature = c(x = "ANY"), - function(x, ...){ - .Deprecated(msg = paste0("'right_join' is deprecated. ", - "Use 'mergeSEs' with 'join = right' ", - "instead.")) - mergeSEs(x, join = "right", ...) - } -) - -#' @rdname deprecate -#' @export -plotNMDS <- function(x, ...){ - .Deprecated(msg = paste0("'plotNMDS' is deprecated. ", - "Use 'scater::plotReducedDim' with ", - "dimred = 'NMDS' instead.")) - plotReducedDim(x, ncomponents = 2, dimred = "NMDS",...) -} - -#' @rdname deprecate -#' @export -setGeneric("estimateDivergence",signature = c("x"), - function(x, ...) - standardGeneric("estimateDivergence")) - -#' @rdname deprecate -#' @export -setMethod("estimateDivergence", signature = c(x="SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'estimateDivergence' is deprecated. ", - "Use 'addDivergence' instead.")) - addDivergence(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("meltAssay",signature = "x", - function(x, ...) - standardGeneric("meltAssay")) - -#' @rdname deprecate -#' @export -setMethod("meltAssay", signature = c(x="SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'meltAssay' is deprecated. ", - "Use 'meltSE' instead.")) - meltSE(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "transformSamples", signature = c("x"), function(x,...) - standardGeneric("transformSamples")) - -#' @rdname deprecate -#' @export -setMethod( - "transformSamples", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated( - "'transformSamples' is deprecated. Use 'transformAssay' instead.") - transformAssay(x, MARGIN = "samples", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "ZTransform", signature = c("x"), function(x, ...) - standardGeneric("ZTransform")) - -#' @rdname deprecate -#' @export -setMethod( - "ZTransform", signature = c(x = "SummarizedExperiment"), function(x, ...){ - .Deprecated( - "'Ztransform' is deprecated. Use 'transformAssay' instead.") - transformAssay(x, method = "standardize", MARGIN = "features", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "relAbundanceCounts", signature = c("x"), function(x, ...) - standardGeneric("relAbundanceCounts")) - -#' @rdname deprecate -#' @export -setMethod( - "relAbundanceCounts", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated( - "'relAbundanceCounts' is deprecated. ", - "Use 'transformAssay' instead.") - transformAssay(x, method = "relabundance", MARGIN = "samples", ...) - } -) - -#' @rdname deprecate -#' @export -transformCounts <- function(x, ...){ - .Deprecated( - "'transformCounts' is deprecated. Use 'transformAssay' instead.") - return(transformAssay(x,...)) -} - -#' @rdname deprecate -#' @export -setGeneric( - "transformFeatures", signature = c("x"), function(x, ...) - standardGeneric("transformFeatures")) - -#' @rdname deprecate -#' @export -setMethod( - "transformFeatures", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated( - "'transformFeatures' is deprecated. Use 'transformAssay' instead.") - transformAssay(x, MARGIN = "features", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "getUniqueFeatures", signature = c("x"), function(x, ...) - standardGeneric("getUniqueFeatures")) - -#' @rdname deprecate -#' @export -setMethod( - "getUniqueFeatures", signature = c(x = "SummarizedExperiment"), - function(x,...){ - .Deprecated( - msg = "'getUniqueFeatures' is deprecated. Use 'getUnique' instead.") - getUnique(x,...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "getUniqueTaxa", signature = c("x"), function(x, ...) - standardGeneric("getUniqueTaxa")) - -#' @rdname deprecate -#' @export -setMethod( - "getUniqueTaxa", signature = c(x = "SummarizedExperiment"), function(x,...){ - .Deprecated( - msg = "'getUniqueTaxa' is deprecated. Use 'getUnique' instead.") - getUnique(x,...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "getTopFeatures", signature = "x", function(x,...) - standardGeneric("getTopFeatures")) - -#' @rdname deprecate -#' @export -setMethod( - "getTopFeatures", signature = c(x = "SummarizedExperiment"), - function(x,...){ - .Deprecated( - msg = "'getTopFeatures' is deprecated. Use 'getTop' instead.") - getTop(x,...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "getTopTaxa", signature = "x", function(x,...) - standardGeneric("getTopTaxa")) - -#' @rdname deprecate -#' @export -setMethod( - "getTopTaxa", signature = c(x = "SummarizedExperiment"), function(x,...){ - .Deprecated(msg = "'getTopTaxa' is deprecated. Use 'getTop' instead.") - getTop(x,...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "getRareFeatures", signature = "x", function(x, ...) - standardGeneric("getRareFeatures")) - -#' @rdname deprecate -#' @export -setMethod( - "getRareFeatures", signature = c(x = "ANY"), function(x,...){ - .Deprecated( - msg = "'getRareFeatures' is deprecated. Use 'getRare' instead.") - getRare(x,...) - } -) - -#' @rdname deprecate -#' @export -setMethod( - "getRareFeatures", signature = c(x = "SummarizedExperiment"), - function(x,...){ - .Deprecated( - msg = "'getRareFeatures' is deprecated. Use 'getRare' instead.") - getRare(x,...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "getRareTaxa", signature = "x", function(x, ...) - standardGeneric("getRareTaxa")) - -#' @rdname deprecate -#' @export -setMethod( - "getRareTaxa", signature = c(x = "ANY"), function(x,...){ - .Deprecated( - msg = "'getRareTaxa' is deprecated. Use 'getRare' instead.") - getRare(x,...) - } -) - -#' @rdname deprecate -#' @export -setMethod( - "getRareTaxa", signature = c(x = "SummarizedExperiment"), function(x,...){ - .Deprecated(msg = "'getRareTaxa' is deprecated. Use 'getRare' instead.") - getRare(x,...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "getPrevalentFeatures", signature = "x", function(x, ...) - standardGeneric("getPrevalentFeatures")) - -#' @rdname deprecate -#' @export -setMethod( - "getPrevalentFeatures", signature = c(x = "ANY"), function(x,...){ - .Deprecated( - msg = "'getPrevalentFeatures' is deprecated. ", - "Use 'getPrevalent' instead.") - getPrevalent(x,...) - } -) - -#' @rdname deprecate -#' @export -setMethod( - "getPrevalentFeatures", signature = c(x = "SummarizedExperiment"), - function(x,...){ - .Deprecated( - msg = "'getPrevalentFeatures' is deprecated. ", - "Use 'getPrevalent' instead.") - getPrevalent(x,...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "getPrevalentTaxa", signature = "x", function(x, ...) - standardGeneric("getPrevalentTaxa")) - -#' @rdname deprecate -#' @export -setMethod( - "getPrevalentTaxa", signature = c(x = "ANY"), function(x,...){ - .Deprecated( - msg = "'getPrevalentTaxa' is deprecated. ", - "Use 'getPrevalent' instead.") - getPrevalent(x,...) - } -) - -#' @rdname deprecate -#' @export -setMethod( - "getPrevalentTaxa", signature = c(x = "SummarizedExperiment"), - function(x,...){ - .Deprecated( - msg = "'getPrevalentTaxa' is deprecated. ", - "Use 'getPrevalent' instead.") - getPrevalent(x,...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "subsampleCounts", signature = c("x"), function(x, ...) - standardGeneric("subsampleCounts")) - -#' @rdname deprecate -#' @export -setMethod( - "subsampleCounts", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated( - msg = "'subsampleCounts' is deprecated. ", - "Use 'rarefyAssay' instead.") - rarefyAssay(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "addPerSampleDominantFeatures", signature = c("x"), function(x, ...) - standardGeneric("addPerSampleDominantFeatures")) - -#' @rdname deprecate -#' @export -setMethod( - "addPerSampleDominantFeatures", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated( - msg = "'addPerSampleDominantFeatures' is deprecated.", - " Use 'addDominant' instead.") - addDominant(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "addPerSampleDominantTaxa", signature = c("x"), function(x, ...) - standardGeneric("addPerSampleDominantTaxa")) - -#' @rdname deprecate -#' @export -setMethod( - "addPerSampleDominantTaxa", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated( - msg = "'addPerSampleDominantTaxa' is deprecated. ", - "Use 'addDominant' instead.") - addDominant(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "perSampleDominantFeatures", signature = c("x"), function(x, ...) - standardGeneric("perSampleDominantFeatures")) - -#' @rdname deprecate -#' @export -setMethod( - "perSampleDominantFeatures", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated( - msg = "'perSampleDominantFeatures' is deprecated. ", - "Use 'getDominant' instead.") - getDominant(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "perSampleDominantTaxa", signature = c("x"), function(x, ...) - standardGeneric("perSampleDominantTaxa")) - -#' @rdname deprecate -#' @export -setMethod( - "perSampleDominantTaxa", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated( - msg = "'perSampleDominantTaxa' is deprecated. ", - "Use 'getDominant' instead.") - getDominant(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("makePhyloseqFromTreeSE", signature = c("x"), - function(x, ...) - standardGeneric("makePhyloseqFromTreeSE")) - -#' @rdname deprecate -#' @export -setMethod("makePhyloseqFromTreeSE", signature = c(x = "SummarizedExperiment"), - function(x){ - .Deprecated(msg = paste0( - "'makeTreeSummarizedExperimentFromPhyloseq' is deprecated.", - " Use 'convertFromPhyloseq' instead.")) - convertFromPhyloseq(x) - } -) - -#' @rdname deprecate -#' @export -setMethod("makePhyloseqFromTreeSE", - signature = c(x = "TreeSummarizedExperiment"), - function(x){ - .Deprecated(msg = paste0( - "'makeTreeSummarizedExperimentFromPhyloseq' is deprecated.", - " Use 'convertFromPhyloseq' instead.")) - convertFromPhyloseq(x) - } -) - -#' @rdname deprecate -#' @export -setGeneric("makePhyloseqFromTreeSummarizedExperiment", signature = c("x"), - function(x) - standardGeneric("makePhyloseqFromTreeSummarizedExperiment")) - -#' @rdname deprecate -#' @export -setMethod("makePhyloseqFromTreeSummarizedExperiment", signature = c(x = "ANY"), - function(x){ - .Deprecated(msg = paste0( - "'makePhyloseqFromTreeSummarizedExperiment' is deprecated.", - " Use 'convertToPhyloseq' instead.")) - convertToPhyloseq(x) - } -) - -#' @rdname deprecate -#' @export -setGeneric("makeTreeSummarizedExperimentFromPhyloseq", signature = c("x"), - function(x) - standardGeneric("makeTreeSummarizedExperimentFromPhyloseq")) - -#' @rdname deprecate -#' @export -setMethod("makeTreeSummarizedExperimentFromPhyloseq", signature = c(x = "ANY"), - function(x){ - .Deprecated(msg = paste0( - "'makeTreeSummarizedExperimentFromPhyloseq' is deprecated.", - " Use 'convertFromPhyloseq' instead.")) - convertFromPhyloseq(x) - } -) - -#' @rdname deprecate -#' @export -makeTreeSEFromBiom <- function(...){ - .Deprecated(msg = paste0( - "'makeTreeSEFromBiom' is deprecated.", - " Use 'convertFromBIOM' instead.")) - convertFromBIOM(...) -} - -#' @rdname deprecate -#' @export -makeTreeSummarizedExperimentFromBiom <- function(...){ - .Deprecated(msg = paste0( - "'makeTreeSummarizedExperimentFromBiom' is deprecated.", - " Use 'convertFromBIOM' instead.")) - convertFromBIOM(...) -} - -#' @rdname deprecate -#' @export -makeTreeSEFromDADA2 <- function(...) { - .Deprecated(msg = paste0( - "'makeTreeSEFromDADA2' is deprecated.", - " Use 'convertFromDADA2' instead.")) - convertFromDADA2(...) -} - -#' @rdname deprecate -#' @export -makeTreeSummarizedExperimentFromDADA2 <- function(...) { - .Deprecated(msg = paste0( - "'makeTreeSummarizedExperimentFromDADA2' is deprecated.", - " Use 'convertFromDADA2' instead.")) - convertFromDADA2(...) -} - -#' @rdname deprecate -#' @export -makeTreeSEFromPhyloseq <- function(x) { - .Deprecated(msg = paste0( - "'makeTreeSEFromPhyloseq' is deprecated.", - " Use 'convertFromPhyloseq' instead.")) - convertFromPhyloseq(x) -} - -#' @rdname deprecate -#' @export -setGeneric( - "estimateEvenness", signature = c("x"), function(x, ...) - standardGeneric("estimateEvenness")) - -#' @rdname deprecate -#' @export -setMethod( - "estimateEvenness", signature = c(x = "ANY"), function(x, ...){ - .Deprecated(msg = paste0( - "'estimateEvenness' is deprecated. Use 'addAlpha' instead.")) - addAlpha(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "estimateRichness", signature = c("x"), - function(x, ...) standardGeneric("estimateRichness")) - -#' @rdname deprecate -#' @export -setMethod( - "estimateRichness", signature = c(x="ANY"), - function(x, ...){ - .Deprecated(msg = paste0( - "'estimateRichness' is deprecated. Use 'addAlpha' instead.")) - addAlpha(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "estimateDiversity", signature = c("x"), - function(x, ...) standardGeneric("estimateDiversity")) - -#' @rdname deprecate -#' @export -setMethod( - "estimateDiversity", signature = c(x = "ANY"), function(x, ...){ - .Deprecated(msg = paste0( - "'estimateDiversity' is deprecated. Use 'addAlpha' instead.")) - addAlpha(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "estimateFaith", signature = c("x"), function(x, ...) - standardGeneric("estimateFaith")) - -#' @rdname deprecate -#' @export -setMethod( - "estimateFaith", signature = c(x="ANY"), - function(x, ...){ - .Deprecated(msg = paste0( - "'estimateFaith' is deprecated. Use 'addAlpha' instead.")) - addAlpha(x, ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric( - "estimateDominance", signature = c("x"), - function(x, ...) standardGeneric("estimateDominance")) - -#' @rdname deprecate -#' @export -setMethod( - "estimateDominance", signature = c(x="ANY"), - function(x, ...){ - .Deprecated(msg = paste0( - "'estimateDominance' is deprecated. Use 'addAlpha' instead.")) - addAlpha(x, ...) - }) -#' @rdname deprecate -#' @export -setGeneric("subsetSamples", signature = "x", - function(x, ...) - standardGeneric("subsetSamples")) -#' @rdname deprecate -#' @export -setGeneric("subsetFeatures", signature = "x", - function(x, ...) - standardGeneric("subsetFeatures")) -#' @rdname deprecate -#' @export -setGeneric("subsetTaxa", signature = "x", - function(x, ...) - standardGeneric("subsetTaxa")) -#' @rdname deprecate -#' @export -setMethod("subsetSamples", signature = "SummarizedExperiment", - function(x, ...){ - .Deprecated(msg = paste0("subsetSamples is deprecated. Please ", - "use '[]' for subsetting instead.")) - subset_args <- .get_subset_args(x, ...) - x[subset_args$columns,subset_args$rows] - } -) - -#' @rdname deprecate -#' @export -setMethod("subsetFeatures", signature = "SummarizedExperiment", - function(x, ...){ - .Deprecated(msg = paste0("subsetFeatures is deprecated. Please", - " use '[]' for subsetting instead.")) - subset_args <- .get_subset_args(x, ...) - x[subset_args$rows, subset_args$columns] - } -) - -#' @rdname deprecate -#' @export -setMethod("subsetTaxa", signature = "SummarizedExperiment", - function(x, ...){ - .Deprecated(msg = paste0("subsetFeatures is deprecated. Please", - " use '[]' for subsetting instead.")) - subsetFeatures(x, ...) - } -) -#' @rdname deprecate -#' @export -setGeneric("relabundance", signature = c("x"), - function(x, ...) standardGeneric("relabundance")) - -#' @rdname deprecate -#' @export -setGeneric("relabundance<-", signature = c("x"), - function(x, value) standardGeneric("relabundance<-")) - -#' @rdname deprecate -#' @importFrom SummarizedExperiment assays -#' @export -setMethod("relabundance", signature = c(x = "SummarizedExperiment"), - function(x){ - .Deprecated(msg = paste0("'relabundance' is deprecated\n", - "Use 'assay(x, 'relabundance')' instead.")) - assays(x)[["relabundance"]] - } -) - -#' @rdname deprecate -#' @importFrom SummarizedExperiment assays<- -#' @export -setReplaceMethod("relabundance", signature = c(x = "SummarizedExperiment"), - function(x, value){ - .Deprecated(msg = paste0("'relabundance' is deprecated\n", - "Use 'assay(x, 'relabundance')' instead.")) - assays(x)[["relabundance"]] <- value - x - } -) - -#' @rdname deprecate -#' @export -setGeneric("runOverlap", signature = c("x"), - function(x, ...) - standardGeneric("runOverlap")) - -#' @rdname deprecate -#' @export -setMethod("runOverlap", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'runOverlap' is deprecated\n", - "Use 'addDissimilarity' with parameter ", - "method = 'overlap' instead.")) - addDissimilarity(x, method = "overlap", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("calculateOverlap", signature = c("x"), - function(x, ...) - standardGeneric("calculateOverlap")) - -#' @rdname deprecate -#' @export -setMethod("calculateOverlap", signature = c(x = "ANY"), - function(x, ...){ - .Deprecated(msg = paste0("'calculateOverlap' is deprecated\n", - "Use 'getDissimilarity' with parameter ", - "method = 'overlap' instead.")) - getDissimilarity(x, method = "overlap", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("calculateJSD", signature = c("x"), - function(x, ...) - standardGeneric("calculateJSD")) - -#' @rdname deprecate -#' @export -setMethod("calculateJSD", signature = c(x = "ANY"), - function(x, ...){ - .Deprecated(msg = paste0("'calculateJSD' is deprecated\n", - "Use 'getDissimilarity' with parameter ", - "method = 'jsd' instead.")) - getDissimilarity(x, method = "jsd", ...) - } - -) - -#' @rdname deprecate -#' @export -setGeneric("runJSD", signature = c("x"), - function(x, ...) - standardGeneric("runJSD")) - -#' @rdname deprecate -#' @export -setMethod("runJSD", signature = c(x = "SummarizedExperiment"), - function(x, ...){ - .Deprecated(msg = paste0("'runJSD' is deprecated\n", - "Use 'getDissimilarity' with parameter ", - "method = 'jsd' instead.")) - getDissimilarity(x, method = "jsd", ...) - } -) - -#' @rdname deprecate -#' @export -setGeneric("calculateUnifrac", signature = c("x"), - function(x, ...) - standardGeneric("calculateUnifrac")) - -#' @rdname deprecate -#' @export -setMethod("calculateUnifrac", signature = c(x = "ANY"), - function(x, ...){ - .Deprecated(msg = paste0("'calculateUnifrac' is deprecated\n", - "Use 'getDissimilarity' with parameter ", - "method = 'unifrac' instead.")) - getDissimilarity(x, method = "unifrac", ...) - } -) - -#' @rdname deprecate -#' @export -runUnifrac <- function(mat, tree, ...){ - .Deprecated(msg = paste0("'runUnifrac' is deprecated\n", - "Use 'getDissimilarity' with parameter ", - "method = 'unifrac' instead.")) - getDissimilarity(t(mat), tree = tree, method = "unifrac", ...) -} - #' @rdname deprecate #' @export setGeneric("subsetByPrevalent", signature = "x", function(x, ...) diff --git a/R/getCrossAssociation.R b/R/getCrossAssociation.R index ddb215c76..c557a994a 100644 --- a/R/getCrossAssociation.R +++ b/R/getCrossAssociation.R @@ -24,10 +24,6 @@ #' @param assay.type2 \code{Character scalar}. Specifies the name of the #' assay in experiment 2 to be transformed. (Default: \code{NULL}) #' -#' @param assay_name1 Deprecated. Use \code{assay.type1} instead. -#' -#' @param assay_name2 Deprecated. Use \code{assay.type2} instead. -#' #' @param altexp1 \code{Character scalar} or \code{numeric scalar}. Specifies #' alternative experiment from the \code{altExp} of experiment 1. If NULL, then #' the experiment is itself and altExp option is disabled. @@ -42,20 +38,14 @@ #' \code{colData} of experiment 1. If col.var1 is used, assay.type1 is disabled. #' (Default: \code{NULL}) #' -#' @param colData_variable1 Deprecated. Use \code{col.var1} instead. -#' #' @param col.var2 \code{Character scalar}. Specifies column(s) from colData #' of experiment 2. If col.var2 is used, assay.type2 is disabled. #' (Default: \code{NULL}) #' -#' @param colData_variable2 Deprecated. Use \code{col.var2} instead. -#' #' @param by A\code{Character scalar}. Determines if association are calculated #' row-wise / for features ('rows') or column-wise / for samples ('cols'). #' Must be \code{'rows'} or \code{'cols'}. #' -#' @param MARGIN Deprecated. Use \code{by} instead. -#' #' @param method \code{Character scalar}. Defines the association method #' ('kendall', 'pearson', or 'spearman' for continuous/numeric; 'categorical' #' for discrete) (Default: \code{"kendall"}) @@ -67,20 +57,14 @@ #' p-values. Passed to \code{p.adjust} function. #' (Default: \code{"fdr"}) #' -#' @param p_adj_method Deprecated. Use \code{p.adj.method} instead. -#' #' @param p.adj.threshold \code{Numeric scalar}. From \code{0 to 1}, specifies #' adjusted p-value threshold for filtering. #' (Default: \code{NULL}) #' -#' @param p_adj_threshold Deprecated. Use \code{p.dj.threshold} instead. -#' #' @param cor.threshold \code{Numeric scalar}. From \code{0 to 1}, specifies #' correlation threshold for filtering. #' (Default: \code{NULL}) #' -#' @param cor_threshold Deprecated. Use \code{cor.threshold} instead. -#' #' @param sort \code{Logical scalar}. Specifies whether to sort features or not #' in result matrices. Used method is hierarchical clustering. #' (Default: \code{FALSE}) @@ -90,9 +74,6 @@ #' correlation between experiment itself is tested, i.e., when assays are #' identical. (Default: \code{FALSE}) #' -#' @param filter_self_correlations Deprecated. Use \code{filter.self.cor} -#' instead. -#' #' @param verbose \code{Logical scalar}. Specifies whether to get messages #' about progress of calculation. (Default: \code{FALSE}) #' @@ -100,14 +81,10 @@ #' statistical significance of associations. #' (Default: \code{FALSE}) #' -#' @param test_significance Deprecated. Use \code{test.signif} instead. -#' #' @param show.warnings \code{Logical scalar}. specifies whether to show #' warnings that might occur when correlations and p-values are calculated. #' (Default: \code{FALSE}) #' -#' @param show_warnings Deprecated. use \code{show.warnings} instead. -#' #' @param paired \code{Logical scalar}. Specifies if samples are paired or not. #' \code{colnames} must match between twp experiments. \code{paired} is disabled #' when \code{by = 1}. (Default: \code{FALSE}) @@ -291,36 +268,28 @@ setMethod("getCrossAssociation", signature = c(x = "MultiAssayExperiment"), x, experiment1 = 1, experiment2 = 2, - assay.type1 = assay_name1, assay_name1 = NULL, - assay.type2 = assay_name2, assay_name2 = NULL, + assay.type1 = NULL, + assay.type2 = NULL, altexp1 = NULL, altexp2 = NULL, - col.var1 = colData_variable1, - colData_variable1 = NULL, - col.var2 = colData_variable2, - colData_variable2 = NULL, - by = MARGIN, - MARGIN = 1, + col.var1 = NULL, + col.var2 = NULL, + by = 1, method = "kendall", mode = "table", - p.adj.method = p_adj_method, - p_adj_method = c("fdr", "BH", "bonferroni", "BY", "hochberg", "holm", + p.adj.method = c("fdr", "BH", "bonferroni", "BY", "hochberg", "holm", "hommel", "none"), - p.adj.threshold = p_adj_threshold, - p_adj_threshold = NULL, - cor.threshold = cor_threshold, - cor_threshold = NULL, + p.adj.threshold = NULL, + cor.threshold = NULL, sort = FALSE, - filter.self.cor = filter_self_correlations, - filter_self_correlations = FALSE, + filter.self.cor = FALSE, verbose = TRUE, - test.signif = test_significance, - test_significance = FALSE, - show.warnings = show_warnings, - show_warnings = TRUE, + test.signif = FALSE, + show.warnings = TRUE, paired = FALSE, ...){ # + .check_defunct_args(...names(), .cross_association_defunct_args) .get_experiment_cross_association( x, experiment1 = experiment1, @@ -354,6 +323,7 @@ setMethod("getCrossAssociation", signature = c(x = "MultiAssayExperiment"), setMethod("getCrossAssociation", signature = "SummarizedExperiment", function(x, experiment2 = x, ...){ ############################## INPUT CHECK ############################# + .check_defunct_args(...names(), .cross_association_defunct_args) # If y is SE or TreeSE object if( is(experiment2, "SummarizedExperiment") ){} # If y is character specifying name of altExp, @@ -411,6 +381,12 @@ setMethod("getCrossAssociation", signature = "SummarizedExperiment", } ) +# Defunct argument names of getCrossAssociation() +.cross_association_defunct_args <- c( + "assay_name1", "assay_name2", "colData_variable1", "colData_variable2", + "MARGIN", "p_adj_method", "p_adj_threshold", "cor_threshold", + "filter_self_correlations", "test_significance", "show_warnings") + ############################## MAIN FUNCTIONALITY ############################## # This function includes all the main functionality. #' @importFrom S4Vectors unfactor diff --git a/R/getDominant.R b/R/getDominant.R index 5c20ed341..6045cd0d8 100644 --- a/R/getDominant.R +++ b/R/getDominant.R @@ -18,8 +18,6 @@ #' @param group \code{Character scalar}. Defines a group. Must be one of the #' columns from \code{rowData(x)}. (Default: \code{NULL}) #' -#' @param rank Deprecated. Use \code{group} instead. -#' #' @param n \code{Numeric scalar}. The number of features that are the most #' frequent #' dominant features. Default is NULL, which defaults that each sample is @@ -36,7 +34,7 @@ #' list that includes all dominant taxa for each sample into colData. #' #' @param ... Additional arguments passed on to \code{agglomerateByRank()} when -#' \code{rank} is specified. +#' \code{group} is specified. #' #' @details #' \code{addDominant} extracts the most abundant taxa in a @@ -78,9 +76,10 @@ NULL #' @importFrom IRanges relist #' @export setMethod("getDominant", signature = c(x = "SummarizedExperiment"), - function(x, assay.type = assay_name, assay_name = "counts", group = rank, - rank = NULL, other.name = "Other", n = NULL, complete = TRUE, ...){ + function(x, assay.type = "counts", group = NULL, other.name = "Other", + n = NULL, complete = TRUE, ...){ # Input check + .check_defunct_args(...names(), c("assay_name", "rank")) # Check assay.type .check_assay_present(assay.type, x) # group check diff --git a/R/getPrevalence.R b/R/getPrevalence.R index 202735400..132a43b06 100644 --- a/R/getPrevalence.R +++ b/R/getPrevalence.R @@ -8,8 +8,6 @@ #' @param x #' \code{\link[TreeSummarizedExperiment:TreeSummarizedExperiment-class]{TreeSummarizedExperiment}}. #' -#' @param assay_name Deprecated. Use \code{assay.type} instead. -#' #' @param detection \code{Numeric scalar}. Detection threshold for #' absence/presence. If \code{as_relative = FALSE}, #' it sets the counts threshold for a taxon to be considered present. @@ -19,8 +17,6 @@ #' @param include.lowest \code{Logical scalar}. Should the lower boundary of the #' detection and prevalence cutoffs be included? (Default: \code{FALSE}) #' -#' @param include_lowest Deprecated. Use \code{include.lowest} instead. -#' #' @param sort \code{Logical scalar}. Should the result be sorted by prevalence? #' (Default: \code{FALSE}) #' @@ -194,9 +190,10 @@ setMethod("addPrevalence", signature = c(x = "SummarizedExperiment"), #' @rdname getPrevalence #' @export setMethod("getPrevalence", signature = c(x = "ANY"), function( - x, detection = 0, include.lowest = include_lowest, include_lowest = FALSE, - sort = FALSE, na.rm = TRUE, ...){ + x, detection = 0, include.lowest = FALSE, sort = FALSE, na.rm = TRUE, + ...){ # input check + .check_defunct_args(...names(), c("assay_name", "include_lowest")) if (!.is_numeric_string(detection)) { stop("'detection' must be a single numeric value or coercible to ", "one.", call. = FALSE) @@ -242,8 +239,7 @@ setMethod("getPrevalence", signature = c(x = "ANY"), function( #' @rdname getPrevalence #' @export setMethod("getPrevalence", signature = c(x = "SummarizedExperiment"), - function(x, assay.type = assay_name, assay_name = "counts", - rank = NULL, ...){ + function(x, assay.type = "counts", rank = NULL, ...){ # check assay .check_assay_present(assay.type, x) x <- .merge_features(x, rank = rank, ...) @@ -333,8 +329,7 @@ NULL #' @rdname getPrevalence #' @export setMethod("getPrevalent", signature = c(x = "ANY"), - function(x, prevalence = 50/100, include.lowest = include_lowest, - include_lowest = FALSE, ...){ + function(x, prevalence = 50/100, include.lowest = FALSE, ...){ .get_prevalent_taxa(x, rank = NULL, prevalence = prevalence, include.lowest = include.lowest, ...) } @@ -343,8 +338,8 @@ setMethod("getPrevalent", signature = c(x = "ANY"), #' @rdname getPrevalence #' @export setMethod("getPrevalent", signature = c(x = "SummarizedExperiment"), - function(x, rank = NULL, prevalence = 50/100, - include.lowest = include_lowest, include_lowest = FALSE, ...){ + function(x, rank = NULL, prevalence = 50/100, include.lowest = FALSE, + ...){ .get_prevalent_taxa(x, rank = rank, prevalence = prevalence, include.lowest = include.lowest, ...) } @@ -388,8 +383,7 @@ NULL #' @rdname getPrevalence #' @export setMethod("getRare", signature = c(x = "ANY"), - function(x, prevalence = 50/100, include.lowest = include_lowest, - include_lowest = FALSE, ...){ + function(x, prevalence = 50/100, include.lowest = FALSE, ...){ .get_rare_taxa(x, rank = NULL, prevalence = prevalence, include.lowest = include.lowest, ...) } @@ -398,8 +392,8 @@ setMethod("getRare", signature = c(x = "ANY"), #' @rdname getPrevalence #' @export setMethod("getRare", signature = c(x = "SummarizedExperiment"), - function(x, rank = NULL, prevalence = 50/100, - include.lowest = include_lowest, include_lowest = FALSE, ...){ + function(x, rank = NULL, prevalence = 50/100, include.lowest = FALSE, + ...){ .get_rare_taxa(x, rank = rank, prevalence = prevalence, include.lowest = include.lowest, ...) } @@ -439,8 +433,7 @@ setMethod("getPrevalentAbundance", signature = c(x = "ANY"), #' @rdname getPrevalence #' @export setMethod("getPrevalentAbundance", signature = c(x = "SummarizedExperiment"), - function(x, assay.type = assay_name, assay_name = "counts", rank = NULL, - ...){ + function(x, assay.type = "counts", rank = NULL, ...){ # check assay .check_assay_present(assay.type, x) # Agglomerate to the given rank, as in getPrevalent() diff --git a/R/importHumann.R b/R/importHumann.R index 196d855ef..33ce8c205 100644 --- a/R/importHumann.R +++ b/R/importHumann.R @@ -7,9 +7,7 @@ #' rownames, or a single \code{character} value defining the file #' path of the sample metadata file. The file must be in \code{tsv} format #' (Default: \code{NULL}). -#' -#' @param colData Deprecated. Use \code{col.data} instead. -#' +#' #' @param ... additional arguments: #' \itemize{ #' \item \code{assay.type}: \code{Character scalar}. Specifies the name of @@ -65,8 +63,9 @@ #' NULL -importHUMAnN <- function(file, col.data = colData, colData = NULL, ...){ +importHUMAnN <- function(file, col.data = NULL, ...){ ################################ Input check ############################### + .check_defunct_args(...names(), "colData") if(!.is_non_empty_string(file)){ stop("'file' must be a single character value.", call. = FALSE) diff --git a/R/importMetaphlan.R b/R/importMetaphlan.R index 987e475e9..753a5152f 100644 --- a/R/importMetaphlan.R +++ b/R/importMetaphlan.R @@ -8,16 +8,10 @@ #' path of the sample metadata file. The file must be in \code{tsv} format #' (Default: \code{NULL}). #' -#' @param colData Deprecated. use \code{col.data} instead. -#' -#' @param sample_meta Deprecated. Use \code{col.data} instead. -#' #' @param tree.file \code{Character scalar}. Defines the file #' path of the phylogenetic tree. #' (Default: \code{NULL}). #' -#' @param phy_tree Deprecated. Use \code{tree.file} instead. -#' #' @param ... additional arguments: #' \itemize{ #' \item \code{assay.type}: \code{Character scalar}. Specifies the name of @@ -83,11 +77,11 @@ #' NULL -importMetaPhlAn <- function( - file, col.data = colData, colData = sample_meta, - sample_meta = NULL, tree.file = phy_tree, phy_tree = NULL, ...){ +importMetaPhlAn <- function(file, col.data = NULL, tree.file = NULL, ...){ ################################ Input check ############################### + .check_defunct_args( + ...names(), c("colData", "sample_meta", "phy_tree", "assay_name")) if(!.is_non_empty_string(file)){ stop("'file' must be a single character value.", call. = FALSE) diff --git a/R/importMothur.R b/R/importMothur.R index 0a7264ef6..8c1315ed5 100644 --- a/R/importMothur.R +++ b/R/importMothur.R @@ -7,21 +7,15 @@ #' path of the feature table to be imported. The File has to be in #' \code{shared file} format as defined in Mothur documentation. #' -#' @param sharedFile Deprecated. Use \code{assay.file} instead. -#' #' @param row.file \code{Character scalar}. Defines the file path of #' the taxonomy table to be imported. The File has to be in \code{taxonomy #' file} or \code{constaxonomy file} format as defined in Mothur #' documentation. (Default: \code{NULL}). #' -#' @param taxonomyFile Deprecated. Use \code{row.file} instead. -#' #' @param col.file \code{Character scalar}. Defines file path of #' the sample metadata to be imported. The File has to be in \code{design #' file} format as defined in Mothur documentation. (Default: \code{NULL}). #' -#' @param designFile Deprecated. Use \code{col.file} instead. -#' #' @param tree.file \code{NULL} or \code{Character scalar}. Defines the file #' path of a phylogenetic tree in Newick format. The tip labels of the tree #' must match the OTU names, e.g., \code{Otu001}. (Default: \code{NULL}) @@ -71,13 +65,8 @@ NULL #' @importFrom SummarizedExperiment SummarizedExperiment #' @importFrom S4Vectors make_zero_col_DFrame #' @export -importMothur <- function(assay.file = sharedFile, - sharedFile, - taxonomyFile = NULL, - row.file = taxonomyFile, - designFile = NULL, - col.file = designFile, - tree.file = NULL) { +importMothur <- function( + assay.file, row.file = NULL, col.file = NULL, tree.file = NULL) { # input check if(!.is_non_empty_string(assay.file)){ diff --git a/R/importQIIME2.R b/R/importQIIME2.R index c8bcd31bb..a3fc30ade 100644 --- a/R/importQIIME2.R +++ b/R/importQIIME2.R @@ -9,38 +9,26 @@ #' @param assay.file \code{Character scalar}. Defines the file #' path of the feature table to be imported. #' -#' @param featureTableFile Deprecated. use \code{assay.file} instead. -#' #' @param row.file \code{Character scalar} or \code{NULL}. Defines the file #' path of the taxonomy table to be imported. (default: #' \code{NULL}). #' -#' @param taxonomyTableFile Deprecated. use \code{row.file} instead. -#' #' @param col.file \code{Character scalar} or \code{NULL}. Defines the file path #' of the sample metadata to be imported. The file has to be in tsv format. #' (Default: \code{NULL}). #' -#' @param sampleMetaFile Deprecated. Use \code{col.file} instead. -#' #' @param as.refseq \code{Logical scalar} or \code{NULL}. Should the feature #' names of the feature table be regarded as reference sequences? This setting #' will be disregarded, if \code{refseq.file} is not \code{NULL}. If the #' feature names do not contain valid DNA characters only, the reference #' sequences will not be set. #' -#' @param featureNamesAsRefSeq Deprecated. Use \code{as.refseq} instead. -#' #' @param refseq.file \code{Character scalar} or \code{NULL}. Defines the file #' path of the reference sequences for each feature. (Default: \code{NULL}). #' -#' @param refSeqFile Deprecated. Use \code{refseq.file} instead. -#' #' @param tree.file \code{Character scalar}. Defines the file path of #' the phylogenetic tree. (Default: \code{NULL}). #' -#' @param phyTreeFile Deprecated. Use \code{tree.file} instead. -#' #' @param ... additional arguments: #' \itemize{ #' \item \code{temp.dir}: the temporary directory used for decompressing the @@ -94,19 +82,12 @@ #' tse #' @importFrom S4Vectors make_zero_col_DFrame SimpleList -importQIIME2 <- function(assay.file = featureTableFile, - featureTableFile, - row.file = taxonomyTableFile, - taxonomyTableFile = NULL, - col.file = sampleMetaFile, - sampleMetaFile = NULL, - as.refseq = featureNamesAsRefSeq, - featureNamesAsRefSeq = TRUE, - refseq.file = refSeqFile, - refSeqFile = NULL, - tree.file = phyTreeFile, - phyTreeFile = NULL, - ...) { +importQIIME2 <- function( + assay.file, row.file = NULL, col.file = NULL, as.refseq = TRUE, + refseq.file = NULL, tree.file = NULL, ...) { + .check_defunct_args(...names(), c( + "featureTableFile", "taxonomyTableFile", "sampleMetaFile", + "featureNamesAsRefSeq", "refSeqFile", "phyTreeFile")) .require_package("yaml") # input check if(!.is_non_empty_string(assay.file)){ @@ -189,8 +170,6 @@ importQIIME2 <- function(assay.file = featureTableFile, #' @param temp.dir character, a temporary directory in which the qza file will #' be decompressed to, default `tempdir()`. #' -#' @param temp Deprecated. Use \code{temp.dir} instead. -#' #' @return `matrix` object for feature table, `DataFrame` for taxonomic table, #' [`ape::phylo`] object for phylogenetic tree, #' [`Biostrings::DNAStringSet-class`] for representative sequences of taxa. @@ -223,7 +202,8 @@ importQIIME2 <- function(assay.file = featureTableFile, #' @importFrom utils unzip #' @importFrom ape read.tree #' @importFrom Biostrings readDNAStringSet -importQZA <- function(file, temp.dir = temp, temp = tempdir(), ...) { +importQZA <- function(file, temp.dir = tempdir(), ...) { + .check_defunct_args(...names(), "temp") if (!file.exists(file)) { stop(file, " does not exist", call. = FALSE) } diff --git a/R/meltAssay.R b/R/meltAssay.R index 790cebb8d..957baf5c3 100644 --- a/R/meltAssay.R +++ b/R/meltAssay.R @@ -22,8 +22,6 @@ #' \code{add.col} is a \code{character} vector, it will be used to subset #' to given column names in \code{colData}. (Default: \code{NULL}) #' -#' @param add_col_data Deprecated. Use \code{add.col} instead. -#' #' @param add.row \code{Logical scalar} or \code{Character vector}. To #' select information from the \code{rowData} to add to the molten assay data. #' If \code{add.row = NULL} no data will be added, if @@ -31,8 +29,6 @@ #' \code{add.row} is a \code{character} vector, it will be used to subset #' to given column names in \code{rowData}. (Default: \code{NULL}) #' -#' @param add_row_data Deprecated. Use \code{add.row} instead. -#' #' @param add.dimred \code{Logical scalar} or \code{Character vector}. To #' select information from the \code{reducedDim} to add to the molten assay #' data. If \code{add.dimred = NULL} no data will be added, if @@ -43,13 +39,9 @@ #' @param row.name \code{Character scalar}. To use as the output's name #' for the feature identifier. (Default: \code{"FeatureID"}) #' -#' @param feature_name Deprecated. Use \code{row.name} instead. -#' #' @param col.name \code{Character scalar}. To use as the output's name #' for the sample identifier. (Default: \code{"SampleID"}) #' -#' @param sample_name Deprecated. Use \code{col.name} instead. -#' #' @param ... optional arguments: #' \itemize{ #' \item check.names: \code{Logical scalar}. Passed to data.frame @@ -83,17 +75,16 @@ NULL setMethod("meltSE", signature = c(x = "SummarizedExperiment"), function( x, - assay.type = assay_name, assay_name = "counts", - add.row = add_row_data, - add_row_data = NULL, - add.col = add_col_data, - add_col_data = NULL, - row.name = feature_name, - feature_name = "FeatureID", - col.name = sample_name, - sample_name = "SampleID", + assay.type = "counts", + add.row = NULL, + add.col = NULL, + row.name = "FeatureID", + col.name = "SampleID", ...){ # input check + .check_defunct_args(...names(), c( + "assay_name", "add_row_data", "add_col_data", "feature_name", + "sample_name")) .check_assay_present(assay.type, x) if( !.is_a_string(row.name) ){ stop("'row.name' must be a single non-empty character value.", diff --git a/R/merge.R b/R/merge.R index 50b4ae7dc..6431c72fe 100644 --- a/R/merge.R +++ b/R/merge.R @@ -85,6 +85,7 @@ # This function merges assays and row/colData. #' @importFrom S4Vectors SimpleList #' @importFrom BiocParallel bpmapply SerialParam +#' @importFrom SummarizedExperiment assays<- .merge_rows_or_cols <- function( x, f, by, archetype = 1L, average = FALSE, BPPARAM = SerialParam(), check.assays = TRUE, na.rm = FALSE, ...){ diff --git a/R/mergeSEs.R b/R/mergeSEs.R index fb42b758e..68b80589f 100644 --- a/R/mergeSEs.R +++ b/R/mergeSEs.R @@ -19,19 +19,13 @@ #' @param missing.values \code{NA}, \code{0} or \code{Character scalar}. #' Specifies the notation of missing values. (By default: \code{NA}) #' -#' @param missing_values Deprecated. Use \code{missing.values} instead. -#' #' @param collapse.cols \code{Logical scalar}. Determines whether to collapse #' identically named samples to one. (Default: \code{FALSE}) #' -#' @param collapse_samples Deprecated. Use \code{collapse.cols} instead. -#' #' @param collapse.rows \code{Logical scalar}. Determines whether to collapse #' features that have identical names and taxonomy to one. #' (Default: \code{TRUE}) #' -#' @param collapse_features Deprecated. Use \code{collapse.rows} instead. -#' #' @param ... optional arguments (not used). #' #' @return A single \code{SummarizedExperiment} object. @@ -149,11 +143,12 @@ NULL #' @rdname mergeSEs #' @export setMethod("mergeSEs", signature = c(x = "SimpleList", y = "missing"), - function(x, y, assay.type = assay_name, assay_name = "counts", - join = "full", missing.values = missing_values, missing_values = NA, - collapse.cols = collapse_samples, collapse_samples = FALSE, - collapse.rows = collapse_features, collapse_features = TRUE, ...){ + function(x, y, assay.type = "counts", join = "full", missing.values = NA, + collapse.cols = FALSE, collapse.rows = TRUE, ...){ ################## Input check ################## + .check_defunct_args(...names(), c( + "assay_name", "missing_values", "collapse_samples", + "collapse_features")) x <- x |> as.list() |> unname() if( !all(vapply(x, is, logical(1L), "SummarizedExperiment")) ){ stop("Input includes an object that is not ", diff --git a/R/mia.R b/R/mia.R index ea022e69a..384f3f1ae 100644 --- a/R/mia.R +++ b/R/mia.R @@ -196,7 +196,7 @@ NULL #' @usage data(dmn_se) #' @seealso #' \code{\link{mia-datasets}} -#' \code{\link{calculateDMN}} +#' \code{\link{calculateDMNgroup}} #' @author Turnbaugh, PJ et al. #' @references #' \insertRef{Holmes2012}{mia} diff --git a/R/rarefyAssay.R b/R/rarefyAssay.R index 230e61d5e..3b091d175 100644 --- a/R/rarefyAssay.R +++ b/R/rarefyAssay.R @@ -30,8 +30,6 @@ #' simulated i.e. rarefying depth. This can equal to lowest number of total #' counts found in a sample or a user specified number. #' -#' @param min_size Deprecated. Use \code{sample} instead. -#' #' @param replace \code{Logical scalar}. Whether to åperform subsampling with #' replacement. Ths works similarly to \code{sample(..., replace = TRUE)}. #' (Default: \code{FALSE}) @@ -78,10 +76,11 @@ NULL #' @rdname rarefyAssay #' @export setMethod("rarefyAssay", signature = c(x = "SummarizedExperiment"), - function(x, assay.type = assay_name, assay_name = "counts", - sample = min_size, min_size = min(colSums2(assay(x, assay.type))), - replace = FALSE, name = "subsampled", ...){ + function(x, assay.type = "counts", + sample = min(colSums2(assay(x, assay.type))), replace = FALSE, + name = "subsampled", ...){ # Input check + .check_defunct_args(...names(), c("assay_name", "min_size")) # Check that assay name is correct and that assay is counts table. .check_assay_present(assay.type, x) if( any(assay(x, assay.type) %% 1 != 0 & diff --git a/R/runCCA.R b/R/runCCA.R index d1919c06a..6b62b39e2 100644 --- a/R/runCCA.R +++ b/R/runCCA.R @@ -27,8 +27,6 @@ #' \code{SummarizedExperiment},\code{col.var} can be used to specify variables #' from \code{colData}. #' -#' @param variables Deprecated. Use \code{col.var} instead. -#' #' @param test.signif \code{Logical scalar}. Should the PERMANOVA and analysis #' of multivariate homogeneity of group dispersions be performed. #' (Default: \code{TRUE}) @@ -39,8 +37,6 @@ #' @param name \code{Character scalar}. A name for the \code{reducedDim()} #' where results will be stored. (Default: \code{"CCA"}) #' -#' @param exprs_values Deprecated. Use \code{assay.type} instead. -#' #' @param ... additional arguments passed to vegan::cca or vegan::dbrda and #' other internal functions. #' \itemize{ @@ -240,10 +236,11 @@ setMethod("getCCA", "ANY", function(x, formula, data, ...){ #' @rdname runCCA setMethod("getCCA", "SummarizedExperiment", function( - x, formula = NULL, col.var = variables, variables = NULL, - test.signif = TRUE, assay.type = assay_name, assay_name = exprs_values, - exprs_values = "counts", ...){ + x, formula = NULL, col.var = NULL, test.signif = TRUE, + assay.type = "counts", ...){ ############################# Input check ############################## + .check_defunct_args( + ...names(), c("variables", "assay_name", "exprs_values")) if( !(is.null(formula) || is(formula, "formula")) ){ stop("'formula' must be formula or NULL.", call. = FALSE) } @@ -354,10 +351,11 @@ setMethod("getRDA", "ANY", function(x, formula, data, ...){ #' @rdname runCCA setMethod("getRDA", "SummarizedExperiment", function( - x, formula = NULL, col.var = variables, variables = NULL, - test.signif = TRUE, assay.type = assay_name, assay_name = exprs_values, - exprs_values = NULL, dis.name = NULL, ...){ + x, formula = NULL, col.var = NULL, test.signif = TRUE, + assay.type = NULL, dis.name = NULL, ...){ ############################# Input check ############################## + .check_defunct_args( + ...names(), c("variables", "assay_name", "exprs_values")) if( !(is.null(formula) || is(formula, "formula")) ){ stop("'formula' must be formula or NULL.", call. = FALSE) } diff --git a/R/runDPCoA.R b/R/runDPCoA.R index 50c51754f..01839864f 100644 --- a/R/runDPCoA.R +++ b/R/runDPCoA.R @@ -28,8 +28,6 @@ #' names, an integer vector of row indices or a logical vector. #' (Default: \code{NULL}) #' -#' @param subset_row Deprecated. Use \code{subset.row} instead. -#' #' @param scale \code{Logical scalar}. Should the expression values be #' standardized? (Default: \code{FALSE}) #' @@ -39,14 +37,10 @@ #' @param altexp \code{Character scalar} or \code{integer scalar}. Specifies an #' alternative experiment containing the input data. (Default: \code{NULL}) #' -#' @param exprs_values Deprecated. Use \code{assay.type} instead. -#' #' @param tree.name \code{Character scalar}. Specifies the name of the #' tree to be included in the phyloseq object that is created, #' (Default: \code{"phylo"}) #' -#' @param tree_name Deprecated. Use \code{tree.name} instead. -#' #' @param ... Currently not used. #' #' @details @@ -84,10 +78,11 @@ NULL .calculate_dpcoa <- function( - x, y, ncomponents = 2, ntop = NULL, - subset.row = subset_row, subset_row = NULL, scale = FALSE, + x, y, ncomponents = 2, ntop = NULL, subset.row = NULL, scale = FALSE, transposed = FALSE, ...) { + .check_defunct_args( + ...names(), c("subset_row", "assay_name", "exprs_values", "tree_name")) .require_package("ade4") # input check # Check ncomponents @@ -146,8 +141,7 @@ setMethod("getDPCoA", c("ANY","ANY"), .calculate_dpcoa) #' @importFrom ape cophenetic.phylo #' @rdname runDPCoA setMethod("getDPCoA", signature = c("TreeSummarizedExperiment","missing"), - function(x, ..., assay.type = assay_name, assay_name = exprs_values, - exprs_values = "counts", tree.name = tree_name, tree_name = "phylo") + function(x, ..., assay.type = "counts", tree.name = "phylo") { .require_package("ade4") # Check assay.type diff --git a/R/runNMDS.R b/R/runNMDS.R index 342169458..ae9c72beb 100644 --- a/R/runNMDS.R +++ b/R/runNMDS.R @@ -15,8 +15,6 @@ #' of the matrix returned/stored by \code{getNMDS}/ \code{addNMDS}. (Default: #' \code{FALSE}) #' -#' @param keep_dist Deprecated. Use \code{keep.dist} instead. -#' #' @param FUN \code{Function} or \code{Character scalar}. A value with a #' function name returning a \code{\link[stats:dist]{dist}} object. The #' default is \code{\link[=getDissimilarity]{getDissimilarity}}, as in @@ -30,8 +28,6 @@ #' \code{\link[MASS:isoMDS]{MASS::isoMDS}} or \dQuote{monoMDS} for #' \code{\link[vegan:monoMDS]{vegan::monoMDS}} #' -#' @param nmdsFUN Deprecated. Use \code{nmds.fun} instead. -#' #' @param name \code{Character scalar}. A name for the column of the #' \code{colData} where results will be stored. (Default: \code{"NMDS"}) #' @@ -44,10 +40,6 @@ #' @param ndimred \code{integer vector}. Specifies the dimensions to use if #' dimred is specified. #' -#' @param n_dimred Deprecated. Use \code{ndimred} instead. -#' -#' @param exprs_values Deprecated. Use \code{assay.type} instead. -#' #' @return For \code{getNMDS}, a matrix is returned containing the MDS #' coordinates for each sample (row) and dimension (column). #' @@ -135,13 +127,12 @@ NULL #' @importFrom stats cmdscale #' @importFrom vegan monoMDS .calculate_nmds <- function( - x, FUN = getDissimilarity, - nmds.fun = nmdsFUN, - nmdsFUN = c("isoMDS","monoMDS"), - ncomponents = 2, ntop = 500, subset.row = subset_row, - subset_row = NULL, scale = FALSE, transposed = FALSE, - keep.dist = keep_dist, - keep_dist = FALSE, ...){ + x, FUN = getDissimilarity, nmds.fun = c("isoMDS","monoMDS"), + ncomponents = 2, ntop = 500, subset.row = NULL, scale = FALSE, + transposed = FALSE, keep.dist = FALSE, ...){ + .check_defunct_args(...names(), c( + "keep_dist", "nmdsFUN", "subset_row", "n_dimred", "assay_name", + "exprs_values")) nmds.fun <- match.arg(nmds.fun) nmdsArgs <- .get_nmds_args(nmds.fun, ...) if(!transposed) { @@ -173,8 +164,7 @@ setMethod("getNMDS", "ANY", .calculate_nmds) #' @importFrom SummarizedExperiment assay #' @export setMethod("getNMDS", "SummarizedExperiment", - function(x, ..., assay.type = assay_name, assay_name = exprs_values, - exprs_values = "counts", FUN = getDissimilarity) { + function(x, ..., assay.type = "counts", FUN = getDissimilarity) { .calculate_nmds(assay(x, assay.type), FUN = FUN, ...) } ) @@ -182,9 +172,8 @@ setMethod("getNMDS", "SummarizedExperiment", #' @rdname runNMDS #' @export setMethod("getNMDS", "SingleCellExperiment", - function(x, ..., assay.type = assay_name, assay_name = exprs_values, - exprs_values = "counts", dimred = NULL, ndimred = n_dimred, - n_dimred = NULL, FUN = getDissimilarity){ + function(x, ..., assay.type = "counts", dimred = NULL, ndimred = NULL, + FUN = getDissimilarity){ mat <- .get_mat_from_sce( x, exprs_values = assay.type, dimred = dimred, n_dimred = ndimred) getNMDS(mat, transposed = !is.null(dimred), FUN = FUN,...) diff --git a/R/splitByRanks.R b/R/splitByRanks.R index 4908bd6b4..52e80cb42 100644 --- a/R/splitByRanks.R +++ b/R/splitByRanks.R @@ -18,8 +18,6 @@ #' breaks the link between the data used to calculate the reduced dims. #' (Default: \code{FALSE}) #' -#' @param keep_reducedDims Deprecated. Use \code{keep.dimred} instead. -#' #' @param as.list \code{Logical scalar}. Should the list of #' \code{SummarizedExperiment} objects be returned by the function #' \code{agglomerateByRanks} as a SimpleList or stored in altExps? @@ -201,9 +199,9 @@ splitByRanks <- function(x, ...){ #' @rdname agglomerate-methods #' @export setMethod("unsplitByRanks", signature = c(x = "SingleCellExperiment"), - function(x, ranks = taxonomyRanks(x), keep.dimred = keep_reducedDims, - keep_reducedDims = FALSE, ...){ + function(x, ranks = taxonomyRanks(x), keep.dimred = FALSE, ...){ # input check + .check_defunct_args(...names(), "keep_reducedDims") if(!.is_a_bool(keep.dimred)){ stop("'keep.dimred' must be TRUE or FALSE.", call. = FALSE) } @@ -216,8 +214,7 @@ setMethod("unsplitByRanks", signature = c(x = "SingleCellExperiment"), #' @rdname agglomerate-methods #' @export setMethod("unsplitByRanks", signature = c(x = "TreeSummarizedExperiment"), - function(x, ranks = taxonomyRanks(x), keep.dimred = keep_reducedDims, - keep_reducedDims = FALSE, ...){ + function(x, ranks = taxonomyRanks(x), keep.dimred = FALSE, ...){ callNextMethod() } ) diff --git a/R/splitOn.R b/R/splitOn.R index 361871338..6071909ab 100644 --- a/R/splitOn.R +++ b/R/splitOn.R @@ -12,13 +12,9 @@ #' returned unchanged. If \code{group} matches with both dimensions, #' \code{by} must be specified. (Default: \code{NULL}) #' -#' @param f Deprecated. Use \code{group} instead. -#' #' @param altexp \code{Character vector}. Specify the alternative experiments #' to be unsplit. (Default: \code{names(altExps(x))}) #' -#' @param altExpNames Deprecated. Use \code{altexp} instead. -#' #' @param ... Arguments passed to \code{agglomerateByVariable} function for #' \code{SummarizedExperiment} objects and other functions. #' See \code{\link[=agglomerate-methods]{agglomerateByVariable}} for more @@ -239,7 +235,8 @@ NULL #' @rdname splitOn #' @export setMethod("splitOn", signature = c(x = "SummarizedExperiment"), - function(x, group = f, f = NULL, ...){ + function(x, group = NULL, ...){ + .check_defunct_args(...names(), "f") # Get arguments args <- .norm_args_for_split_by(x, group = group, ...) # Split data @@ -250,7 +247,8 @@ setMethod("splitOn", signature = c(x = "SummarizedExperiment"), #' @rdname splitOn #' @export setMethod("splitOn", signature = c(x = "SingleCellExperiment"), - function(x, group = f, f = NULL, ...){ + function(x, group = NULL, ...){ + .check_defunct_args(...names(), "f") # Get arguments args <- .norm_args_for_split_by(x, group = group, ...) # Should alternative experiment be removed? --> yes @@ -408,10 +406,9 @@ setMethod("unsplitOn", signature = c(x = "SimpleList"), #' @importFrom SingleCellExperiment altExpNames altExp altExps reducedDims<- #' @export setMethod("unsplitOn", signature = c(x = "SingleCellExperiment"), - function(x, altexp = altExpNames, altExpNames = names(altExps(x)), - keep.dimred = keep_reducedDims, - keep_reducedDims = FALSE, ...){ + function(x, altexp = names(altExps(x)), keep.dimred = FALSE, ...){ # input check + .check_defunct_args(...names(), c("altExpNames", "keep_reducedDims")) if(!.is_a_bool(keep.dimred)){ stop("'keep.dimred' must be TRUE or FALSE.", call. = FALSE) } diff --git a/R/subset.R b/R/subset.R deleted file mode 100644 index b045e0b9c..000000000 --- a/R/subset.R +++ /dev/null @@ -1,11 +0,0 @@ -.get_subset_args <- function(x, subset = NULL, select = NULL, ...){ - rows <- subset - columns <- select - if(is.null(rows)){ - rows <- rep(TRUE,nrow(x)) - } - if(is.null(columns)){ - columns <- rep(TRUE,ncol(x)) - } - return(list(rows = rows, columns = columns)) -} diff --git a/R/summaries.R b/R/summaries.R index 7de7b71cd..f28342d1a 100644 --- a/R/summaries.R +++ b/R/summaries.R @@ -125,9 +125,9 @@ setMethod("getTop", signature = c(x = "SummarizedExperiment"), function( x, top = 5L, method = c("mean", "sum", "median", "sd", "cv", "prevalence"), - assay.type = assay_name, assay_name = "counts", - na.rm = TRUE, sort = FALSE, ...){ + assay.type = "counts", na.rm = TRUE, sort = FALSE, ...){ # input check + .check_defunct_args(...names(), "assay_name") method <- match.arg( method, c("mean","sum","median","sd","cv","prevalence")) # Optionally agglomerate data @@ -215,7 +215,7 @@ NULL #' @rdname summary #' @export setMethod("summarizeDominance", signature = c(x = "SummarizedExperiment"), - function(x, group = NULL, name = "dominant_taxa", ...){ + function(x, group = NULL, name = "dominant_taxa", rank = NULL, ...){ # Input check # group check if(!is.null(group)){ @@ -230,7 +230,7 @@ setMethod("summarizeDominance", signature = c(x = "SummarizedExperiment"), call. = FALSE) } # Adds dominant taxa to colData - dominant_taxa <- getDominant(x, ...) + dominant_taxa <- getDominant(x, group = rank, ...) data <- colData(x) # If the length of dominant taxa is not equal to number of rows, then # add rows @@ -341,7 +341,7 @@ setMethod("summarizeDominance", signature = c(x = "SummarizedExperiment"), #' #' @export setMethod("summary", signature = c(object = "SummarizedExperiment"), - function(object, assay.type = assay_name, assay_name = "counts"){ + function(object, assay.type = "counts"){ # Input check .check_assay_present(assay.type = assay.type, object) # diff --git a/R/taxonomy.R b/R/taxonomy.R index 9460e53ff..d407f10d9 100644 --- a/R/taxonomy.R +++ b/R/taxonomy.R @@ -34,20 +34,14 @@ #' @param with.rank \code{Logical scalar}. Should the level be add as a #' suffix? For example: "Phylum:Crenarchaeota". (Default: \code{FALSE}) #' -#' @param with_rank Deprecated. Use \code{with.rank} instead. -#' #' @param make.unique \code{Logical scalar}. Should the labels be made #' unique, if there are any duplicates? A message lists the changed #' labels, e.g. \code{"o -> o_1"}. (Default: \code{TRUE}) #' -#' @param make_unique Deprecated. Use \code{make.unique} instead. -#' #' @param resolve.loops \code{Logical scalar}. Should \code{resolveLoops} #' be applied to the taxonomic data? Please note that has only an effect, #' if the data is unique. (Default: \code{TRUE}) #' -#' @param resolve_loops Deprecated. Use \code{resolve.loops} instead. -#' #' @param taxa \code{Character vector}. Used for subsetting the #' taxonomic information. If no information is found,\code{NULL} is returned #' for the individual element. (Default: \code{NULL}) @@ -67,8 +61,6 @@ #' \code{grepl} be used? Otherwise literal matching is used. #' (Default: \code{FALSE}) #' -#' @param use_grepl Deprecated. Use \code{use.grepl} instead. -#' #' @param ... additional arguments #' \itemize{ #' \item \code{lowest.rank}: A lowest taxonomy level to be considered in @@ -303,10 +295,10 @@ getTaxonomyRanks <- function() { #' @export setMethod("getTaxonomyLabels", signature = c(x = "SummarizedExperiment"), function(x, empty.fields = c(NA, "", " ", "\t", "-", "_"), - with.rank = with_rank, - with_rank = FALSE, make.unique = make_unique, make_unique = TRUE, - resolve.loops = resolve_loops, resolve_loops = FALSE, ...){ + with.rank = FALSE, make.unique = TRUE, resolve.loops = FALSE, ...){ # input check + .check_defunct_args( + ...names(), c("with_rank", "make_unique", "resolve_loops")) if(nrow(x) == 0L){ stop("No data available in `x` ('x' has nrow(x) == 0L.)", call. = FALSE) @@ -651,8 +643,7 @@ setMethod("addHierarchyTree", signature = c(x = "SummarizedExperiment"), #' @importFrom BiocGenerics %in% #' @export setMethod("mapTaxonomy", signature = c(x = "SummarizedExperiment"), - function(x, taxa = NULL, from = NULL, to = NULL, use.grepl = use_grepl, - use_grepl = FALSE){ + function(x, taxa = NULL, from = NULL, to = NULL, use.grepl = FALSE){ # input check if(!checkTaxonomy(x)){ stop("Non compatible taxonomic information found. ", diff --git a/R/transformCounts.R b/R/transformCounts.R index cc6764d2d..ce5b8258a 100644 --- a/R/transformCounts.R +++ b/R/transformCounts.R @@ -259,13 +259,14 @@ NULL setMethod("transformAssay", signature = c(x = "SummarizedExperiment"), function( x, method, - assay.type = "counts", assay_name = NULL, + assay.type = "counts", MARGIN = "samples", name = method, pseudocount = FALSE, verbose = TRUE, ...){ # + .check_defunct_args(...names(), "assay_name") x <- .with_verbosity(.transform_assay( x = x, method = method, name = name, assay.type = assay.type, MARGIN = MARGIN, pseudocount = pseudocount, ...), verbose) @@ -277,6 +278,7 @@ setMethod("transformAssay", signature = c(x = "SummarizedExperiment"), #' @export setMethod("transformAssay", signature = c(x = "SingleCellExperiment"), function(x, altexp = NULL, verbose = TRUE, ...){ + .check_defunct_args(...names(), "assay_name") # Check altexp if( !(is.null(altexp) || all(altexp %in% altExpNames(x)) || (.is_integer(altexp) && @@ -308,7 +310,7 @@ setMethod("transformAssay", signature = c(x = "SingleCellExperiment"), # with specified method. By calling this generic function, we can apply same # methods for SE and altExps of TreeSE. .transform_assay <- function( - x, assay.type = "counts", assay_name = NULL, + x, assay.type = "counts", method = c( "alr", "binning", "chi.square", "clr", "css", "cutoff", "difference", "-", @@ -322,11 +324,6 @@ setMethod("transformAssay", signature = c(x = "SingleCellExperiment"), pseudocount = FALSE, ...){ # Input check - if(!is.null(assay_name)){ - .Deprecated(old="assay_name", new="assay.type", "Now assay_name is - deprecated. Use assay.type instead.") - assay.type <- assay_name - } # Check assay.type .check_assay_present(assay.type, x) # Check name diff --git a/R/utils.R b/R/utils.R index 34dcbc697..8baaa127f 100644 --- a/R/utils.R +++ b/R/utils.R @@ -926,3 +926,45 @@ } suppressWarnings(suppressMessages(expr)) } + +################################################################################ + +# Defunct argument names and their replacements. The functions that accepted +# them take '...', where an old name would otherwise be silently ignored. +.defunct_args <- c( + add_col_data = "add.col", add_row_data = "add.row", + agglomerate.tree = "update.tree", agglomerateTree = "update.tree", + altExpNames = "altexp", assay_name = "assay.type", + assay_name1 = "assay.type1", assay_name2 = "assay.type2", + colData = "col.data", colData_variable1 = "col.var1", + colData_variable2 = "col.var2", collapse_features = "collapse.rows", + collapse_samples = "collapse.cols", cor_threshold = "cor.threshold", + exprs_values = "assay.type", f = "group", feature_name = "row.name", + featureNamesAsRefSeq = "as.refseq", featureTableFile = "assay.file", + filter_self_correlations = "filter.self.cor", + include_lowest = "include.lowest", keep_dist = "keep.dist", + keep_reducedDims = "keep.dimred", make_unique = "make.unique", + MARGIN = "by", mergeTree = "update.tree", min_size = "sample", + missing_values = "missing.values", n_dimred = "ndimred", + nmdsFUN = "nmds.fun", p_adj_method = "p.adj.method", + p_adj_threshold = "p.adj.threshold", phy_tree = "tree.file", + phyTreeFile = "tree.file", rank = "group", + rankFromPrefix = "rank.from.prefix", refSeqFile = "refseq.file", + remove.artifacts = "artifact.rm", removeTaxaPrefixes = "prefix.rm", + resolve_loops = "resolve.loops", sample_meta = "col.data", + sample_name = "col.name", sampleMetaFile = "col.file", + show_warnings = "show.warnings", strip_altexp = "altexp.rm", + subset_row = "subset.row", taxonomyTableFile = "row.file", + temp = "temp.dir", test_significance = "test.signif", + tree_name = "tree.name", variables = "col.var", with_rank = "with.rank") + +# Gives an error if 'args', the names of '...', include any of the defunct +# argument names in 'old'. +.check_defunct_args <- function(args, old){ + old <- old[old %in% args] + if( length(old) > 0L ){ + stop(paste0( + "'", old, "' is defunct. Use '", .defunct_args[old], "' instead.", + collapse = "\n"), call. = FALSE) + } +} diff --git a/man/addCluster.Rd b/man/addCluster.Rd index f84068117..14bebe532 100644 --- a/man/addCluster.Rd +++ b/man/addCluster.Rd @@ -17,10 +17,8 @@ addCluster(x, ...) \S4method{addCluster}{SummarizedExperiment}( x, BLUSPARAM, - assay.type = assay_name, - assay_name = NULL, - by = MARGIN, - MARGIN = "rows", + assay.type = NULL, + by = "rows", name = "clustering", clust.col = "cluster", full = FALSE, @@ -30,39 +28,20 @@ addCluster(x, ...) \S4method{addCluster}{SingleCellExperiment}( x, BLUSPARAM, - assay.type = assay_name, - assay_name = NULL, + assay.type = NULL, dimred = NULL, - by = MARGIN, - MARGIN = "rows", + by = "rows", name = "clustering", clust.col = "cluster", full = FALSE, ... ) -\S4method{getCluster}{SummarizedExperiment}( - x, - BLUSPARAM, - assay.type = assay_name, - assay_name = NULL, - by = MARGIN, - MARGIN = "rows", - ... -) +\S4method{getCluster}{SummarizedExperiment}(x, BLUSPARAM, assay.type = NULL, by = "rows", ...) -\S4method{getCluster}{SingleCellExperiment}( - x, - BLUSPARAM, - assay.type = assay_name, - assay_name = NULL, - dimred = NULL, - by = MARGIN, - MARGIN = "rows", - ... -) +\S4method{getCluster}{SingleCellExperiment}(x, BLUSPARAM, assay.type = NULL, dimred = NULL, by = "rows", ...) -\S4method{getCluster}{ANY}(x, BLUSPARAM, by = MARGIN, MARGIN = "rows", full = FALSE, ...) +\S4method{getCluster}{ANY}(x, BLUSPARAM, by = "rows", full = FALSE, ...) } \arguments{ \item{x}{A @@ -76,14 +55,10 @@ object.} \item{assay.type}{\code{Character scalar}. Specifies the name of assay used in calculation.} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - \item{by}{\code{Character scalar}. Determines if association is calculated row-wise / for features ('rows') or column-wise / for samples ('cols'). Must be \code{'rows'} or \code{'cols'}.} -\item{MARGIN}{Deprecated. Use \code{by} instead.} - \item{name}{\code{Character scalar}. The name to store the result in \code{\link[SummarizedExperiment:RangedSummarizedExperiment-class]{metadata}}} diff --git a/man/addDivergence.Rd b/man/addDivergence.Rd index ea67a5dca..835962e22 100644 --- a/man/addDivergence.Rd +++ b/man/addDivergence.Rd @@ -11,8 +11,7 @@ addDivergence(x, name = "divergence", ...) getDivergence( x, - assay.type = assay_name, - assay_name = "counts", + assay.type = "counts", reference = "median", method = "bray", ... @@ -22,8 +21,7 @@ getDivergence( \S4method{getDivergence}{SummarizedExperiment}( x, - assay.type = assay_name, - assay_name = "counts", + assay.type = "counts", reference = "median", method = "bray", FUN = getDissimilarity, @@ -48,8 +46,6 @@ disabled with \code{NULL}. (Default: \code{NULL}) \item{assay.type}{\code{Character scalar}. Specifies the name of assay used in calculation. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - \item{reference}{\code{Character scalar}. A column name from \code{colData(x)} or either \code{"mean"} or \code{"median"}. If column name is specified, the column must include reference samples for each sample. diff --git a/man/agglomerate-methods.Rd b/man/agglomerate-methods.Rd index 5a1fbc34b..ff994a881 100644 --- a/man/agglomerate-methods.Rd +++ b/man/agglomerate-methods.Rd @@ -32,21 +32,13 @@ agglomerateByRanks(x, ...) unsplitByRanks(x, ...) -\S4method{agglomerateByRank}{TreeSummarizedExperiment}( - x, - rank = taxonomyRanks(x)[1], - update.tree = agglomerateTree, - agglomerate.tree = agglomerateTree, - agglomerateTree = FALSE, - ... -) +\S4method{agglomerateByRank}{TreeSummarizedExperiment}(x, rank = taxonomyRanks(x)[1], update.tree = FALSE, ...) \S4method{agglomerateByRank}{SingleCellExperiment}( x, rank = taxonomyRanks(x)[1], altexp = NULL, - altexp.rm = strip_altexp, - strip_altexp = TRUE, + altexp.rm = TRUE, ... ) @@ -58,17 +50,9 @@ unsplitByRanks(x, ...) ... ) -\S4method{agglomerateByVariable}{TreeSummarizedExperiment}( - x, - by, - group = f, - f, - update.tree = mergeTree, - mergeTree = FALSE, - ... -) +\S4method{agglomerateByVariable}{TreeSummarizedExperiment}(x, by, group, update.tree = FALSE, ...) -\S4method{agglomerateByVariable}{SummarizedExperiment}(x, by, group = f, f, ...) +\S4method{agglomerateByVariable}{SummarizedExperiment}(x, by, group, ...) \S4method{agglomerateBySet}{SummarizedExperiment}(x, by, group, na.rm = FALSE) @@ -98,21 +82,9 @@ unsplitByRanks(x, ...) splitByRanks(x, ...) -\S4method{unsplitByRanks}{SingleCellExperiment}( - x, - ranks = taxonomyRanks(x), - keep.dimred = keep_reducedDims, - keep_reducedDims = FALSE, - ... -) +\S4method{unsplitByRanks}{SingleCellExperiment}(x, ranks = taxonomyRanks(x), keep.dimred = FALSE, ...) -\S4method{unsplitByRanks}{TreeSummarizedExperiment}( - x, - ranks = taxonomyRanks(x), - keep.dimred = keep_reducedDims, - keep_reducedDims = FALSE, - ... -) +\S4method{unsplitByRanks}{TreeSummarizedExperiment}(x, ranks = taxonomyRanks(x), keep.dimred = FALSE, ...) } \arguments{ \item{x}{\code{\link[TreeSummarizedExperiment:TreeSummarizedExperiment-class]{TreeSummarizedExperiment}}.} @@ -131,10 +103,6 @@ monophyletic, i.e., each group forms its own subtree. Otherwise, the tree is removed with a warning. If \code{FALSE}, the tree is removed. (Default: \code{FALSE})} -\item{agglomerate.tree}{Deprecated. Use \code{update.tree} instead.} - -\item{agglomerateTree}{Deprecated. Use \code{update.tree} instead.} - \item{altexp}{\code{Character scalar} or \code{integer scalar}. Specifies an alternative experiment containing the input data.} @@ -143,8 +111,6 @@ experiments be removed prior to agglomeration? This prevents too many nested alternative experiments by default. (Default: \code{TRUE})} -\item{strip_altexp}{Deprecated. Use \code{altexp.rm} instead.} - \item{empty.rm}{\code{Logical scalar}. Defines whether rows including \code{empty.fields} in specified \code{rank} will be excluded. (Default: \code{TRUE})} @@ -167,10 +133,6 @@ be returned unchanged. For \code{agglomerateBySet}, \code{group} should specify one or several names of numeric or logical variables from the \code{rowData(x)/colData(x)} by which to agglomerate rows or columns.} -\item{f}{Deprecated. Use \code{group} instead.} - -\item{mergeTree}{Deprecated. Use \code{update.tree} instead.} - \item{na.rm}{\code{Logical scalar}. Should NA values be omitted? (Default: \code{TRUE})} @@ -186,8 +148,6 @@ values of \code{taxonomyRanks()} function.} \code{reducedDims(x)} be transferred to the result? Please note, that this breaks the link between the data used to calculate the reduced dims. (Default: \code{FALSE})} - -\item{keep_reducedDims}{Deprecated. Use \code{keep.dimred} instead.} } \value{ \code{agglomerateByRank} returns a taxonomically-agglomerated, diff --git a/man/calculateDMN.Rd b/man/calculateDMNgroup.Rd similarity index 59% rename from man/calculateDMN.Rd rename to man/calculateDMNgroup.Rd index 536b102c3..61934b6a9 100644 --- a/man/calculateDMN.Rd +++ b/man/calculateDMNgroup.Rd @@ -1,61 +1,18 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/AllGenerics.R, R/calculateDMM.R -\name{calculateDMN} -\alias{calculateDMN} -\alias{getDMN} -\alias{bestDMNFit} +\name{calculateDMNgroup} \alias{calculateDMNgroup} \alias{performDMNgroupCV} -\alias{getBestDMNFit} -\alias{calculateDMN,ANY-method} -\alias{calculateDMN,SummarizedExperiment-method} -\alias{runDMN} -\alias{getDMN,SummarizedExperiment-method} -\alias{bestDMNFit,SummarizedExperiment-method} -\alias{getBestDMNFit,SummarizedExperiment-method} \alias{calculateDMNgroup,ANY-method} \alias{calculateDMNgroup,SummarizedExperiment-method} \alias{performDMNgroupCV,ANY-method} \alias{performDMNgroupCV,SummarizedExperiment-method} \title{Dirichlet-Multinomial Mixture Model: Machine Learning for Microbiome Data} \usage{ -calculateDMN(x, ...) - -getDMN(x, name = "DMN", ...) - -bestDMNFit(x, name = "DMN", type = c("laplace", "AIC", "BIC"), ...) - calculateDMNgroup(x, ...) performDMNgroupCV(x, ...) -getBestDMNFit(x, name = "DMN", type = c("laplace", "AIC", "BIC"), ...) - -\S4method{calculateDMN}{ANY}( - x, - k = 1, - BPPARAM = SerialParam(), - seed = runif(1, 0, .Machine$integer.max), - ... -) - -\S4method{calculateDMN}{SummarizedExperiment}( - x, - assay.type = assay_name, - assay_name = exprs_values, - exprs_values = "counts", - transposed = FALSE, - ... -) - -runDMN(x, name = "DMN", ...) - -\S4method{getDMN}{SummarizedExperiment}(x, name = "DMN") - -\S4method{bestDMNFit}{SummarizedExperiment}(x, name = "DMN", type = c("laplace", "AIC", "BIC")) - -\S4method{getBestDMNFit}{SummarizedExperiment}(x, name = "DMN", type = c("laplace", "AIC", "BIC")) - \S4method{calculateDMNgroup}{ANY}( x, variable, @@ -64,15 +21,7 @@ runDMN(x, name = "DMN", ...) ... ) -\S4method{calculateDMNgroup}{SummarizedExperiment}( - x, - variable, - assay.type = assay_name, - assay_name = exprs_values, - exprs_values = "counts", - transposed = FALSE, - ... -) +\S4method{calculateDMNgroup}{SummarizedExperiment}(x, variable, assay.type = "counts", transposed = FALSE, ...) \S4method{performDMNgroupCV}{ANY}( x, @@ -82,15 +31,7 @@ runDMN(x, name = "DMN", ...) ... ) -\S4method{performDMNgroupCV}{SummarizedExperiment}( - x, - variable, - assay.type = assay_name, - assay_name = exprs_values, - exprs_values = "counts", - transposed = FALSE, - ... -) +\S4method{performDMNgroupCV}{SummarizedExperiment}(x, variable, assay.type = "counts", transposed = FALSE, ...) } \arguments{ \item{x}{a numeric matrix with samples as rows or a @@ -99,42 +40,22 @@ object.} \item{...}{optional arguments not used.} -\item{name}{\code{Character scalar}. The name to store the result in -\code{\link[SummarizedExperiment:RangedSummarizedExperiment-class]{metadata}}} - -\item{type}{\code{Character scalar}. The type of measure used for the -goodness of fit. One of \sQuote{laplace}, \sQuote{AIC} or \sQuote{BIC}.} +\item{variable}{\code{Character scalar}. A variable from \code{colData} to +use as a grouping variable. Must be a character of factor.} \item{k}{\code{Numeric scalar}. The number of Dirichlet components to fit. See \code{\link[DirichletMultinomial:dmn]{dmn}}. (Default: \code{1})} -\item{BPPARAM}{A -\code{\link[BiocParallel:BiocParallelParam-class]{BiocParallelParam}} -object specifying whether the calculation should be parallelized.} - \item{seed}{\code{Numeric scalar}. Random number seed. See \code{\link[DirichletMultinomial:dmn]{dmn}}} \item{assay.type}{\code{Character scalar}. Specifies the name of the assay used in calculation. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - -\item{exprs_values}{Deprecated. Use \code{assay.type} instead.} - \item{transposed}{\code{Logical scalar}. Is \code{x} transposed with samples in rows? (Default: \code{FALSE})} - -\item{variable}{\code{Character scalar}. A variable from \code{colData} to -use as a grouping variable. Must be a character of factor.} } \value{ -\code{calculateDMN} and \code{getDMN} return a list of \code{DMN} objects, -one element for each value of k provided. - -\code{bestDMNFit} returns the index for the best fit and \code{getBestDMNFit} -returns a single \code{DMN} object. - \code{calculateDMNgroup} returns a \code{\link[DirichletMultinomial:DMNGroup-class]{DMNGroup}} object diff --git a/man/convertFromPhyloseq.Rd b/man/convertFromPhyloseq.Rd index f97f7b024..78601b2e0 100644 --- a/man/convertFromPhyloseq.Rd +++ b/man/convertFromPhyloseq.Rd @@ -12,9 +12,9 @@ convertToPhyloseq(x, ...) convertFromPhyloseq(x) -\S4method{convertToPhyloseq}{SummarizedExperiment}(x, assay.type = "counts", assay_name = NULL, ...) +\S4method{convertToPhyloseq}{SummarizedExperiment}(x, assay.type = "counts", ...) -\S4method{convertToPhyloseq}{TreeSummarizedExperiment}(x, tree.name = tree_name, tree_name = "phylo", ...) +\S4method{convertToPhyloseq}{TreeSummarizedExperiment}(x, tree.name = "phylo", ...) } \arguments{ \item{x}{a @@ -26,15 +26,11 @@ object} \item{assay.type}{\code{Character scalar}. Specifies the name of assay used. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - \item{tree.name}{\code{NULL} or \code{Character scalar}. Specifies the name of the tree to be included in the phyloseq object that is created. If \code{NULL}, no tree is included. As phyloseq orders the features by the tips of the tree, this keeps the feature order of \code{x}. (Default: \code{"phylo"})} - -\item{tree_name}{Deprecated. Use \code{tree.name} instead.} } \value{ \code{convertFromPhyloseq} returns an object of class diff --git a/man/deprecate.Rd b/man/deprecate.Rd index 35f767520..baff7849d 100644 --- a/man/deprecate.Rd +++ b/man/deprecate.Rd @@ -2,154 +2,9 @@ % Please edit documentation in R/deprecate.R \name{deprecate} \alias{deprecate} -\alias{cluster} -\alias{cluster,SummarizedExperiment-method} -\alias{addTaxonomyTree} -\alias{addTaxonomyTree,SummarizedExperiment-method} -\alias{taxonomyTree} -\alias{taxonomyTree,SummarizedExperiment-method} +\alias{calculateDMN} \alias{agglomerateByModule} \alias{agglomerateByModule,SummarizedExperiment-method} -\alias{mergeRows} -\alias{mergeRows,SummarizedExperiment-method} -\alias{mergeRows,TreeSummarizedExperiment-method} -\alias{mergeCols} -\alias{mergeCols,SummarizedExperiment-method} -\alias{mergeCols,TreeSummarizedExperiment-method} -\alias{mergeFeatures} -\alias{mergeFeatures,SummarizedExperiment-method} -\alias{mergeFeatures,TreeSummarizedExperiment-method} -\alias{mergeSamples} -\alias{mergeSamples,SummarizedExperiment-method} -\alias{mergeSamples,TreeSummarizedExperiment-method} -\alias{mergeFeaturesByRank} -\alias{mergeFeaturesByRank,SummarizedExperiment-method} -\alias{mergeFeaturesByRank,SingleCellExperiment-method} -\alias{mergeFeaturesByPrevalence} -\alias{mergeFeaturesByPrevalence,SummarizedExperiment-method} -\alias{getExperimentCrossAssociation} -\alias{getExperimentCrossAssociation,MultiAssayExperiment-method} -\alias{getExperimentCrossAssociation,SummarizedExperiment-method} -\alias{mergeFeaturesByRank,TreeSummarizedExperiment-method} -\alias{testExperimentCrossAssociation} -\alias{testExperimentCrossAssociation,ANY-method} -\alias{testExperimentCrossCorrelation} -\alias{testExperimentCrossCorrelation,ANY-method} -\alias{getExperimentCrossCorrelation} -\alias{getExperimentCrossCorrelation,ANY-method} -\alias{loadFromBiom} -\alias{loadFromQIIME2} -\alias{readQZA} -\alias{loadFromMothur} -\alias{loadFromMetaphlan} -\alias{loadFromHumann} -\alias{countDominantFeatures} -\alias{countDominantFeatures,SummarizedExperiment-method} -\alias{subsetByRareTaxa} -\alias{subsetByRareTaxa,ANY-method} -\alias{subsetByRareFeatures} -\alias{subsetByRareFeatures,ANY-method} -\alias{subsetByPrevalentTaxa} -\alias{subsetByPrevalentTaxa,ANY-method} -\alias{subsetByPrevalentFeatures} -\alias{subsetByPrevalentFeatures,ANY-method} -\alias{countDominantTaxa} -\alias{countDominantTaxa,SummarizedExperiment-method} -\alias{full_join} -\alias{full_join,ANY-method} -\alias{inner_join} -\alias{inner_join,ANY-method} -\alias{left_join} -\alias{left_join,ANY-method} -\alias{right_join} -\alias{right_join,ANY-method} -\alias{plotNMDS} -\alias{estimateDivergence} -\alias{estimateDivergence,SummarizedExperiment-method} -\alias{meltAssay} -\alias{meltAssay,SummarizedExperiment-method} -\alias{transformSamples} -\alias{transformSamples,SummarizedExperiment-method} -\alias{ZTransform} -\alias{ZTransform,SummarizedExperiment-method} -\alias{relAbundanceCounts} -\alias{relAbundanceCounts,SummarizedExperiment-method} -\alias{transformCounts} -\alias{transformFeatures} -\alias{transformFeatures,SummarizedExperiment-method} -\alias{getUniqueFeatures} -\alias{getUniqueFeatures,SummarizedExperiment-method} -\alias{getUniqueTaxa} -\alias{getUniqueTaxa,SummarizedExperiment-method} -\alias{getTopFeatures} -\alias{getTopFeatures,SummarizedExperiment-method} -\alias{getTopTaxa} -\alias{getTopTaxa,SummarizedExperiment-method} -\alias{getRareFeatures} -\alias{getRareFeatures,ANY-method} -\alias{getRareFeatures,SummarizedExperiment-method} -\alias{getRareTaxa} -\alias{getRareTaxa,ANY-method} -\alias{getRareTaxa,SummarizedExperiment-method} -\alias{getPrevalentFeatures} -\alias{getPrevalentFeatures,ANY-method} -\alias{getPrevalentFeatures,SummarizedExperiment-method} -\alias{getPrevalentTaxa} -\alias{getPrevalentTaxa,ANY-method} -\alias{getPrevalentTaxa,SummarizedExperiment-method} -\alias{subsampleCounts} -\alias{subsampleCounts,SummarizedExperiment-method} -\alias{addPerSampleDominantFeatures} -\alias{addPerSampleDominantFeatures,SummarizedExperiment-method} -\alias{addPerSampleDominantTaxa} -\alias{addPerSampleDominantTaxa,SummarizedExperiment-method} -\alias{perSampleDominantFeatures} -\alias{perSampleDominantFeatures,SummarizedExperiment-method} -\alias{perSampleDominantTaxa} -\alias{perSampleDominantTaxa,SummarizedExperiment-method} -\alias{makePhyloseqFromTreeSE} -\alias{makePhyloseqFromTreeSE,SummarizedExperiment-method} -\alias{makePhyloseqFromTreeSE,TreeSummarizedExperiment-method} -\alias{makePhyloseqFromTreeSummarizedExperiment} -\alias{makePhyloseqFromTreeSummarizedExperiment,ANY-method} -\alias{makeTreeSummarizedExperimentFromPhyloseq} -\alias{makeTreeSummarizedExperimentFromPhyloseq,ANY-method} -\alias{makeTreeSEFromBiom} -\alias{makeTreeSummarizedExperimentFromBiom} -\alias{makeTreeSEFromDADA2} -\alias{makeTreeSummarizedExperimentFromDADA2} -\alias{makeTreeSEFromPhyloseq} -\alias{estimateEvenness} -\alias{estimateEvenness,ANY-method} -\alias{estimateRichness} -\alias{estimateRichness,ANY-method} -\alias{estimateDiversity} -\alias{estimateDiversity,ANY-method} -\alias{estimateFaith} -\alias{estimateFaith,ANY-method} -\alias{estimateDominance} -\alias{estimateDominance,ANY-method} -\alias{subsetSamples} -\alias{subsetFeatures} -\alias{subsetTaxa} -\alias{subsetSamples,SummarizedExperiment-method} -\alias{subsetFeatures,SummarizedExperiment-method} -\alias{subsetTaxa,SummarizedExperiment-method} -\alias{relabundance} -\alias{relabundance<-} -\alias{relabundance,SummarizedExperiment-method} -\alias{relabundance<-,SummarizedExperiment-method} -\alias{runOverlap} -\alias{runOverlap,SummarizedExperiment-method} -\alias{calculateOverlap} -\alias{calculateOverlap,ANY-method} -\alias{calculateJSD} -\alias{calculateJSD,ANY-method} -\alias{runJSD} -\alias{runJSD,SummarizedExperiment-method} -\alias{calculateUnifrac} -\alias{calculateUnifrac,ANY-method} -\alias{runUnifrac} \alias{subsetByPrevalent} \alias{subsetByPrevalent,SummarizedExperiment-method} \alias{agglomerateByPrevalence} @@ -158,302 +13,12 @@ \alias{subsetByRare,SummarizedExperiment-method} \title{These functions will be deprecated. Please use other functions instead.} \usage{ -cluster(x, ...) - -\S4method{cluster}{SummarizedExperiment}(x, ...) - -addTaxonomyTree(x, ...) - -\S4method{addTaxonomyTree}{SummarizedExperiment}(x, ...) - -taxonomyTree(x, ...) - -\S4method{taxonomyTree}{SummarizedExperiment}(x, ...) +calculateDMN(x, ...) agglomerateByModule(x, ...) \S4method{agglomerateByModule}{SummarizedExperiment}(x, ...) -mergeRows(x, ...) - -\S4method{mergeRows}{SummarizedExperiment}(x, ...) - -\S4method{mergeRows}{TreeSummarizedExperiment}(x, ...) - -mergeCols(x, ...) - -\S4method{mergeCols}{SummarizedExperiment}(x, ...) - -\S4method{mergeCols}{TreeSummarizedExperiment}(x, ...) - -mergeFeatures(x, ...) - -\S4method{mergeFeatures}{SummarizedExperiment}(x, ...) - -\S4method{mergeFeatures}{TreeSummarizedExperiment}(x, ...) - -mergeSamples(x, ...) - -\S4method{mergeSamples}{SummarizedExperiment}(x, ...) - -\S4method{mergeSamples}{TreeSummarizedExperiment}(x, ...) - -mergeFeaturesByRank(x, ...) - -\S4method{mergeFeaturesByRank}{SummarizedExperiment}(x, ...) - -\S4method{mergeFeaturesByRank}{SingleCellExperiment}(x, ...) - -mergeFeaturesByPrevalence(x, ...) - -\S4method{mergeFeaturesByPrevalence}{SummarizedExperiment}(x, ...) - -getExperimentCrossAssociation(x, ...) - -\S4method{getExperimentCrossAssociation}{MultiAssayExperiment}(x, ...) - -\S4method{getExperimentCrossAssociation}{SummarizedExperiment}(x, ...) - -\S4method{mergeFeaturesByRank}{TreeSummarizedExperiment}(x, ...) - -testExperimentCrossAssociation(x, ...) - -\S4method{testExperimentCrossAssociation}{ANY}(x, ...) - -testExperimentCrossCorrelation(x, ...) - -\S4method{testExperimentCrossCorrelation}{ANY}(x, ...) - -getExperimentCrossCorrelation(x, ...) - -\S4method{getExperimentCrossCorrelation}{ANY}(x, ...) - -loadFromBiom(...) - -loadFromQIIME2(...) - -readQZA(...) - -loadFromMothur(...) - -loadFromMetaphlan(...) - -loadFromHumann(...) - -countDominantFeatures(x, ...) - -\S4method{countDominantFeatures}{SummarizedExperiment}(x, ...) - -subsetByRareTaxa(x, ...) - -\S4method{subsetByRareTaxa}{ANY}(x, ...) - -subsetByRareFeatures(x, ...) - -\S4method{subsetByRareFeatures}{ANY}(x, ...) - -subsetByPrevalentTaxa(x, ...) - -\S4method{subsetByPrevalentTaxa}{ANY}(x, ...) - -subsetByPrevalentFeatures(x, ...) - -\S4method{subsetByPrevalentFeatures}{ANY}(x, ...) - -countDominantTaxa(x, ...) - -\S4method{countDominantTaxa}{SummarizedExperiment}(x, ...) - -full_join(x, ...) - -\S4method{full_join}{ANY}(x, ...) - -inner_join(x, ...) - -\S4method{inner_join}{ANY}(x, ...) - -left_join(x, ...) - -\S4method{left_join}{ANY}(x, ...) - -right_join(x, ...) - -\S4method{right_join}{ANY}(x, ...) - -plotNMDS(x, ...) - -estimateDivergence(x, ...) - -\S4method{estimateDivergence}{SummarizedExperiment}(x, ...) - -meltAssay(x, ...) - -\S4method{meltAssay}{SummarizedExperiment}(x, ...) - -transformSamples(x, ...) - -\S4method{transformSamples}{SummarizedExperiment}(x, ...) - -ZTransform(x, ...) - -\S4method{ZTransform}{SummarizedExperiment}(x, ...) - -relAbundanceCounts(x, ...) - -\S4method{relAbundanceCounts}{SummarizedExperiment}(x, ...) - -transformCounts(x, ...) - -transformFeatures(x, ...) - -\S4method{transformFeatures}{SummarizedExperiment}(x, ...) - -getUniqueFeatures(x, ...) - -\S4method{getUniqueFeatures}{SummarizedExperiment}(x, ...) - -getUniqueTaxa(x, ...) - -\S4method{getUniqueTaxa}{SummarizedExperiment}(x, ...) - -getTopFeatures(x, ...) - -\S4method{getTopFeatures}{SummarizedExperiment}(x, ...) - -getTopTaxa(x, ...) - -\S4method{getTopTaxa}{SummarizedExperiment}(x, ...) - -getRareFeatures(x, ...) - -\S4method{getRareFeatures}{ANY}(x, ...) - -\S4method{getRareFeatures}{SummarizedExperiment}(x, ...) - -getRareTaxa(x, ...) - -\S4method{getRareTaxa}{ANY}(x, ...) - -\S4method{getRareTaxa}{SummarizedExperiment}(x, ...) - -getPrevalentFeatures(x, ...) - -\S4method{getPrevalentFeatures}{ANY}(x, ...) - -\S4method{getPrevalentFeatures}{SummarizedExperiment}(x, ...) - -getPrevalentTaxa(x, ...) - -\S4method{getPrevalentTaxa}{ANY}(x, ...) - -\S4method{getPrevalentTaxa}{SummarizedExperiment}(x, ...) - -subsampleCounts(x, ...) - -\S4method{subsampleCounts}{SummarizedExperiment}(x, ...) - -addPerSampleDominantFeatures(x, ...) - -\S4method{addPerSampleDominantFeatures}{SummarizedExperiment}(x, ...) - -addPerSampleDominantTaxa(x, ...) - -\S4method{addPerSampleDominantTaxa}{SummarizedExperiment}(x, ...) - -perSampleDominantFeatures(x, ...) - -\S4method{perSampleDominantFeatures}{SummarizedExperiment}(x, ...) - -perSampleDominantTaxa(x, ...) - -\S4method{perSampleDominantTaxa}{SummarizedExperiment}(x, ...) - -makePhyloseqFromTreeSE(x, ...) - -\S4method{makePhyloseqFromTreeSE}{SummarizedExperiment}(x) - -\S4method{makePhyloseqFromTreeSE}{TreeSummarizedExperiment}(x) - -makePhyloseqFromTreeSummarizedExperiment(x) - -\S4method{makePhyloseqFromTreeSummarizedExperiment}{ANY}(x) - -makeTreeSummarizedExperimentFromPhyloseq(x) - -\S4method{makeTreeSummarizedExperimentFromPhyloseq}{ANY}(x) - -makeTreeSEFromBiom(...) - -makeTreeSummarizedExperimentFromBiom(...) - -makeTreeSEFromDADA2(...) - -makeTreeSummarizedExperimentFromDADA2(...) - -makeTreeSEFromPhyloseq(x) - -estimateEvenness(x, ...) - -\S4method{estimateEvenness}{ANY}(x, ...) - -estimateRichness(x, ...) - -\S4method{estimateRichness}{ANY}(x, ...) - -estimateDiversity(x, ...) - -\S4method{estimateDiversity}{ANY}(x, ...) - -estimateFaith(x, ...) - -\S4method{estimateFaith}{ANY}(x, ...) - -estimateDominance(x, ...) - -\S4method{estimateDominance}{ANY}(x, ...) - -subsetSamples(x, ...) - -subsetFeatures(x, ...) - -subsetTaxa(x, ...) - -\S4method{subsetSamples}{SummarizedExperiment}(x, ...) - -\S4method{subsetFeatures}{SummarizedExperiment}(x, ...) - -\S4method{subsetTaxa}{SummarizedExperiment}(x, ...) - -relabundance(x, ...) - -relabundance(x) <- value - -\S4method{relabundance}{SummarizedExperiment}(x) - -\S4method{relabundance}{SummarizedExperiment}(x) <- value - -runOverlap(x, ...) - -\S4method{runOverlap}{SummarizedExperiment}(x, ...) - -calculateOverlap(x, ...) - -\S4method{calculateOverlap}{ANY}(x, ...) - -calculateJSD(x, ...) - -\S4method{calculateJSD}{ANY}(x, ...) - -runJSD(x, ...) - -\S4method{runJSD}{SummarizedExperiment}(x, ...) - -calculateUnifrac(x, ...) - -\S4method{calculateUnifrac}{ANY}(x, ...) - -runUnifrac(mat, tree, ...) - subsetByPrevalent(x, ...) \S4method{subsetByPrevalent}{SummarizedExperiment}(x, ...) @@ -472,13 +37,10 @@ subsetByRare(x, ...) object.} \item{...}{Additional parameters. See dedicated function.} - -\item{value}{a matrix to store as the \sQuote{relabundance} assay} - -\item{mat}{An abundance matrix} - -\item{tree}{A phylogenetic tree} } \description{ These functions will be deprecated. Please use other functions instead. } +\seealso{ +\code{\link{mia-defunct}} for the functions that are defunct. +} diff --git a/man/dmn_se.Rd b/man/dmn_se.Rd index fd816fbf7..e4d8643b0 100644 --- a/man/dmn_se.Rd +++ b/man/dmn_se.Rd @@ -28,7 +28,7 @@ was derived from the \pkg{DirichletMultinomial} package. } \seealso{ \code{\link{mia-datasets}} -\code{\link{calculateDMN}} +\code{\link{calculateDMNgroup}} } \author{ Turnbaugh, PJ et al. diff --git a/man/getCrossAssociation.Rd b/man/getCrossAssociation.Rd index 84d6a800a..46873b0de 100644 --- a/man/getCrossAssociation.Rd +++ b/man/getCrossAssociation.Rd @@ -12,34 +12,23 @@ getCrossAssociation(x, ...) x, experiment1 = 1, experiment2 = 2, - assay.type1 = assay_name1, - assay_name1 = NULL, - assay.type2 = assay_name2, - assay_name2 = NULL, + assay.type1 = NULL, + assay.type2 = NULL, altexp1 = NULL, altexp2 = NULL, - col.var1 = colData_variable1, - colData_variable1 = NULL, - col.var2 = colData_variable2, - colData_variable2 = NULL, - by = MARGIN, - MARGIN = 1, + col.var1 = NULL, + col.var2 = NULL, + by = 1, method = "kendall", mode = "table", - p.adj.method = p_adj_method, - p_adj_method = c("fdr", "BH", "bonferroni", "BY", "hochberg", "holm", "hommel", "none"), - p.adj.threshold = p_adj_threshold, - p_adj_threshold = NULL, - cor.threshold = cor_threshold, - cor_threshold = NULL, + p.adj.method = c("fdr", "BH", "bonferroni", "BY", "hochberg", "holm", "hommel", "none"), + p.adj.threshold = NULL, + cor.threshold = NULL, sort = FALSE, - filter.self.cor = filter_self_correlations, - filter_self_correlations = FALSE, + filter.self.cor = FALSE, verbose = TRUE, - test.signif = test_significance, - test_significance = FALSE, - show.warnings = show_warnings, - show_warnings = TRUE, + test.signif = FALSE, + show.warnings = TRUE, paired = FALSE, ... ) @@ -93,13 +82,9 @@ Selects the experiment 2 from\code{experiments(x)} of \item{assay.type1}{\code{Character scalar}. Specifies the name of the assay in experiment 1 to be transformed. (Default: \code{NULL})} -\item{assay_name1}{Deprecated. Use \code{assay.type1} instead.} - \item{assay.type2}{\code{Character scalar}. Specifies the name of the assay in experiment 2 to be transformed. (Default: \code{NULL})} -\item{assay_name2}{Deprecated. Use \code{assay.type2} instead.} - \item{altexp1}{\code{Character scalar} or \code{numeric scalar}. Specifies alternative experiment from the \code{altExp} of experiment 1. If NULL, then the experiment is itself and altExp option is disabled. @@ -114,20 +99,14 @@ the experiment is itself and altExp option is disabled. \code{colData} of experiment 1. If col.var1 is used, assay.type1 is disabled. (Default: \code{NULL})} -\item{colData_variable1}{Deprecated. Use \code{col.var1} instead.} - \item{col.var2}{\code{Character scalar}. Specifies column(s) from colData of experiment 2. If col.var2 is used, assay.type2 is disabled. (Default: \code{NULL})} -\item{colData_variable2}{Deprecated. Use \code{col.var2} instead.} - \item{by}{A\code{Character scalar}. Determines if association are calculated row-wise / for features ('rows') or column-wise / for samples ('cols'). Must be \code{'rows'} or \code{'cols'}.} -\item{MARGIN}{Deprecated. Use \code{by} instead.} - \item{method}{\code{Character scalar}. Defines the association method ('kendall', 'pearson', or 'spearman' for continuous/numeric; 'categorical' for discrete) (Default: \code{"kendall"})} @@ -139,20 +118,14 @@ Available formats are 'table' and 'matrix'. (Default: \code{"table"})} p-values. Passed to \code{p.adjust} function. (Default: \code{"fdr"})} -\item{p_adj_method}{Deprecated. Use \code{p.adj.method} instead.} - \item{p.adj.threshold}{\code{Numeric scalar}. From \code{0 to 1}, specifies adjusted p-value threshold for filtering. (Default: \code{NULL})} -\item{p_adj_threshold}{Deprecated. Use \code{p.dj.threshold} instead.} - \item{cor.threshold}{\code{Numeric scalar}. From \code{0 to 1}, specifies correlation threshold for filtering. (Default: \code{NULL})} -\item{cor_threshold}{Deprecated. Use \code{cor.threshold} instead.} - \item{sort}{\code{Logical scalar}. Specifies whether to sort features or not in result matrices. Used method is hierarchical clustering. (Default: \code{FALSE})} @@ -162,9 +135,6 @@ filter out correlations between identical items. Applies only when correlation between experiment itself is tested, i.e., when assays are identical. (Default: \code{FALSE})} -\item{filter_self_correlations}{Deprecated. Use \code{filter.self.cor} -instead.} - \item{verbose}{\code{Logical scalar}. Specifies whether to get messages about progress of calculation. (Default: \code{FALSE})} @@ -172,14 +142,10 @@ about progress of calculation. (Default: \code{FALSE})} statistical significance of associations. (Default: \code{FALSE})} -\item{test_significance}{Deprecated. Use \code{test.signif} instead.} - \item{show.warnings}{\code{Logical scalar}. specifies whether to show warnings that might occur when correlations and p-values are calculated. (Default: \code{FALSE})} -\item{show_warnings}{Deprecated. use \code{show.warnings} instead.} - \item{paired}{\code{Logical scalar}. Specifies if samples are paired or not. \code{colnames} must match between twp experiments. \code{paired} is disabled when \code{by = 1}. (Default: \code{FALSE})} diff --git a/man/getDominant.Rd b/man/getDominant.Rd index 5b28f42ca..94bcfcc00 100644 --- a/man/getDominant.Rd +++ b/man/getDominant.Rd @@ -9,10 +9,8 @@ \usage{ getDominant( x, - assay.type = assay_name, - assay_name = "counts", - group = rank, - rank = NULL, + assay.type = "counts", + group = NULL, other.name = "Other", n = NULL, complete = TRUE, @@ -23,10 +21,8 @@ addDominant(x, name = "dominant_taxa", other.name = "Other", n = NULL, ...) \S4method{getDominant}{SummarizedExperiment}( x, - assay.type = assay_name, - assay_name = "counts", - group = rank, - rank = NULL, + assay.type = "counts", + group = NULL, other.name = "Other", n = NULL, complete = TRUE, @@ -48,13 +44,9 @@ addDominant(x, name = "dominant_taxa", other.name = "Other", n = NULL, ...) \item{assay.type}{\code{Character scalar}. Specifies the name of assay used in calculation. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - \item{group}{\code{Character scalar}. Defines a group. Must be one of the columns from \code{rowData(x)}. (Default: \code{NULL})} -\item{rank}{Deprecated. Use \code{group} instead.} - \item{other.name}{\code{Character scalar}. A name for features that are not included in n the most frequent dominant features in the data. (Default: \code{"Other"})} @@ -75,7 +67,7 @@ dominant taxon assigned for each sample into colData. complete = TRUE adds a list that includes all dominant taxa for each sample into colData.} \item{...}{Additional arguments passed on to \code{agglomerateByRank()} when -\code{rank} is specified.} +\code{group} is specified.} \item{name}{\code{Character scalar}. A name for the column of the \code{colData} where results will be stored. diff --git a/man/getPrevalence.Rd b/man/getPrevalence.Rd index 973a1cb5b..892a8e2b9 100644 --- a/man/getPrevalence.Rd +++ b/man/getPrevalence.Rd @@ -25,12 +25,7 @@ getPrevalent(x, ...) getRare(x, ...) -getPrevalentAbundance( - x, - assay.type = assay_name, - assay_name = "relabundance", - ... -) +getPrevalentAbundance(x, assay.type = "relabundance", ...) addPrevalentAbundance(x, ...) @@ -41,71 +36,27 @@ addPrevalence(x, ...) \S4method{getPrevalence}{ANY}( x, detection = 0, - include.lowest = include_lowest, - include_lowest = FALSE, + include.lowest = FALSE, sort = FALSE, na.rm = TRUE, ... ) -\S4method{getPrevalence}{SummarizedExperiment}( - x, - assay.type = assay_name, - assay_name = "counts", - rank = NULL, - ... -) +\S4method{getPrevalence}{SummarizedExperiment}(x, assay.type = "counts", rank = NULL, ...) -\S4method{getPrevalent}{ANY}( - x, - prevalence = 50/100, - include.lowest = include_lowest, - include_lowest = FALSE, - ... -) +\S4method{getPrevalent}{ANY}(x, prevalence = 50/100, include.lowest = FALSE, ...) -\S4method{getPrevalent}{SummarizedExperiment}( - x, - rank = NULL, - prevalence = 50/100, - include.lowest = include_lowest, - include_lowest = FALSE, - ... -) +\S4method{getPrevalent}{SummarizedExperiment}(x, rank = NULL, prevalence = 50/100, include.lowest = FALSE, ...) -\S4method{getRare}{ANY}( - x, - prevalence = 50/100, - include.lowest = include_lowest, - include_lowest = FALSE, - ... -) +\S4method{getRare}{ANY}(x, prevalence = 50/100, include.lowest = FALSE, ...) -\S4method{getRare}{SummarizedExperiment}( - x, - rank = NULL, - prevalence = 50/100, - include.lowest = include_lowest, - include_lowest = FALSE, - ... -) +\S4method{getRare}{SummarizedExperiment}(x, rank = NULL, prevalence = 50/100, include.lowest = FALSE, ...) \S4method{addPrevalentAbundance}{SummarizedExperiment}(x, name = "prevalent_abundance", ...) -\S4method{getPrevalentAbundance}{ANY}( - x, - assay.type = assay_name, - assay_name = "relabundance", - ... -) +\S4method{getPrevalentAbundance}{ANY}(x, assay.type = "relabundance", ...) -\S4method{getPrevalentAbundance}{SummarizedExperiment}( - x, - assay.type = assay_name, - assay_name = "counts", - rank = NULL, - ... -) +\S4method{getPrevalentAbundance}{SummarizedExperiment}(x, assay.type = "counts", rank = NULL, ...) } \arguments{ \item{x}{\code{\link[TreeSummarizedExperiment:TreeSummarizedExperiment-class]{TreeSummarizedExperiment}}.} @@ -126,8 +77,6 @@ passed to \code{getPrevalence} \item{assay.type}{\code{Character scalar}. Specifies the name of assay used in calculation. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - \item{name}{\code{Character scalar}. Specifies name of column in \code{rowData} where the results will be stored. (Default: \code{"prevalence"})} @@ -141,8 +90,6 @@ for a taxon to be considered present. (Default: \code{0})} \item{include.lowest}{\code{Logical scalar}. Should the lower boundary of the detection and prevalence cutoffs be included? (Default: \code{FALSE})} -\item{include_lowest}{Deprecated. Use \code{include.lowest} instead.} - \item{sort}{\code{Logical scalar}. Should the result be sorted by prevalence? (Default: \code{FALSE})} diff --git a/man/importBIOM.Rd b/man/importBIOM.Rd index 53a2fe833..66ee9fbca 100644 --- a/man/importBIOM.Rd +++ b/man/importBIOM.Rd @@ -14,12 +14,9 @@ importBIOM(file, col.data = NULL, tree.file = NULL, ...) convertFromBIOM( x, - prefix.rm = removeTaxaPrefixes, - removeTaxaPrefixes = FALSE, - rank.from.prefix = rankFromPrefix, - rankFromPrefix = FALSE, - artifact.rm = remove.artifacts, - remove.artifacts = FALSE, + prefix.rm = FALSE, + rank.from.prefix = FALSE, + artifact.rm = FALSE, ... ) @@ -54,19 +51,13 @@ taxonomic prefixes be removed? The prefixes is removed only from detected taxa columns meaning that \code{rank.from.prefix} should be enabled in the most cases. (Default: \code{FALSE})} -\item{removeTaxaPrefixes}{Deprecated. Use \code{prefix.rm} instead.} - \item{rank.from.prefix}{\code{Logical scalar}. If file does not have taxonomic ranks on feature table, should they be scraped from prefixes? (Default: \code{FALSE})} -\item{rankFromPrefix}{Deprecated.Use \code{rank.from.prefix} instead.} - \item{artifact.rm}{\code{Logical scalar}. If file have some taxonomic character naming artifacts, should they be removed. (default (Default: \code{FALSE})} - -\item{remove.artifacts}{Deprecated. Use \code{artifact.rm} instead.} } \value{ \code{convertFromBIOM} returns an object of class diff --git a/man/importHUMAnN.Rd b/man/importHUMAnN.Rd index 48e899d3f..28e01b180 100644 --- a/man/importHUMAnN.Rd +++ b/man/importHUMAnN.Rd @@ -12,8 +12,6 @@ rownames, or a single \code{character} value defining the file path of the sample metadata file. The file must be in \code{tsv} format (Default: \code{NULL}).} -\item{colData}{Deprecated. Use \code{col.data} instead.} - \item{...}{additional arguments: \itemize{ \item \code{assay.type}: \code{Character scalar}. Specifies the name of diff --git a/man/importMetaPhlAn.Rd b/man/importMetaPhlAn.Rd index 92e009833..341653e5b 100644 --- a/man/importMetaPhlAn.Rd +++ b/man/importMetaPhlAn.Rd @@ -12,16 +12,10 @@ rownames, or a single \code{character} value defining the file path of the sample metadata file. The file must be in \code{tsv} format (Default: \code{NULL}).} -\item{colData}{Deprecated. use \code{col.data} instead.} - -\item{sample_meta}{Deprecated. Use \code{col.data} instead.} - \item{tree.file}{\code{Character scalar}. Defines the file path of the phylogenetic tree. (Default: \code{NULL}).} -\item{phy_tree}{Deprecated. Use \code{tree.file} instead.} - \item{...}{additional arguments: \itemize{ \item \code{assay.type}: \code{Character scalar}. Specifies the name of diff --git a/man/importMothur.Rd b/man/importMothur.Rd index da546ccb7..6b963733a 100644 --- a/man/importMothur.Rd +++ b/man/importMothur.Rd @@ -4,32 +4,18 @@ \alias{importMothur} \title{Import Mothur results as a \code{TreeSummarizedExperiment}} \usage{ -importMothur( - assay.file = sharedFile, - sharedFile, - taxonomyFile = NULL, - row.file = taxonomyFile, - designFile = NULL, - col.file = designFile, - tree.file = NULL -) +importMothur(assay.file, row.file = NULL, col.file = NULL, tree.file = NULL) } \arguments{ \item{assay.file}{\code{Character scalar}. Defines the file path of the feature table to be imported. The File has to be in \code{shared file} format as defined in Mothur documentation.} -\item{sharedFile}{Deprecated. Use \code{assay.file} instead.} - -\item{taxonomyFile}{Deprecated. Use \code{row.file} instead.} - \item{row.file}{\code{Character scalar}. Defines the file path of the taxonomy table to be imported. The File has to be in \code{taxonomy file} or \code{constaxonomy file} format as defined in Mothur documentation. (Default: \code{NULL}).} -\item{designFile}{Deprecated. Use \code{col.file} instead.} - \item{col.file}{\code{Character scalar}. Defines file path of the sample metadata to be imported. The File has to be in \code{design file} format as defined in Mothur documentation. (Default: \code{NULL}).} diff --git a/man/importQIIME2.Rd b/man/importQIIME2.Rd index 9000d66fa..4593cc309 100644 --- a/man/importQIIME2.Rd +++ b/man/importQIIME2.Rd @@ -6,59 +6,41 @@ \title{Import QIIME2 results to \code{TreeSummarizedExperiment}} \usage{ importQIIME2( - assay.file = featureTableFile, - featureTableFile, - row.file = taxonomyTableFile, - taxonomyTableFile = NULL, - col.file = sampleMetaFile, - sampleMetaFile = NULL, - as.refseq = featureNamesAsRefSeq, - featureNamesAsRefSeq = TRUE, - refseq.file = refSeqFile, - refSeqFile = NULL, - tree.file = phyTreeFile, - phyTreeFile = NULL, + assay.file, + row.file = NULL, + col.file = NULL, + as.refseq = TRUE, + refseq.file = NULL, + tree.file = NULL, ... ) -importQZA(file, temp.dir = temp, temp = tempdir(), ...) +importQZA(file, temp.dir = tempdir(), ...) } \arguments{ \item{assay.file}{\code{Character scalar}. Defines the file path of the feature table to be imported.} -\item{featureTableFile}{Deprecated. use \code{assay.file} instead.} - \item{row.file}{\code{Character scalar} or \code{NULL}. Defines the file path of the taxonomy table to be imported. (default: \code{NULL}).} -\item{taxonomyTableFile}{Deprecated. use \code{row.file} instead.} - \item{col.file}{\code{Character scalar} or \code{NULL}. Defines the file path of the sample metadata to be imported. The file has to be in tsv format. (Default: \code{NULL}).} -\item{sampleMetaFile}{Deprecated. Use \code{col.file} instead.} - \item{as.refseq}{\code{Logical scalar} or \code{NULL}. Should the feature names of the feature table be regarded as reference sequences? This setting will be disregarded, if \code{refseq.file} is not \code{NULL}. If the feature names do not contain valid DNA characters only, the reference sequences will not be set.} -\item{featureNamesAsRefSeq}{Deprecated. Use \code{as.refseq} instead.} - \item{refseq.file}{\code{Character scalar} or \code{NULL}. Defines the file path of the reference sequences for each feature. (Default: \code{NULL}).} -\item{refSeqFile}{Deprecated. Use \code{refseq.file} instead.} - \item{tree.file}{\code{Character scalar}. Defines the file path of the phylogenetic tree. (Default: \code{NULL}).} -\item{phyTreeFile}{Deprecated. Use \code{tree.file} instead.} - \item{...}{additional arguments: \itemize{ \item \code{temp.dir}: the temporary directory used for decompressing the @@ -76,8 +58,6 @@ right now.} \item{temp.dir}{character, a temporary directory in which the qza file will be decompressed to, default \code{tempdir()}.} - -\item{temp}{Deprecated. Use \code{temp.dir} instead.} } \value{ A diff --git a/man/isContaminant.Rd b/man/isContaminant.Rd index 5ebd5295f..19e1232d7 100644 --- a/man/isContaminant.Rd +++ b/man/isContaminant.Rd @@ -16,8 +16,7 @@ addNotContaminantQC(x, name = "isNotContaminant", ...) \S4method{isContaminant}{SummarizedExperiment}( seqtab, - assay.type = assay_name, - assay_name = "counts", + assay.type = "counts", concentration = NULL, control = NULL, batch = NULL, @@ -29,8 +28,7 @@ addNotContaminantQC(x, name = "isNotContaminant", ...) \S4method{isNotContaminant}{SummarizedExperiment}( seqtab, - assay.type = assay_name, - assay_name = "counts", + assay.type = "counts", control = NULL, threshold = 0.5, normalize = TRUE, @@ -61,8 +59,6 @@ passed on to \code{isContaminant}/ \code{isNotContaminant} \item{assay.type}{\code{Character scalar}. Specifies the name of assay used in calculation. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - \item{concentration}{\code{Character scalar} or \code{NULL}. Defining a column with numeric values from the \code{colData} to use as concentration information. (Default: \code{NULL})} diff --git a/man/meltSE.Rd b/man/meltSE.Rd index d1aae5712..5a3c5dccf 100644 --- a/man/meltSE.Rd +++ b/man/meltSE.Rd @@ -12,16 +12,11 @@ meltSE(x, ...) \S4method{meltSE}{SummarizedExperiment}( x, - assay.type = assay_name, - assay_name = "counts", - add.row = add_row_data, - add_row_data = NULL, - add.col = add_col_data, - add_col_data = NULL, - row.name = feature_name, - feature_name = "FeatureID", - col.name = sample_name, - sample_name = "SampleID", + assay.type = "counts", + add.row = NULL, + add.col = NULL, + row.name = "FeatureID", + col.name = "SampleID", ... ) @@ -41,8 +36,6 @@ If they are not, sample names are modified. (Default: \code{TRUE}) \item{assay.type}{\code{Character scalar}. Specifies the name of assay used in calculation. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - \item{add.row}{\code{Logical scalar} or \code{Character vector}. To select information from the \code{rowData} to add to the molten assay data. If \code{add.row = NULL} no data will be added, if @@ -50,8 +43,6 @@ If \code{add.row = NULL} no data will be added, if \code{add.row} is a \code{character} vector, it will be used to subset to given column names in \code{rowData}. (Default: \code{NULL})} -\item{add_row_data}{Deprecated. Use \code{add.row} instead.} - \item{add.col}{\code{Logical scalar}. \code{NULL}, or \code{character vector}. Used to select information from the \code{colData} to add to the molten assay data. If \code{add.col = NULL} no data will @@ -59,18 +50,12 @@ be added, if \code{add.col = TRUE} all data will be added and if \code{add.col} is a \code{character} vector, it will be used to subset to given column names in \code{colData}. (Default: \code{NULL})} -\item{add_col_data}{Deprecated. Use \code{add.col} instead.} - \item{row.name}{\code{Character scalar}. To use as the output's name for the feature identifier. (Default: \code{"FeatureID"})} -\item{feature_name}{Deprecated. Use \code{row.name} instead.} - \item{col.name}{\code{Character scalar}. To use as the output's name for the sample identifier. (Default: \code{"SampleID"})} -\item{sample_name}{Deprecated. Use \code{col.name} instead.} - \item{add.dimred}{\code{Logical scalar} or \code{Character vector}. To select information from the \code{reducedDim} to add to the molten assay data. If \code{add.dimred = NULL} no data will be added, if diff --git a/man/mergeSEs.Rd b/man/mergeSEs.Rd index 3b6a7d8ec..d37347107 100644 --- a/man/mergeSEs.Rd +++ b/man/mergeSEs.Rd @@ -12,15 +12,11 @@ mergeSEs(x, y, ...) \S4method{mergeSEs}{SimpleList,missing}( x, y, - assay.type = assay_name, - assay_name = "counts", + assay.type = "counts", join = "full", - missing.values = missing_values, - missing_values = NA, - collapse.cols = collapse_samples, - collapse_samples = FALSE, - collapse.rows = collapse_features, - collapse_features = TRUE, + missing.values = NA, + collapse.cols = FALSE, + collapse.rows = TRUE, ... ) @@ -41,8 +37,6 @@ object. Must be missing when \code{x} is a list.} assays to merge. Assays not found in all the objects are dropped with a warning. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - \item{join}{\code{Character scalar}. A value for selecting the joining method. Must be 'full', 'inner', 'left', or 'right'. 'left' and 'right' are disabled when more than two objects are being merged. @@ -51,18 +45,12 @@ disabled when more than two objects are being merged. \item{missing.values}{\code{NA}, \code{0} or \code{Character scalar}. Specifies the notation of missing values. (By default: \code{NA})} -\item{missing_values}{Deprecated. Use \code{missing.values} instead.} - \item{collapse.cols}{\code{Logical scalar}. Determines whether to collapse identically named samples to one. (Default: \code{FALSE})} -\item{collapse_samples}{Deprecated. Use \code{collapse.cols} instead.} - \item{collapse.rows}{\code{Logical scalar}. Determines whether to collapse features that have identical names and taxonomy to one. (Default: \code{TRUE})} - -\item{collapse_features}{Deprecated. Use \code{collapse.rows} instead.} } \value{ A single \code{SummarizedExperiment} object. diff --git a/man/mia-defunct.Rd b/man/mia-defunct.Rd new file mode 100644 index 000000000..1b67ce76e --- /dev/null +++ b/man/mia-defunct.Rd @@ -0,0 +1,334 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/defunct.R +\name{mia-defunct} +\alias{mia-defunct} +\alias{addPerSampleDominantFeatures} +\alias{addPerSampleDominantTaxa} +\alias{addTaxonomyTree} +\alias{bestDMNFit} +\alias{calculateJSD} +\alias{calculateOverlap} +\alias{calculateUnifrac} +\alias{cluster} +\alias{countDominantFeatures} +\alias{countDominantTaxa} +\alias{estimateDivergence} +\alias{estimateDiversity} +\alias{estimateDominance} +\alias{estimateEvenness} +\alias{estimateFaith} +\alias{estimateRichness} +\alias{full_join} +\alias{getBestDMNFit} +\alias{getDMN} +\alias{getExperimentCrossAssociation} +\alias{getExperimentCrossCorrelation} +\alias{getPrevalentFeatures} +\alias{getPrevalentTaxa} +\alias{getRareFeatures} +\alias{getRareTaxa} +\alias{getTopFeatures} +\alias{getTopTaxa} +\alias{getUniqueFeatures} +\alias{getUniqueTaxa} +\alias{inner_join} +\alias{left_join} +\alias{loadFromBiom} +\alias{loadFromHumann} +\alias{loadFromMetaphlan} +\alias{loadFromMothur} +\alias{loadFromQIIME2} +\alias{makePhyloseqFromTreeSE} +\alias{makePhyloseqFromTreeSummarizedExperiment} +\alias{makeTreeSEFromBiom} +\alias{makeTreeSEFromDADA2} +\alias{makeTreeSEFromPhyloseq} +\alias{makeTreeSummarizedExperimentFromBiom} +\alias{makeTreeSummarizedExperimentFromDADA2} +\alias{makeTreeSummarizedExperimentFromPhyloseq} +\alias{meltAssay} +\alias{mergeCols} +\alias{mergeFeatures} +\alias{mergeFeaturesByPrevalence} +\alias{mergeFeaturesByRank} +\alias{mergeRows} +\alias{mergeSamples} +\alias{perSampleDominantFeatures} +\alias{perSampleDominantTaxa} +\alias{plotNMDS} +\alias{readQZA} +\alias{relabundance} +\alias{relabundance<-} +\alias{relAbundanceCounts} +\alias{right_join} +\alias{runDMN} +\alias{runJSD} +\alias{runOverlap} +\alias{runUnifrac} +\alias{subsampleCounts} +\alias{subsetByPrevalentFeatures} +\alias{subsetByPrevalentTaxa} +\alias{subsetByRareFeatures} +\alias{subsetByRareTaxa} +\alias{subsetFeatures} +\alias{subsetSamples} +\alias{subsetTaxa} +\alias{taxonomyTree} +\alias{testExperimentCrossAssociation} +\alias{testExperimentCrossCorrelation} +\alias{transformCounts} +\alias{transformFeatures} +\alias{transformSamples} +\alias{ZTransform} +\title{Defunct functions in mia} +\usage{ +addPerSampleDominantFeatures(...) + +addPerSampleDominantTaxa(...) + +addTaxonomyTree(...) + +bestDMNFit(...) + +calculateJSD(...) + +calculateOverlap(...) + +calculateUnifrac(...) + +cluster(...) + +countDominantFeatures(...) + +countDominantTaxa(...) + +estimateDivergence(...) + +estimateDiversity(...) + +estimateDominance(...) + +estimateEvenness(...) + +estimateFaith(...) + +estimateRichness(...) + +full_join(...) + +getBestDMNFit(...) + +getDMN(...) + +getExperimentCrossAssociation(...) + +getExperimentCrossCorrelation(...) + +getPrevalentFeatures(...) + +getPrevalentTaxa(...) + +getRareFeatures(...) + +getRareTaxa(...) + +getTopFeatures(...) + +getTopTaxa(...) + +getUniqueFeatures(...) + +getUniqueTaxa(...) + +inner_join(...) + +left_join(...) + +loadFromBiom(...) + +loadFromHumann(...) + +loadFromMetaphlan(...) + +loadFromMothur(...) + +loadFromQIIME2(...) + +makePhyloseqFromTreeSE(...) + +makePhyloseqFromTreeSummarizedExperiment(...) + +makeTreeSEFromBiom(...) + +makeTreeSEFromDADA2(...) + +makeTreeSEFromPhyloseq(...) + +makeTreeSummarizedExperimentFromBiom(...) + +makeTreeSummarizedExperimentFromDADA2(...) + +makeTreeSummarizedExperimentFromPhyloseq(...) + +meltAssay(...) + +mergeCols(...) + +mergeFeatures(...) + +mergeFeaturesByPrevalence(...) + +mergeFeaturesByRank(...) + +mergeRows(...) + +mergeSamples(...) + +perSampleDominantFeatures(...) + +perSampleDominantTaxa(...) + +plotNMDS(...) + +readQZA(...) + +relabundance(...) + +relabundance(x) <- value + +relAbundanceCounts(...) + +right_join(...) + +runDMN(...) + +runJSD(...) + +runOverlap(...) + +runUnifrac(...) + +subsampleCounts(...) + +subsetByPrevalentFeatures(...) + +subsetByPrevalentTaxa(...) + +subsetByRareFeatures(...) + +subsetByRareTaxa(...) + +subsetFeatures(...) + +subsetSamples(...) + +subsetTaxa(...) + +taxonomyTree(...) + +testExperimentCrossAssociation(...) + +testExperimentCrossCorrelation(...) + +transformCounts(...) + +transformFeatures(...) + +transformSamples(...) + +ZTransform(...) +} +\arguments{ +\item{...}{Ignored.} + +\item{x}{Ignored.} + +\item{value}{Ignored.} +} +\value{ +These functions do not return; they give an error. +} +\description{ +These functions were deprecated and are now defunct. Calling them gives an +error that names the replacement. +} +\details{ +The functions and their replacements: +\itemize{ +\item \code{addPerSampleDominantFeatures}, \code{addPerSampleDominantTaxa}: +\code{\link{addDominant}} +\item \code{addTaxonomyTree}: \code{\link{addHierarchyTree}} +\item \code{bestDMNFit}, \code{getBestDMNFit}, \code{getDMN}, +\code{runDMN}, and \code{calculateDMN} for a +\code{SummarizedExperiment}: \code{\link{addCluster}} with +\code{bluster::DmmParam()} +\item \code{calculateJSD}, \code{runJSD}: \code{\link{getDissimilarity}} +with \code{method = "jsd"} +\item \code{calculateOverlap}: \code{\link{getDissimilarity}} with +\code{method = "overlap"} +\item \code{calculateUnifrac}, \code{runUnifrac}: +\code{\link{getDissimilarity}} with \code{method = "unifrac"} +\item \code{cluster}: \code{\link{addCluster}} +\item \code{countDominantFeatures}, \code{countDominantTaxa}: +\code{\link{summarizeDominance}} +\item \code{estimateDiversity}, \code{estimateDominance}, +\code{estimateEvenness}, \code{estimateFaith}, \code{estimateRichness}: +\code{\link{addAlpha}} +\item \code{estimateDivergence}: \code{\link{addDivergence}} +\item \code{full_join}, \code{inner_join}, \code{left_join}, +\code{right_join}: \code{\link{mergeSEs}} with \code{join} +\item \code{getExperimentCrossAssociation}, +\code{getExperimentCrossCorrelation}, +\code{testExperimentCrossAssociation}, +\code{testExperimentCrossCorrelation}: \code{\link{getCrossAssociation}} +\item \code{getPrevalentFeatures}, \code{getPrevalentTaxa}: +\code{\link{getPrevalent}} +\item \code{getRareFeatures}, \code{getRareTaxa}: \code{\link{getRare}} +\item \code{getTopFeatures}, \code{getTopTaxa}: \code{\link{getTop}} +\item \code{getUniqueFeatures}, \code{getUniqueTaxa}: +\code{\link{getUnique}} +\item \code{loadFromBiom}: \code{\link{importBIOM}} +\item \code{loadFromHumann}: \code{\link{importHUMAnN}} +\item \code{loadFromMetaphlan}: \code{\link{importMetaPhlAn}} +\item \code{loadFromMothur}: \code{\link{importMothur}} +\item \code{loadFromQIIME2}: \code{\link{importQIIME2}} +\item \code{makePhyloseqFromTreeSE}, +\code{makePhyloseqFromTreeSummarizedExperiment}: +\code{\link{convertToPhyloseq}} +\item \code{makeTreeSEFromBiom}, +\code{makeTreeSummarizedExperimentFromBiom}: +\code{\link{convertFromBIOM}} +\item \code{makeTreeSEFromDADA2}, +\code{makeTreeSummarizedExperimentFromDADA2}: +\code{\link{convertFromDADA2}} +\item \code{makeTreeSEFromPhyloseq}, +\code{makeTreeSummarizedExperimentFromPhyloseq}: +\code{\link{convertFromPhyloseq}} +\item \code{meltAssay}: \code{\link{meltSE}} +\item \code{mergeCols}, \code{mergeSamples}: +\code{\link{agglomerateByVariable}} with \code{by = "cols"} +\item \code{mergeFeatures}, \code{mergeRows}: +\code{\link{agglomerateByVariable}} with \code{by = "rows"} +\item \code{mergeFeaturesByPrevalence}: \code{\link{subsetBy}} with +\code{collapse = TRUE} +\item \code{mergeFeaturesByRank}: \code{\link{agglomerateByRank}} +\item \code{perSampleDominantFeatures}, \code{perSampleDominantTaxa}: +\code{\link{getDominant}} +\item \code{plotNMDS}: \code{scater::plotReducedDim} with +\code{dimred = "NMDS"} +\item \code{readQZA}: \code{\link{importQZA}} +\item \code{relabundance}, \code{relabundance<-}: +\code{assay(x, "relabundance")} +\item \code{runOverlap}: \code{\link{addDissimilarity}} with +\code{method = "overlap"} +\item \code{subsampleCounts}: \code{\link{rarefyAssay}} +\item \code{subsetByPrevalentFeatures}, \code{subsetByPrevalentTaxa}, +\code{subsetByRareFeatures}, \code{subsetByRareTaxa}: +\code{\link{subsetBy}} +\item \code{subsetFeatures}, \code{subsetSamples}, \code{subsetTaxa}: +\code{[} for subsetting +\item \code{transformCounts}, \code{transformFeatures}, +\code{transformSamples}, \code{relAbundanceCounts}, \code{ZTransform}: +\code{\link{transformAssay}} +} +} diff --git a/man/rarefyAssay.Rd b/man/rarefyAssay.Rd index 30e9d2978..7643481f4 100644 --- a/man/rarefyAssay.Rd +++ b/man/rarefyAssay.Rd @@ -9,10 +9,8 @@ rarefyAssay(x, ...) \S4method{rarefyAssay}{SummarizedExperiment}( x, - assay.type = assay_name, - assay_name = "counts", - sample = min_size, - min_size = min(colSums2(assay(x, assay.type))), + assay.type = "counts", + sample = min(colSums2(assay(x, assay.type))), replace = FALSE, name = "subsampled", ... @@ -30,14 +28,10 @@ messages. (Default: \code{TRUE}) \item{assay.type}{\code{Character scalar}. Specifies the name of assay used in calculation. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - \item{sample}{\code{Integer scalar}. Indicates the number of counts being simulated i.e. rarefying depth. This can equal to lowest number of total counts found in a sample or a user specified number.} -\item{min_size}{Deprecated. Use \code{sample} instead.} - \item{replace}{\code{Logical scalar}. Whether to åperform subsampling with replacement. Ths works similarly to \code{sample(..., replace = TRUE)}. (Default: \code{FALSE})} diff --git a/man/runCCA.Rd b/man/runCCA.Rd index a0c0ede12..585376daa 100644 --- a/man/runCCA.Rd +++ b/man/runCCA.Rd @@ -34,12 +34,9 @@ runCCA(x, ...) \S4method{getCCA}{SummarizedExperiment}( x, formula = NULL, - col.var = variables, - variables = NULL, + col.var = NULL, test.signif = TRUE, - assay.type = assay_name, - assay_name = exprs_values, - exprs_values = "counts", + assay.type = "counts", ... ) @@ -54,12 +51,9 @@ runRDA(x, ...) \S4method{getRDA}{SummarizedExperiment}( x, formula = NULL, - col.var = variables, - variables = NULL, + col.var = NULL, test.signif = TRUE, - assay.type = assay_name, - assay_name = exprs_values, - exprs_values = NULL, + assay.type = NULL, dis.name = NULL, ... ) @@ -125,8 +119,6 @@ including covariates defined by \code{formula}.} \code{SummarizedExperiment},\code{col.var} can be used to specify variables from \code{colData}.} -\item{variables}{Deprecated. Use \code{col.var} instead.} - \item{test.signif}{\code{Logical scalar}. Should the PERMANOVA and analysis of multivariate homogeneity of group dispersions be performed. (Default: \code{TRUE})} @@ -134,10 +126,6 @@ of multivariate homogeneity of group dispersions be performed. \item{assay.type}{\code{Character scalar}. Specifies the name of assay used in calculation. (Default: \code{NULL})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - -\item{exprs_values}{Deprecated. Use \code{assay.type} instead.} - \item{altexp}{\code{Character scalar} or \code{integer scalar}. Specifies an alternative experiment containing the input data.} diff --git a/man/runDPCoA.Rd b/man/runDPCoA.Rd index 6164f7d59..c358c27b2 100644 --- a/man/runDPCoA.Rd +++ b/man/runDPCoA.Rd @@ -16,22 +16,13 @@ getDPCoA(x, y, ...) y, ncomponents = 2, ntop = NULL, - subset.row = subset_row, - subset_row = NULL, + subset.row = NULL, scale = FALSE, transposed = FALSE, ... ) -\S4method{getDPCoA}{TreeSummarizedExperiment,missing}( - x, - ..., - assay.type = assay_name, - assay_name = exprs_values, - exprs_values = "counts", - tree.name = tree_name, - tree_name = "phylo" -) +\S4method{getDPCoA}{TreeSummarizedExperiment,missing}(x, ..., assay.type = "counts", tree.name = "phylo") calculateDPCoA(x, ...) @@ -59,8 +50,6 @@ to use for dimensionality reduction. This can be a character vector of row names, an integer vector of row indices or a logical vector. (Default: \code{NULL})} -\item{subset_row}{Deprecated. Use \code{subset.row} instead.} - \item{scale}{\code{Logical scalar}. Should the expression values be standardized? (Default: \code{FALSE})} @@ -70,16 +59,10 @@ cells in rows. (Default: \code{FALSE})} \item{assay.type}{\code{Character scalar}. Specifies the name of assay used in calculation. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - -\item{exprs_values}{Deprecated. Use \code{assay.type} instead.} - \item{tree.name}{\code{Character scalar}. Specifies the name of the tree to be included in the phyloseq object that is created, (Default: \code{"phylo"})} -\item{tree_name}{Deprecated. Use \code{tree.name} instead.} - \item{altexp}{\code{Character scalar} or \code{integer scalar}. Specifies an alternative experiment containing the input data. (Default: \code{NULL})} diff --git a/man/runNMDS.Rd b/man/runNMDS.Rd index 0dfec5db2..81d572c00 100644 --- a/man/runNMDS.Rd +++ b/man/runNMDS.Rd @@ -15,37 +15,24 @@ getNMDS(x, ...) \S4method{getNMDS}{ANY}( x, FUN = getDissimilarity, - nmds.fun = nmdsFUN, - nmdsFUN = c("isoMDS", "monoMDS"), + nmds.fun = c("isoMDS", "monoMDS"), ncomponents = 2, ntop = 500, - subset.row = subset_row, - subset_row = NULL, + subset.row = NULL, scale = FALSE, transposed = FALSE, - keep.dist = keep_dist, - keep_dist = FALSE, + keep.dist = FALSE, ... ) -\S4method{getNMDS}{SummarizedExperiment}( - x, - ..., - assay.type = assay_name, - assay_name = exprs_values, - exprs_values = "counts", - FUN = getDissimilarity -) +\S4method{getNMDS}{SummarizedExperiment}(x, ..., assay.type = "counts", FUN = getDissimilarity) \S4method{getNMDS}{SingleCellExperiment}( x, ..., - assay.type = assay_name, - assay_name = exprs_values, - exprs_values = "counts", + assay.type = "counts", dimred = NULL, - ndimred = n_dimred, - n_dimred = NULL, + ndimred = NULL, FUN = getDissimilarity ) @@ -74,8 +61,6 @@ implementation, either \dQuote{isoMDS} for \code{\link[MASS:isoMDS]{MASS::isoMDS}} or \dQuote{monoMDS} for \code{\link[vegan:monoMDS]{vegan::monoMDS}}} -\item{nmdsFUN}{Deprecated. Use \code{nmds.fun} instead.} - \item{ncomponents}{\code{Numeric scalar}. Indicates the number of DPCoA dimensions to obtain. (Default: \code{2})} @@ -88,8 +73,6 @@ to use for dimensionality reduction. This can be a character vector of row names, an integer vector of row indices or a logical vector. (Default: \code{NULL})} -\item{subset_row}{Deprecated. Use \code{subset.row} instead.} - \item{scale}{\code{Logical scalar}. Should the expression values be standardized? (Default: \code{FALSE})} @@ -101,23 +84,15 @@ object calculated by \code{FUN} should be stored as \sQuote{dist} attribute of the matrix returned/stored by \code{getNMDS}/ \code{addNMDS}. (Default: \code{FALSE})} -\item{keep_dist}{Deprecated. Use \code{keep.dist} instead.} - \item{assay.type}{\code{Character scalar}. Specifies the name of assay used in calculation. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - -\item{exprs_values}{Deprecated. Use \code{assay.type} instead.} - \item{dimred}{\code{Character scalar} or \code{integer scalar}. Specifies the existing dimensionality reduction results to use.} \item{ndimred}{\code{integer vector}. Specifies the dimensions to use if dimred is specified.} -\item{n_dimred}{Deprecated. Use \code{ndimred} instead.} - \item{altexp}{\code{Character scalar} or \code{integer scalar}. Specifies an alternative experiment containing the input data. (Default: \code{NULL})} diff --git a/man/splitOn.Rd b/man/splitOn.Rd index 4efa2c207..1c596fa86 100644 --- a/man/splitOn.Rd +++ b/man/splitOn.Rd @@ -15,22 +15,15 @@ splitOn(x, ...) unsplitOn(x, ...) -\S4method{splitOn}{SummarizedExperiment}(x, group = f, f = NULL, ...) +\S4method{splitOn}{SummarizedExperiment}(x, group = NULL, ...) -\S4method{splitOn}{SingleCellExperiment}(x, group = f, f = NULL, ...) +\S4method{splitOn}{SingleCellExperiment}(x, group = NULL, ...) \S4method{unsplitOn}{list}(x, ...) \S4method{unsplitOn}{SimpleList}(x, ...) -\S4method{unsplitOn}{SingleCellExperiment}( - x, - altexp = altExpNames, - altExpNames = names(altExps(x)), - keep.dimred = keep_reducedDims, - keep_reducedDims = FALSE, - ... -) +\S4method{unsplitOn}{SingleCellExperiment}(x, altexp = names(altExps(x)), keep.dimred = FALSE, ...) } \arguments{ \item{x}{\code{\link[TreeSummarizedExperiment:TreeSummarizedExperiment-class]{TreeSummarizedExperiment}}.} @@ -54,19 +47,13 @@ merged. If \code{length(levels(group)) == nrow(x)/ncol(x)}, \code{x} will be returned unchanged. If \code{group} matches with both dimensions, \code{by} must be specified. (Default: \code{NULL})} -\item{f}{Deprecated. Use \code{group} instead.} - \item{altexp}{\code{Character vector}. Specify the alternative experiments to be unsplit. (Default: \code{names(altExps(x))})} -\item{altExpNames}{Deprecated. Use \code{altexp} instead.} - \item{keep.dimred}{\code{Logical scalar}. Should the \code{reducedDims(x)} be transferred to the result? Please note, that this breaks the link between the data used to calculate the reduced dims. (Default: \code{FALSE})} - -\item{keep_reducedDims}{Deprecated. Use \code{keep.dimred} instead.} } \value{ For \code{splitOn}: \code{SummarizedExperiment} objects in a diff --git a/man/summary.Rd b/man/summary.Rd index 08b78c386..f06cc350c 100644 --- a/man/summary.Rd +++ b/man/summary.Rd @@ -19,8 +19,7 @@ getTop( x, top = 5L, method = c("mean", "sum", "median", "sd", "cv", "prevalence"), - assay.type = assay_name, - assay_name = "counts", + assay.type = "counts", na.rm = TRUE, sort = FALSE, ... @@ -30,8 +29,7 @@ getTop( x, top = 5L, method = c("mean", "sum", "median", "sd", "cv", "prevalence"), - assay.type = assay_name, - assay_name = "counts", + assay.type = "counts", na.rm = TRUE, sort = FALSE, ... @@ -39,9 +37,9 @@ getTop( \S4method{getUnique}{SummarizedExperiment}(x, rank = NULL, ...) -\S4method{summarizeDominance}{SummarizedExperiment}(x, group = NULL, name = "dominant_taxa", ...) +\S4method{summarizeDominance}{SummarizedExperiment}(x, group = NULL, name = "dominant_taxa", rank = NULL, ...) -\S4method{summary}{SummarizedExperiment}(object, assay.type = assay_name, assay_name = "counts") +\S4method{summary}{SummarizedExperiment}(object, assay.type = "counts") } \arguments{ \item{x}{\code{\link[TreeSummarizedExperiment:TreeSummarizedExperiment-class]{TreeSummarizedExperiment}}.} @@ -72,8 +70,6 @@ of variation, so rare features should be filtered out first, e.g., with \item{assay.type}{\code{Character scalar}. Specifies the name of the assay used in calculation. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - \item{na.rm}{\code{Logical scalar}. Should NA values be omitted? (Default: \code{TRUE})} diff --git a/man/taxonomy-methods.Rd b/man/taxonomy-methods.Rd index 39cd5001e..e01b7e83f 100644 --- a/man/taxonomy-methods.Rd +++ b/man/taxonomy-methods.Rd @@ -48,23 +48,13 @@ getTaxonomyRanks() \S4method{getTaxonomyLabels}{SummarizedExperiment}( x, empty.fields = c(NA, "", " ", "\\t", "-", "_"), - with.rank = with_rank, - with_rank = FALSE, - make.unique = make_unique, - make_unique = TRUE, - resolve.loops = resolve_loops, - resolve_loops = FALSE, + with.rank = FALSE, + make.unique = TRUE, + resolve.loops = FALSE, ... ) -\S4method{mapTaxonomy}{SummarizedExperiment}( - x, - taxa = NULL, - from = NULL, - to = NULL, - use.grepl = use_grepl, - use_grepl = FALSE -) +\S4method{mapTaxonomy}{SummarizedExperiment}(x, taxa = NULL, from = NULL, to = NULL, use.grepl = FALSE) IdTaxaToDataFrame(from) } @@ -92,20 +82,14 @@ collapsed. (Default: \code{NULL}) \item{with.rank}{\code{Logical scalar}. Should the level be add as a suffix? For example: "Phylum:Crenarchaeota". (Default: \code{FALSE})} -\item{with_rank}{Deprecated. Use \code{with.rank} instead.} - \item{make.unique}{\code{Logical scalar}. Should the labels be made unique, if there are any duplicates? A message lists the changed labels, e.g. \code{"o -> o_1"}. (Default: \code{TRUE})} -\item{make_unique}{Deprecated. Use \code{make.unique} instead.} - \item{resolve.loops}{\code{Logical scalar}. Should \code{resolveLoops} be applied to the taxonomic data? Please note that has only an effect, if the data is unique. (Default: \code{TRUE})} -\item{resolve_loops}{Deprecated. Use \code{resolve.loops} instead.} - \item{taxa}{\code{Character vector}. Used for subsetting the taxonomic information. If no information is found,\code{NULL} is returned for the individual element. (Default: \code{NULL})} @@ -123,8 +107,6 @@ taxonomic rank. (Default: \code{NULL})} \item{use.grepl}{\code{Logical}. Should pattern matching via \code{grepl} be used? Otherwise literal matching is used. (Default: \code{FALSE})} - -\item{use_grepl}{Deprecated. Use \code{use.grepl} instead.} } \value{ \itemize{ diff --git a/man/transformAssay.Rd b/man/transformAssay.Rd index a6928d8af..f0f6fcc5d 100644 --- a/man/transformAssay.Rd +++ b/man/transformAssay.Rd @@ -12,7 +12,6 @@ transformAssay(x, ...) x, method, assay.type = "counts", - assay_name = NULL, MARGIN = "samples", name = method, pseudocount = FALSE, @@ -73,8 +72,6 @@ method.} \item{assay.type}{\code{Character scalar}. Specifies the name of assay used in calculation. (Default: \code{"counts"})} -\item{assay_name}{Deprecated. Use \code{assay.type} instead.} - \item{MARGIN}{\code{Character scalar}. Determines whether the transformation is applied sample (column) or feature (row) wise. (Default: \code{"samples"})} diff --git a/tests/testthat/test-2mergeSEs.R b/tests/testthat/test-2mergeSEs.R index bb85c0ed8..be24a00ce 100644 --- a/tests/testthat/test-2mergeSEs.R +++ b/tests/testthat/test-2mergeSEs.R @@ -72,8 +72,10 @@ test_that("mergeSEs gives same result for all input formats", { ref <- mergeSEs(se1, se2) expect_equal(mergeSEs(list(se1, se2)), ref) expect_equal(mergeSEs(SimpleList(se1, se2)), ref) - # Deprecated argument names - expect_equal(mergeSEs(se1, se2, assay_name = "counts"), ref) + # Defunct argument names + expect_error( + mergeSEs(se1, se2, assay_name = "counts"), + "'assay_name' is defunct. Use 'assay.type' instead.") }) test_that("mergeSEs merges assays", { diff --git a/tests/testthat/test-4IO.R b/tests/testthat/test-4IO.R index a90852865..c478e3708 100644 --- a/tests/testthat/test-4IO.R +++ b/tests/testthat/test-4IO.R @@ -567,7 +567,7 @@ test_that("Import HUMAnN file", { expect_equal(tse, tse2) # cd <- colData(tse) - tse2 <- importHUMAnN(file_path, colData = cd) + tse2 <- importHUMAnN(file_path, col.data = cd) # colData should not change the result expect_equal(tse, tse2) }) diff --git a/tests/testthat/test-5dominantTaxa.R b/tests/testthat/test-5dominantTaxa.R index ee47df59b..f94442a4e 100644 --- a/tests/testthat/test-5dominantTaxa.R +++ b/tests/testthat/test-5dominantTaxa.R @@ -30,7 +30,7 @@ test_that("getDominant", { "Order:Stramenopiles","Order:Stramenopiles","Order:Stramenopiles") names(exp.vals.two) <- exp.names.one expect_equal( - getDominant(tse, rank = "Genus", ignore.taxonomy = FALSE, empty.rm = FALSE)[1:15], + getDominant(tse, group = "Genus", ignore.taxonomy = FALSE, empty.rm = FALSE)[1:15], exp.vals.two) # Check if DominantTaxa is added to coldata @@ -38,7 +38,7 @@ test_that("getDominant", { colData(addDominant(tse, name="dominant"))$dominant[1:15], exp.vals.one) expect_equal( - colData(addDominant(tse,rank = "Genus", empty.rm = FALSE, name="dominant"))$dominant[1:15], + colData(addDominant(tse,group = "Genus", empty.rm = FALSE, name="dominant"))$dominant[1:15], exp.vals.two) # Check if DominantTaxa is added when factor is passed @@ -52,7 +52,7 @@ test_that("getDominant", { test <- tse rowData(test)$group <- rowData(tse)$Genus expect_equal( - colData(addDominant(test, rank = "group", empty.rm = TRUE, name = "dominant"))$dominant[1:15], + colData(addDominant(test, group = "group", empty.rm = TRUE, name = "dominant"))$dominant[1:15], exp.vals.three) tse1 <- tse diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index 9c673afcf..3cdb7d7d6 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -30,11 +30,10 @@ test_that("transformAssay input checks", { expect_error( transformAssay(se, method = "alr", reference = c(1, 2)), "'reference' must be a single value") - # Deprecated argument - expect_warning(res <- transformAssay( - as(se, "TreeSummarizedExperiment"), method = "pa", - assay_name = "counts")) - expect_true("pa" %in% assayNames(res)) + # Defunct argument + expect_error( + transformAssay(se, method = "pa", assay_name = "counts"), + "'assay_name' is defunct. Use 'assay.type' instead.") }) test_that("transformAssay adds assay and keeps the input intact", { diff --git a/tests/testthat/test-6cca.R b/tests/testthat/test-6cca.R index db9878a0a..4f55be77a 100644 --- a/tests/testthat/test-6cca.R +++ b/tests/testthat/test-6cca.R @@ -39,7 +39,7 @@ test_that("CCA", { expect_true(is.null(attributes(mat)$significance)) # Check that significance calculations are correct set.seed(46) - sce <- addCCA(sce, variables = "Manure", full = TRUE) + sce <- addCCA(sce, col.var = "Manure", full = TRUE) actual <- reducedDim(sce,"CCA") res <- attributes(actual)$significance # Create a function that calculates significances @@ -106,10 +106,10 @@ test_that("CCA", { GlobalPatterns <- addAlpha(GlobalPatterns, index = "shannon") expect_error(getRDA( GlobalPatterns, assay.type = "counts", - variables = c("Primer", "test"))) + col.var = c("Primer", "test"))) res1 <- getRDA( GlobalPatterns, assay.type = "counts", - variables = c("shannon", "SampleType")) + col.var = c("shannon", "SampleType")) res1 <- attr(res1, "obj")$CCA res2 <- getRDA( GlobalPatterns, assay.type = "counts", @@ -120,12 +120,12 @@ test_that("CCA", { data("enterotype", package = "mia") variable_names <- c("ClinicalStatus", "Gender", "Age") res <- addRDA( - enterotype, assay.type = "counts", variables = variable_names, + enterotype, assay.type = "counts", col.var = variable_names, na.action = na.exclude) expect_equal(colnames(res), colnames(enterotype)) # Expect warning since samples are removed because na.omit was used. res <- addRDA( - enterotype, assay.type = "counts", variables = variable_names, + enterotype, assay.type = "counts", col.var = variable_names, na.action = na.omit) |> expect_warning() enterotype <- enterotype[, complete.cases(colData(enterotype)[, variable_names])] expect_equal(colnames(res), colnames(enterotype)) diff --git a/tests/testthat/test-deprecate.R b/tests/testthat/test-deprecate.R index 15f4dc973..718e1d9d7 100644 --- a/tests/testthat/test-deprecate.R +++ b/tests/testthat/test-deprecate.R @@ -18,18 +18,6 @@ test_that("Deprecated prevalence functions give a deprecation warning", { expect_warning( agglomerateByPrevalence(tse, rank = "Phylum"), "'agglomerateByPrevalence' is deprecated") - expect_warning( - mergeFeaturesByPrevalence(tse, rank = "Phylum"), - "'mergeFeaturesByPrevalence' is deprecated") - expect_warning( - subsetByPrevalentTaxa(tse), "'subsetByPrevalentTaxa' is deprecated") - expect_warning( - subsetByPrevalentFeatures(tse), - "'subsetByPrevalentFeatures' is deprecated") - expect_warning( - subsetByRareTaxa(tse), "'subsetByRareTaxa' is deprecated") - expect_warning( - subsetByRareFeatures(tse), "'subsetByRareFeatures' is deprecated") }) test_that("subsetByPrevalent and subsetByRare match subsetBy", { @@ -65,17 +53,6 @@ test_that("subsetByPrevalent and subsetByRare match subsetBy", { rare <- .quiet_deprecated(subsetByRare(tse, prevalence = 0.3)) expect_setequal(c(rownames(prevalent), rownames(rare)), rownames(tse)) expect_length(intersect(rownames(prevalent), rownames(rare)), 0L) - # Aliases give the same result - expect_identical( - .quiet_deprecated(subsetByPrevalentTaxa(tse, prevalence = 0.3)), - prevalent) - expect_identical( - .quiet_deprecated(subsetByPrevalentFeatures(tse, prevalence = 0.3)), - prevalent) - expect_identical( - .quiet_deprecated(subsetByRareTaxa(tse, prevalence = 0.3)), rare) - expect_identical( - .quiet_deprecated(subsetByRareFeatures(tse, prevalence = 0.3)), rare) # rowData variables do not mask the condition tse_keep <- tse rowData(tse_keep)[["keep"]] <- TRUE @@ -108,11 +85,6 @@ test_that("agglomerateByPrevalence matches subsetBy with collapse", { tse, rank = "Phylum", other.name = "Rest")) expect_identical(tail(rownames(res), 1L), "Rest") expect_identical(rowData(res)["Rest", "Phylum"], "Rest") - # mergeFeaturesByPrevalence gives the same result - expect_identical( - .quiet_deprecated(mergeFeaturesByPrevalence( - tse, rank = "Phylum", other.name = "Rest")), - res) # No "Other" row if all features are prevalent res <- .quiet_deprecated(agglomerateByPrevalence( tse, rank = "Kingdom", prevalence = 0)) @@ -139,3 +111,56 @@ test_that("Deprecated prevalence functions check input", { .quiet_deprecated(agglomerateByPrevalence(tse, other.name = TRUE)), "'other.name' must be a single character value") }) + +test_that("Defunct functions give an error naming the replacement", { + data(GlobalPatterns, package = "mia") + tse <- GlobalPatterns + defunct <- c( + cluster = "addCluster", getTopTaxa = "getTop", + loadFromBiom = "importBIOM", mergeRows = "agglomerateByVariable", + subsetByRareTaxa = "subsetBy", transformCounts = "transformAssay") + for( fun in names(defunct) ){ + expect_error( + get(fun)(tse), paste0("'", fun, "' is defunct. Use '", + defunct[[fun]], "'"), + class = "defunctError") + } + expect_error(relabundance(tse) <- 1, class = "defunctError") +}) + +test_that("Defunct argument names give an error naming the new argument", { + data(GlobalPatterns, package = "mia") + tse <- GlobalPatterns + expect_error( + getPrevalence(tse, assay_name = "counts"), + "'assay_name' is defunct. Use 'assay.type' instead.") + expect_error( + getPrevalent(tse, include_lowest = TRUE), + "'include_lowest' is defunct. Use 'include.lowest' instead.") + expect_error( + getDominant(tse, rank = "Genus"), + "'rank' is defunct. Use 'group' instead.") + expect_error( + agglomerateByVariable(tse, by = "rows", f = "Phylum"), + "'f' is defunct. Use 'group' instead.") + # The new names give the same result as before + expect_equal( + getPrevalence(tse, assay.type = "counts"), + getPrevalence(assay(tse, "counts"))) + expect_equal( + getDominant(tse, group = "Genus"), + getDominant(agglomerateByRank(tse, rank = "Genus"))) + expect_equal( + agglomerateByVariable(tse, by = "rows", group = "Phylum"), + agglomerateByVariable(tse, by = "rows", rowData(tse)$Phylum)) +}) + +test_that("calculateDMN is deprecated for matrices and defunct for SE", { + data(GlobalPatterns, package = "mia") + tse <- agglomerateByRank(GlobalPatterns, rank = "Phylum") + expect_error(calculateDMN(tse), "defunct") + mat <- t(assay(tse, "counts")) + expect_warning(res <- calculateDMN(mat, k = 1:2, seed = 1), "deprecated") + expect_length(res, 2L) + expect_s4_class(res[[1L]], "DMN") +})